private ItemDelta<?, ?> modifyExtensionAndPrepareDelta(ItemDelta<?, ?> delta) throws SchemaException { 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; }
public static void checkConsistence(Collection<? extends ItemDelta> deltas) { checkConsistence(deltas, ConsistencyCheckScope.THOROUGH); }
public static void assertPropertyAdd(Collection<? extends ItemDelta> modifications, ItemPath propertyPath, Object... expectedValues) { PropertyDelta propertyDelta = ItemDeltaCollectionsUtil.findPropertyDelta(modifications, propertyPath); assertNotNull("Property delta for "+propertyPath+" not found",propertyDelta); assertSet("delta "+propertyDelta+" for "+propertyPath, "add", propertyDelta.getValuesToAdd(), expectedValues); }
.hasEquivalent(itemDeltas, modification)) { ItemDeltaCollectionsUtil.merge(sideEffectDeltas, modification);
public static <T> PropertyDelta<T> findPropertyDelta(Collection<? extends ItemDelta> deltas, ItemPath propertyPath) { return findItemDelta(deltas, propertyPath, PropertyDelta.class, false); }
public static void mergeAll(Collection<? extends ItemDelta<?, ?>> modifications, Collection<? extends ItemDelta<?, ?>> deltasToMerge) { if (deltasToMerge == null) { return; } for (ItemDelta deltaToMerge: deltasToMerge) { merge(modifications, deltaToMerge); } }
private ObjectDelta<ShadowType> createModifyDelta(PrismObject<ShadowType> repoShadow, Collection<? extends ItemDelta> modifications) { ObjectDelta<ShadowType> delta = repoShadow.createModifyDelta(); delta.addModifications(ItemDeltaCollectionsUtil.cloneCollection(modifications)); return delta; }
@Override public void accept(Visitor visitor, ItemPath path, boolean recursive) { if (path == null || path.isEmpty()) { if (recursive) { accept(visitor); } else { visitor.visit(this); } } else { ItemDeltaCollectionsUtil.accept(getModifications(), visitor, path, recursive); } }
public static <X extends Containerable> ContainerDelta<X> findContainerDelta(Collection<? extends ItemDelta> deltas, ItemPath propertyPath) { return findItemDelta(deltas, propertyPath, ContainerDelta.class, false); }
public void addPendingModification(ItemDelta<?, ?> delta) { ItemDeltaCollectionsUtil.merge(pendingModifications, delta); }
protected void copyValues(ItemDeltaItem<V,D> clone) { if (this.itemNew != null) { clone.itemNew = this.itemNew.clone(); } if (this.delta != null) { clone.delta = this.delta.clone(); } if (this.itemOld != null) { clone.itemOld = this.itemOld.clone(); } clone.residualPath = this.residualPath; clone.resolvePath = this.resolvePath; if (this.subItemDeltas != null) { clone.subItemDeltas = ItemDeltaCollectionsUtil.cloneCollection(this.subItemDeltas); } }
CommunicationException, ExpressionEvaluationException { try { ItemDeltaCollectionsUtil.accept(modifications, (visitable) -> { try {
private void applyDeltas(TaskType subtask, Collection<ItemDelta<?, ?>> deltas) throws SchemaException { ItemDeltaCollectionsUtil.applyTo(deltas, subtask.asPrismContainerValue()); }
public static void checkConsistence(Collection<? extends ItemDelta> deltas, ConsistencyCheckScope scope) { checkConsistence(deltas, false, false, scope); }
public static void assertPropertyDelete(Collection<? extends ItemDelta> modifications, ItemPath propertyPath, Object... expectedValues) { PropertyDelta propertyDelta = ItemDeltaCollectionsUtil.findPropertyDelta(modifications, propertyPath); assertNotNull("Property delta for "+propertyPath+" not found",propertyDelta); assertSet("delta "+propertyDelta+" for "+propertyPath.last(), "delete", propertyDelta.getValuesToDelete(), expectedValues); }
public static ReferenceDelta findReferenceModification(Collection<? extends ItemDelta> deltas, QName itemName) { return findItemDelta(deltas, itemName, ReferenceDelta.class); }
public void recordModifyResult( ProvisioningContext ctx, PrismObject<ShadowType> oldRepoShadow, Collection<? extends ItemDelta> requestedModifications, ProvisioningOperationState<AsynchronousOperationReturnValue<Collection<PropertyDelta<PrismPropertyValue>>>> opState, XMLGregorianCalendar now, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, ConfigurationException, CommunicationException, ExpressionEvaluationException, EncryptionException { ObjectDelta<ShadowType> requestDelta = opState.getRepoShadow().createModifyDelta(); requestDelta.addModifications(ItemDeltaCollectionsUtil.cloneCollection(requestedModifications)); List<ItemDelta> internalShadowModifications = computeInternalShadowModifications(ctx, opState, requestDelta); List<ItemDelta> modifications; if (opState.isCompleted()) { modifications = MiscUtil.join(requestedModifications, (List)internalShadowModifications); } else { modifications = internalShadowModifications; } addModifyMetadataDeltas(opState.getRepoShadow(), modifications); LOGGER.trace("Updating repository {} after MODIFY operation {}, {} repository shadow modifications", oldRepoShadow, opState, requestedModifications.size()); modifyShadowAttributes(ctx, oldRepoShadow, modifications, parentResult); }
private <V extends PrismValue> ItemDelta<?, ?> addExtensionItemAndPrepareDeltaCommon(ItemDelta delta, Collection<V> values) throws SchemaException { // these values should have no parent, otherwise the following will fail delta.addValuesToAdd(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; }
ItemDeltaCollectionsUtil.checkConsistence(getModifications(), requireDefinition, prohibitRaw, scope); } else if (getChangeType() == ChangeType.DELETE) { if (scope.isThorough()) {
public static void assertPropertyReplace(Collection<? extends ItemDelta> modifications, ItemPath propertyPath, Object... expectedValues) { PropertyDelta propertyDelta = ItemDeltaCollectionsUtil.findPropertyDelta(modifications, propertyPath); assertNotNull("Property delta for "+propertyPath+" not found",propertyDelta); assertSet("delta "+propertyDelta+" for "+propertyPath.last(), "replace", propertyDelta.getValuesToReplace(), expectedValues); }