private ResourceAttributeContainer createResourceObject(String dn, String sn, String cn) throws SchemaException { // Account type is hardcoded now ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findObjectClassDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "AccountObjectClass")); // Determine identifier from the schema ResourceAttributeContainer resourceObject = accountDefinition.instantiate(ShadowType.F_ATTRIBUTES); ResourceAttributeDefinition road = accountDefinition.findAttributeDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "sn")); ResourceAttribute roa = road.instantiate(); roa.setValue(new PrismPropertyValue(sn)); resourceObject.add(roa); road = accountDefinition.findAttributeDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "cn")); roa = road.instantiate(); roa.setValue(new PrismPropertyValue(cn)); resourceObject.add(roa); road = accountDefinition.findAttributeDefinition(ConnectorFactoryIcfImpl.ICFS_NAME); roa = road.instantiate(); roa.setValue(new PrismPropertyValue(dn)); resourceObject.add(roa); return resourceObject; }
private Collection<ResourceAttribute<?>> addSampleResourceObject( String name, String givenName, String familyName) throws CommunicationException, GenericFrameworkException, SchemaException, ObjectAlreadyExistsException, ConfigurationException { OperationResult result = new OperationResult(this.getClass().getName() + ".testAdd"); QName objectClassQname = new QName( ResourceTypeUtil.getResourceNamespace(resourceType), ProvisioningTestUtil.OBJECT_CLASS_INETORGPERSON_NAME); ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findObjectClassDefinition(objectClassQname); assertNotNull("No object class definition " + objectClassQname, accountDefinition); ResourceAttributeContainer resourceObject = accountDefinition.instantiate(ShadowType.F_ATTRIBUTES); ResourceAttributeDefinition<String> attributeDefinition = accountDefinition.findAttributeDefinition( new QName( ResourceTypeUtil.getResourceNamespace(resourceType), ProvisioningTestUtil.RESOURCE_OPENDJ_SECONDARY_IDENTIFIER_LOCAL_NAME)); ResourceAttribute<String> attribute = attributeDefinition.instantiate(); attribute.setValue( new PrismPropertyValue<String>("uid=" + name + ",ou=people,dc=example,dc=com")); resourceObject.add(attribute); attributeDefinition = accountDefinition.findAttributeDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "sn")); attribute = attributeDefinition.instantiate(); attribute.setValue(new PrismPropertyValue(familyName)); resourceObject.add(attribute); attributeDefinition = accountDefinition.findAttributeDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "cn")); attribute = attributeDefinition.instantiate(); attribute.setValue(new PrismPropertyValue(givenName + " " + familyName)); resourceObject.add(attribute); attributeDefinition = accountDefinition.findAttributeDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "givenName")); attribute = attributeDefinition.instantiate(); attribute.setValue(new PrismPropertyValue(givenName)); resourceObject.add(attribute); PrismObject<ShadowType> shadow = wrapInShadow(ShadowType.class, resourceObject); Set<Operation> operation = new HashSet<Operation>(); Collection<ResourceAttribute<?>> resourceAttributes = cc.addObject(shadow, operation, result); return resourceAttributes; }
public void setAttributeValue(String attributeName, String attributeValue) { ResourceAttribute a = getAttribute(attributeName); if (a == null) { attributes.put( attributeName, new ResourceAttribute(gridId, resourceId, attributeName, attributeValue)); } else { a.setValue(attributeValue); a.touchUpdatedDateTime(); } }
private PrismProperty createProperty(String propertyName, String propertyValue) { ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findObjectClassDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "AccountObjectClass")); ResourceAttributeDefinition propertyDef = accountDefinition.findAttributeDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), propertyName)); ResourceAttribute property = propertyDef.instantiate(); property.setValue(new PrismPropertyValue(propertyValue)); return property; }
private PrismProperty createProperty(String propertyName, String propertyValue) { ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findObjectClassDefinition( new QName( ResourceTypeUtil.getResourceNamespace(resourceType), ProvisioningTestUtil.OBJECT_CLASS_INETORGPERSON_NAME)); ResourceAttributeDefinition propertyDef = accountDefinition.findAttributeDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), propertyName)); ResourceAttribute property = propertyDef.instantiate(); property.setValue(new PrismPropertyValue(propertyValue)); return property; }
private ResourceAttributeContainer createResourceObject(String dn, String sn, String cn) throws SchemaException { // Account type is hardcoded now ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findObjectClassDefinition( new QName( ResourceTypeUtil.getResourceNamespace(resourceType), ProvisioningTestUtil.OBJECT_CLASS_INETORGPERSON_NAME)); // Determine identifier from the schema ResourceAttributeContainer resourceObject = accountDefinition.instantiate(ShadowType.F_ATTRIBUTES); ResourceAttributeDefinition road = accountDefinition.findAttributeDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "sn")); ResourceAttribute roa = road.instantiate(); roa.setValue(new PrismPropertyValue(sn)); resourceObject.add(roa); road = accountDefinition.findAttributeDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "cn")); roa = road.instantiate(); roa.setValue(new PrismPropertyValue(cn)); resourceObject.add(roa); road = accountDefinition.findAttributeDefinition( new QName( ResourceTypeUtil.getResourceNamespace(resourceType), ProvisioningTestUtil.RESOURCE_OPENDJ_SECONDARY_IDENTIFIER_LOCAL_NAME)); roa = road.instantiate(); roa.setValue(new PrismPropertyValue(dn)); resourceObject.add(roa); return resourceObject; }