Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
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?
Solved! Go to Solution.
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.
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.
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.
Thank you, I was able to use it like below:
DirectoryContextProvider[] contexts = WTContainerHelper.service.getPublicContextProviders(principalSpec);
Map<String, List<String>> criteriaMap = new HashMap<>();
criteriaMap.put(WTPrincipal.NAME, new ArrayList<>(Arrays.asList(name)));
Enumeration results = OrganizationServicesHelper.manager.queryPrincipals(principalClass, criteriaMap, contexts);
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.