Adding Values to Organization Model Attributes — Service Connector API Example (Java)
Example code is provided that 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, Adding Values to Organization Model Attributes.
public void setResourceAttributeValue(int aModelVersion) throws DirectoryEngineFault, SecurityFault { // Step 1: perform some search on resources FindResources findResources = FindResources.Factory.newInstance(); findResources.setModelVersion(aModelVersion); findResources.addResourceName("Clint Hill"); FindResourcesResponse resources = getOrgResourceService().findResources(findResources); // select a resource from list XmlModelEntity resource = resources.getResourceArray(0); // Step 2: get details of the selected resource String[] guids = { resource.getGuid() }; XmlResourceDetail[] detail = getOrgResourceService().getResource(aModelVersion, guids); // select attribute XmlResourceAttributeValue attribute = detail[0].getAttributeArray(0); // Step 3: set the value of selected attribute XmlUpdateResourceType[] update = { XmlUpdateResourceType.Factory.newInstance() }; update[0].setGuid(resource.getGuid()); XmlEntityReferenceAttributes setAttribute = update[0].addNewSetAttribute(); setAttribute.setGuid(attribute.getGuid()); setAttribute.setValueArray(new String[] { "new value" } ); getOrgResourceService().updateResource(update); } }
Copyright © Cloud Software Group, Inc. All rights reserved.