private PropertyModificationOperation createAddAttributeChange( String propertyName, String propertyValue) { PrismProperty property = createProperty(propertyName, propertyValue); ItemPath propertyPath = new ItemPath( ShadowType.F_ATTRIBUTES, new QName(ResourceTypeUtil.getResourceNamespace(resourceType), propertyName)); PropertyDelta delta = new PropertyDelta(propertyPath, property.getDefinition(), prismContext); delta.addValueToAdd(new PrismPropertyValue(propertyValue)); PropertyModificationOperation attributeModification = new PropertyModificationOperation(delta); return attributeModification; }
public static <O extends Objectable> PropertyDelta createAddDelta( PrismContainerDefinition<O> containerDefinition, QName propertyName, Object... realValues) { PrismPropertyDefinition propertyDefinition = containerDefinition.findPropertyDefinition(propertyName); if (propertyDefinition == null) { throw new IllegalArgumentException( "No definition for " + propertyName + " in " + containerDefinition); } PropertyDelta delta = new PropertyDelta( propertyName, propertyDefinition, containerDefinition.getPrismContext()); // hoping the prismContext is there for (Object realVal : realValues) { delta.addValueToAdd(new PrismPropertyValue(realVal)); } return delta; }