@Override public S_ItemEntry replace(Collection<? extends PrismValue> values) { List<PrismValue> prismValues = new ArrayList<>(); for (PrismValue v : values) { if (v != null) { prismValues.add(v); } } currentDelta.setValuesToReplace(prismValues); return this; }
@Override public S_ItemEntry replace(PrismValue... values) { List<PrismValue> prismValues = new ArrayList<>(); for (PrismValue v : values) { if (v != null) { prismValues.add(v); } } currentDelta.setValuesToReplace(prismValues); return this; }
@Override public S_ItemEntry replaceRealValues(Collection<?> realValues) { List<PrismValue> prismValues = new ArrayList<>(); for (Object v : realValues) { if (v != null) { prismValues.add(toPrismValue(currentDelta, v)); } } currentDelta.setValuesToReplace(prismValues); return this; }
private <V extends PrismValue> ItemDelta<?, ?> setExtensionItemAndPrepareDeltaCommon(ItemDelta delta, Collection<V> values) throws SchemaException { // these values should have no parent, otherwise the following will fail delta.setValuesToReplace(values); Collection<ItemDelta<?, ?>> modifications = new ArrayList<>(1); modifications.add(delta); ItemDeltaCollectionsUtil.applyTo(modifications, taskPrism); // i.e. here we apply changes only locally (in memory) return isPersistent() ? delta : null; }
private void handleObjectExtensionWholeContainer(RObject object, ItemDelta delta, PrismIdentifierGenerator idGenerator) { RObjectExtensionType extType = computeObjectExtensionType(delta); if (!delta.isAdd()) { clearExtension(object, extType); } if (delta.isDelete()) { return; } PrismContainerValue extension = (PrismContainerValue) delta.getAnyValue(); for (Item item : (List<Item>) extension.getItems()) { ItemDelta itemDelta = item.createDelta(); itemDelta.setValuesToReplace(item.getClonedValues()); processAnyExtensionDeltaValues(itemDelta, object, extType, null, null, idGenerator); } }
private void handleAssignmentExtensionWholeContainer(RAssignment assignment, ItemDelta delta, PrismIdentifierGenerator idGenerator) { RAssignmentExtension ext = assignment.getExtension(); if (!delta.isAdd()) { if (ext != null) { clearExtension(ext); } } if (delta.isDelete()) { return; } if (ext == null) { ext = new RAssignmentExtension(); ext.setOwner(assignment); assignment.setExtension(ext); } PrismContainerValue extension = (PrismContainerValue) delta.getAnyValue(); for (Item item : (List<Item>) extension.getItems()) { ItemDelta itemDelta = item.createDelta(); itemDelta.setValuesToReplace(item.getClonedValues()); processAnyExtensionDeltaValues(itemDelta, null, null, ext, RAssignmentExtensionType.EXTENSION, idGenerator); } }
@Override public ItemDelta<?,?> getSubDelta(ItemPath path) { if (path.isEmpty()) { return this; } Long id = null; if (path.startsWithId()) { id = path.firstToIdOrNull(); path = path.rest(); } ItemDefinition itemDefinition = getDefinition().findItemDefinition(path); if (itemDefinition == null) { throw new IllegalStateException("No definition of " + path + " in " + getDefinition()); } ItemDelta<?,?> itemDelta = itemDefinition.createEmptyDelta(getPath().append(path)); itemDelta.addValuesToAdd(findItemValues(id, path, getValuesToAdd())); itemDelta.addValuesToDelete(findItemValues(id, path, getValuesToDelete())); itemDelta.setValuesToReplace(findItemValues(id, path, getValuesToReplace())); if (itemDelta.isEmpty()) { return null; } return itemDelta; }
itemDelta.addValuesToDelete(PrismValueCollectionsUtil.resetParentCollection(PrismValueCollectionsUtil.cloneCollection(item.getValues()))); } else if (propMod.getModificationType() == ModificationTypeType.REPLACE) { itemDelta.setValuesToReplace(PrismValueCollectionsUtil.resetParentCollection(PrismValueCollectionsUtil.cloneCollection(item.getValues())));
Collection<PrismValue> valuesToTake = getValuesToTake(objectLeft, objectRight, SIDE_RIGHT, itemRight, rightStrategy, valueExpression, task, result); itemDelta.setValuesToReplace(valuesToTake);
continue; targetItemDelta.setValuesToReplace(PrismValueCollectionsUtil.cloneCollection(nonNegativeValues)); targetItemDelta.setValuesToReplace(PrismValueCollectionsUtil.cloneCollection(valuesToReplace));
Collection<V> replace = new ArrayList<>(); replace.add(LensUtil.cloneAndApplyMetadata(value, isAssignment, originMapping.getMappingType())); outputFocusItemDelta.setValuesToReplace(replace);