public static <T> PropertyDelta<T> diff(PrismProperty<T> a, PrismProperty<T> b) { if (a == null) { if (b == null) { return null; } PropertyDelta<T> delta = b.createDelta(); delta.addValuesToAdd(PrismValueCollectionsUtil.cloneCollection(b.getValues())); return delta; } else { return a.diff(b); } }
@NotNull private ItemDeltaItem<PrismPropertyValue<Boolean>, PrismPropertyDefinition<Boolean>> createBooleanIdi( QName propertyName, Boolean old, Boolean current) throws SchemaException { MutablePrismPropertyDefinition<Boolean> definition = prismContext.definitionFactory().createPropertyDefinition(propertyName, DOMUtil.XSD_BOOLEAN); definition.setMinOccurs(1); definition.setMaxOccurs(1); PrismProperty<Boolean> property = definition.instantiate(); property.add(prismContext.itemFactory().createPropertyValue(current)); if (current == old) { return new ItemDeltaItem<>(property); } else { PrismProperty<Boolean> propertyOld = property.clone(); propertyOld.setRealValue(old); PropertyDelta<Boolean> delta = propertyOld.createDelta(); delta.setValuesToReplace(prismContext.itemFactory().createPropertyValue(current)); return new ItemDeltaItem<>(propertyOld, delta, property); } }
if (attrDef == null) { PropertyDelta<?> oldRepoAttrPropDelta = attrProperty.createDelta(); oldRepoAttrPropDelta.addValuesToDelete((Collection) PrismValueCollectionsUtil.cloneCollection(attrProperty.getValues())); shadowDelta.addModification(oldRepoAttrPropDelta); PropertyDelta<Object> attrDelta = attrProperty.createDelta(attrProperty.getPath()); if (valuesToAdd != null) { attrDelta.addRealValuesToAdd(valuesToAdd);
PrismProperty<Boolean> existsPropOld = existsProp.clone(); existsPropOld.setRealValue(existsOld); PropertyDelta<Boolean> existsDelta = existsPropOld.createDelta(); existsDelta.setValuesToReplace(prismContext.itemFactory().createPropertyValue(existsNew)); return new ItemDeltaItem<>(existsPropOld, existsDelta, existsProp);
PrismProperty<Object> oldRepoAttributeProperty = oldRepoAttributesContainer.findProperty(currentResourceAttrProperty.getElementName()); if (oldRepoAttributeProperty == null) { PropertyDelta<Object> attrAddDelta = currentResourceAttrProperty.createDelta(); for (PrismPropertyValue<?> pval: currentResourceAttrProperty.getValues()) { attrAddDelta.addRealValuesToAdd(matchingRule.normalize(pval.getValue())); currentAttribute == null) { PropertyDelta<?> oldRepoAttrPropDelta = oldRepoAttrProperty.createDelta(); oldRepoAttrPropDelta.addValuesToDelete((Collection) PrismValueCollectionsUtil.cloneCollection(oldRepoAttrProperty.getValues())); if (oldRepoAttrPropDelta.getDefinition().getTypeName() == null) {