Skip to main content
1-Visitor
Jun 12, 2017 11:57 AM UTC
Question

How to get list of groups from Site level

Hi,

Is there an API through which I enumerate the list of all available groups in my Windchill. I'm able to do this through an Oracle Query from the Database but still would like to know if this can be achieved through any available API, rather than going through the process of having a read only account for Database and resolving the Database query from my code.

Thanks in advance!

Amarkarthi

1 reply

2-Explorer
Jun 12, 2017 12:47 PM UTC

Similar to SQL, you can use query spec to get this information.

qs = new QuerySpec(WTGroup.class); 

   SearchCondition sc1 = new SearchCondition(WTGroup.class, 

   WTGroup.INTERNAL, SearchCondition.IS_FALSE); 

   qs.appendWhere(sc1); 

   QueryResult qr = PersistenceHelper.manager.find(qs);

   while (qr.hasMoreElements()) { 

  

     WTGroup group = (WTGroup) qr.nextElement(); 

   if (group.getName().equals("ORG ADMIN")){ 

   continue; 

   } 

   if (!group.isDisabled()) { 

   getMembers(group.getDn(), group);   

   } 

   } 

   } catch (WTException ex) { 

   ex.printStackTrace(); 

   } 

   generateReport();

   } 

Translate