Expand my Community achievements bar.

get All group from LCES using Livecycle java API

Avatar

Level 2

Hello ,

Can anyone told me how i can retrieve all the groups that exist in my livecyle using JAVA API.

Some method who return all groups ??


Thanks!

4 Replies

Avatar

Level 2

Yeah i have get look at the Directory manager

but i didn't find any method who return the whole group existing in my livecycle directory.

so please if you can tell me wich one i'll be glad

thanks !

Avatar

Former Community Member

You can get user/groups by using the PrincipalSearchFilter API,

PrincipalSearchFilter psf = new PrincipalSearchFilter();

psf.setSpecificDomainName(domainName); // Optional - if you know which domain you are searching within

psf.setCanonicalName(canonicalName); // Optional - if the canonical name of the group is known
psf.setCommonName(cn); // Optional - if the common name of the group is known
psf.setDomainOids(domainOids); - // Optional - if searching within a list of domains
psf.setPrincipalOid(principalOid); - // Optional - if the OID of hte user/group is knwon
psf.setPrincipalType(Principal.PRINCIPALTYPE_GROUP); - //Recommended - refines the search to a User or Group
psf.setRetrieveOnlyActive(); - // Recommended - returns only ative users/groups and not obsolete/deleted users/groups
psf.setResultsMax(int resultsMax); - // optional -to limit the search result

List<Principal> resultList = directoryManager.findPrincipals(psf);

You can then typecast the Principals fetched into User or Group.

Avatar

Level 2

First Thank you for your answer

I tried this part

//Set connection properties required to invoke LiveCycle ES

            Properties connectionProps = new Properties();

            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://test:1099");

                                                                  connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);

            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");

            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");

            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

            ServiceClientFactory scf = ServiceClientFactory.createInstance(connectionProps);

            DirectoryManager directoryManager = new DirectoryManagerServiceClient(scf);

            PrincipalSearchFilter psf = new PrincipalSearchFilter();

    psf.setPrincipalType(Principal.PRINCIPALTYPE_GROUP);  //Recommended - refines the search to a User or Group

    psf.setRetrieveOnlyActive(); // Recommended - returns only ative users/groups and not obsolete/deleted users/groups

    List<Principal> resultList = directoryManager.findPrincipals(psf);

    System.out.println("Done");

and when I check the result of my list I find incomprehensible informations.

So when I debug the code ,  my list  contains little information.

NB : my LDAP contains hundreds of groups.

Any suggestion

Any code Source.