Setting Candidate Queries — Service Connector API Example (Java)
Example code is provided that illustrates configuring a candidate query using method calls available in the Service Connector API.
The step numbers in the comments correspond to the steps in the illustration, Configuring a Candidate Query.
public void setCandidateQueries(int aModelVersion) throws DirectoryEngineFault, SecurityFault { // Step 1: get details of all model entities in given major version // including extension points and model templates GetOrgModelResponse model = getOrgModelService().getOrgModel(aModelVersion, false, false, false, true); // get details of all configured LDAP Containers XmlContainer[] ldapContainers = getDirectoryService().listContainers(); // select, or create, an LDAP Container XmlContainer ldapContainer = ldapContainers[0]; XmlCandidateQueryAssignment[] settings = new XmlCandidateQueryAssignment[2]; // locate position and define candidate query XmlPosition position = findPosition(model, "BoardOfDirectors", "Director"); settings[0] = XmlCandidateQueryAssignment.Factory.newInstance(); settings[0].setPosition(position.getGuid()); settings[0].setContainerId(ldapContainer.getId()); settings[0].setBaseDn("ou=London"); settings[0].setQuery("(objectclass=person)"); settings[0].setSearchScope(XmlLdapSearchScope.ONELEVEL); // locate group and define candidate query XmlGroup group = findGroup(model, "Group3"); settings[1] = XmlCandidateQueryAssignment.Factory.newInstance(); settings[1].setPosition(group.getGuid()); settings[1].setContainerId(ldapContainer.getId()); settings[1].setBaseDn("ou=Swindon"); settings[1].setQuery("(objectclass=person)"); settings[1].setSearchScope(XmlLdapSearchScope.ONELEVEL); // Step 2: apply settings getOrgModelService().setCandidateQueries(null, settings); {
Copyright © Cloud Software Group, Inc. All rights reserved.