Skip to main content
10-Marble
April 30, 2025
Solved

OrganizationServicesManager.queryPrincipals API in Windchill13

  • April 30, 2025
  • 2 replies
  • 678 views

Version: Windchill 13.0

 

Use Case: wt.org.OrganizationServicesManager.queryPrincipals(Class, String,DirectoryContextProvider) we were using the API OrganizationServicesManager.queryPrincipals(Class, String,DirectoryContextProvider) in WIndchill12. But now in Windchill 13 it is replaced by OrganizationServicesManager.queryPrincipals(Class paramClass, Map<String, List> paramMap, DirectoryContextProvider paramDirectoryContextProvider). Previously parameters what we were passing were of type Class - wt.org.WTUser, String - "uid=" + userid and DirectoryConectProvider. now in new version, it is given as passing map, but not sure what should be the key and what should be the value. Can someone help me through it?


Description:

wt.org.OrganizationServicesManager.queryPrincipals(Class, String,DirectoryContextProvider)
we were using the API OrganizationServicesManager.queryPrincipals(Class, String,DirectoryContextProvider) in WIndchill12. But now in Windchill 13 it is replaced by OrganizationServicesManager.queryPrincipals(Class paramClass, Map<String, List<String>> paramMap, DirectoryContextProvider paramDirectoryContextProvider).

Previously parameters what we were passing were of type Class - wt.org.WTUser, String - "uid=" + userid and DirectoryConectProvider.
now in new version, it is given as passing map, but not sure what should be the key and what should be the value. Can someone help me through it?

Best answer by avillanueva

Ok here is my run on a WC 13 system:

queryPrincipals(Class, String, DirectoryContextProvider) --> Start
2025-05-01 08:55:07,268 DEBUG [ajp-nio-127.0.0.1-8010-exec-4] wt.org.StandardOrganizationServicesManager wcadmin - queryPrincipals(Class, String, DirectoryContextProvider, Map<String, ArrayList<String>>): principalClass:wt.org.WTUser criteria:(((fullName='avillanueva'))|((authenticationName='avillanueva'))) context:wt.org.GenericDirectoryContextProvider@52421993 criteriaMap:{fullName=[avillanueva], authenticationName=[avillanueva], Operator=[|]}
2025-05-01 08:55:07,268 DEBUG [ajp-nio-127.0.0.1-8010-exec-4] wt.org.StandardOrganizationServicesManager wcadmin - !context.getUserDefinedPrincipalsSearchCriteria().isIncludeOrganizations() condition true
2025-05-01 08:55:07,268 DEBUG [ajp-nio-127.0.0.1-8010-exec-4] wt.org.StandardOrganizationServicesManager wcadmin - queryPrincipals(Class, String, DirectoryContextProvider, boolean, Map): principalClass:wt.org.WTUser criteria:(((fullName='avillanueva'))|((authenticationName='avillanueva'))) context:wt.org.GenericDirectoryContextProvider@52421993 exactClassMatch: true criteriaMap:{fullName=[avillanueva], authenticationName=[avillanueva], Operator=[|]}
2025-05-01 08:55:07,268 DEBUG [ajp-nio-127.0.0.1-8010-exec-4] wt.org.StandardOrganizationServicesManager wcadmin - queryPrincipals(Class, String, DirectoryContextProvider) services:[local.dmtllc.Ldap, Windchill] sizeLimit:50

I searched on username "avillanueva" so I think the map is this criteriaMap value it reported back:

criteriaMap:{fullName=[avillanueva], authenticationName=[avillanueva], Operator=[|]}

So this should be a map of three values, fullname, authenticationName and Operator. Looks like it is searching either field. While the docs do say ArrayList<String>, there is only one value for each. 

2 replies

avillanueva
23-Emerald I
23-Emerald I
May 1, 2025

I found this article which you likely found too: https://www.ptc.com/en/support/article/CS433891?source=search

Agree just a terrible write up providing no real details. They basically told us to enable debug logging and find out map ourselves. Why not save us the effort? Testing on 12 which not sure is using this, it is VERY chatty. Recommend doing this off hours to do this test and turn off Debug immediately.

10-Marble
May 1, 2025

@avillanueva , I will try this. Thank you

avillanueva
23-Emerald I
23-Emerald I
May 1, 2025

Ok here is my run on a WC 13 system:

queryPrincipals(Class, String, DirectoryContextProvider) --> Start
2025-05-01 08:55:07,268 DEBUG [ajp-nio-127.0.0.1-8010-exec-4] wt.org.StandardOrganizationServicesManager wcadmin - queryPrincipals(Class, String, DirectoryContextProvider, Map<String, ArrayList<String>>): principalClass:wt.org.WTUser criteria:(((fullName='avillanueva'))|((authenticationName='avillanueva'))) context:wt.org.GenericDirectoryContextProvider@52421993 criteriaMap:{fullName=[avillanueva], authenticationName=[avillanueva], Operator=[|]}
2025-05-01 08:55:07,268 DEBUG [ajp-nio-127.0.0.1-8010-exec-4] wt.org.StandardOrganizationServicesManager wcadmin - !context.getUserDefinedPrincipalsSearchCriteria().isIncludeOrganizations() condition true
2025-05-01 08:55:07,268 DEBUG [ajp-nio-127.0.0.1-8010-exec-4] wt.org.StandardOrganizationServicesManager wcadmin - queryPrincipals(Class, String, DirectoryContextProvider, boolean, Map): principalClass:wt.org.WTUser criteria:(((fullName='avillanueva'))|((authenticationName='avillanueva'))) context:wt.org.GenericDirectoryContextProvider@52421993 exactClassMatch: true criteriaMap:{fullName=[avillanueva], authenticationName=[avillanueva], Operator=[|]}
2025-05-01 08:55:07,268 DEBUG [ajp-nio-127.0.0.1-8010-exec-4] wt.org.StandardOrganizationServicesManager wcadmin - queryPrincipals(Class, String, DirectoryContextProvider) services:[local.dmtllc.Ldap, Windchill] sizeLimit:50

I searched on username "avillanueva" so I think the map is this criteriaMap value it reported back:

criteriaMap:{fullName=[avillanueva], authenticationName=[avillanueva], Operator=[|]}

So this should be a map of three values, fullname, authenticationName and Operator. Looks like it is searching either field. While the docs do say ArrayList<String>, there is only one value for each. 

Community Moderator
May 8, 2025

Hello @LT_12699133

 

It looks like you have some responses from our community champion. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.