Updating Push Destinations for Organizational Entities — Service Connector API Example (Java)

The following example code illustrates adding values to organization model attributes using method calls available in the Service Connector API.

The step numbers in the comments correspond to the steps in the illustration, Updating Push Destinations for Organizational Entities.

public void updateModelEntityPushDestinations(int aModelVersion) throws DirectoryEngineFault, SecurityFault
    {
        // Step 1: get details of all model entities in given major version
        GetOrgModelResponse model = getOrgModelService().getOrgModel(aModelVersion, false);
        // select a position, group, etc. from model
        XmlPosition position = model.getOrganizationArray(0).getOrgUnitArray(0).getPositionArray(0);
        // select push destination for removal
        XmlPushDestinationId[] removals = { position.getPushDestinationArray(0) };
        // create a new push destination
        XmlPushDestination[] additions = { XmlPushDestination.Factory.newInstance() };
        additions[0].setChannelType(ChannelType.EMAIL_CHANNEL);
        additions[0].setChannelId("work-email");
        additions[0].setName("Sales Office");
        additions[0].addValue("sales@work.com");
        additions[0].setEnabled(true);
        // Step 2: update push destinations
        getOrgModelService().updatePushDestinations(aModelVersion, OrganisationalEntityType.POSITION,
                                                    position.getGuid(), removals, additions);
    }