Removing Candidate Queries — Service Connector API Example (Java)

Example code is provided that illustrates removing a candidate queries using method calls available in the Service Connector API.

public void deleteCandidateQueries(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);
        // locate position and group whose candidate queries are to be removed
        XmlPosition position = findPosition(model, "BoardOfDirectors", "Director");
        XmlGroup group = findGroup(model, "Group3");
        SetCandidateQueries.Remove removals = SetCandidateQueries.Remove.Factory.newInstance();
        removals.addGroup(group.getGuid());
        removals.addPosition(position.getGuid());
        // Step 2: remove settings
        getOrgModelService().setCandidateQueries(removals, null);
    }