public static ContainerDelta<?> assertContainerDeleteGetContainerDelta(ObjectDelta<?> objectDelta, ItemPath propertyPath) { ContainerDelta<?> delta = objectDelta.findContainerDelta(propertyPath); assertNotNull("Container delta for "+propertyPath+" not found",delta); assert !delta.isEmpty() : "Container delta for "+propertyPath+" is empty"; assert delta.getValuesToDelete() != null : "Container delta for "+propertyPath+" has null values to delete"; assert !delta.getValuesToDelete().isEmpty() : "Container delta for "+propertyPath+" has empty values to delete"; return delta; }
public ContainerDeltaAsserter<C,RA> assertNoValuesToDelete() { Collection<PrismContainerValue<C>> valuesToDelete = containerDelta.getValuesToDelete(); assertNull("Unexpected values to delete in "+desc()+": "+valuesToDelete, valuesToDelete); return this; }
/** * Breaks user assignment delta in the context by inserting some empty value. This may interfere with comparing the values to * existing user values. */ protected <F extends FocusType> void breakAssignmentDelta(ObjectDelta<F> userDelta) throws SchemaException { ContainerDelta<?> assignmentDelta = userDelta.findContainerDelta(UserType.F_ASSIGNMENT); PrismContainerValue<?> assignmentDeltaValue = null; if (assignmentDelta.getValuesToAdd() != null) { assignmentDeltaValue = assignmentDelta.getValuesToAdd().iterator().next(); } if (assignmentDelta.getValuesToDelete() != null) { assignmentDeltaValue = assignmentDelta.getValuesToDelete().iterator().next(); } PrismContainer<ActivationType> activationContainer = assignmentDeltaValue.findOrCreateContainer(AssignmentType.F_ACTIVATION); PrismContainerValue<ActivationType> emptyValue = prismContext.itemFactory().createContainerValue(); activationContainer.add(emptyValue); }
/** * Collects entitlement changes from the shadow to entitlement section into attribute operations. * NOTE: only collects SUBJECT_TO_ENTITLEMENT entitlement direction. */ public void collectEntitlementChange(ProvisioningContext ctx, ContainerDelta<ShadowAssociationType> itemDelta, Collection<Operation> operations) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, ExpressionEvaluationException { Map<QName, PropertyModificationOperation> operationsMap = new HashMap<>(); collectEntitlementToAttrsDelta(ctx, operationsMap, itemDelta.getValuesToAdd(), ModificationType.ADD); collectEntitlementToAttrsDelta(ctx, operationsMap, itemDelta.getValuesToDelete(), ModificationType.DELETE); collectEntitlementToAttrsDelta(ctx, operationsMap, itemDelta.getValuesToReplace(), ModificationType.REPLACE); operations.addAll(operationsMap.values()); }
public PrismContainerValueSetAsserter<C,ContainerDeltaAsserter<C,RA>> valuesToDelete() { Collection<PrismContainerValue<C>> valuesToDelete = containerDelta.getValuesToDelete(); PrismContainerValueSetAsserter<C,ContainerDeltaAsserter<C,RA>> setAsserter = new PrismContainerValueSetAsserter<>( valuesToDelete, this, "values to delte in "+desc()); copySetupTo(setAsserter); return setAsserter; }
private void collectAssignments(ContainerDelta<AssignmentType> assignmentDelta) throws SchemaException { if (assignmentDelta == null) { return; } collectAssignmentsDeltaSet(assignmentDelta.getValuesToReplace()); collectAssignmentsDeltaSet(assignmentDelta.getValuesToAdd()); collectAssignmentsDeltaSet(assignmentDelta.getValuesToDelete()); }
public <T> PrismObject<ShadowType> collectEntitlementsAsObjectOperation(ProvisioningContext ctx, Map<ResourceObjectDiscriminator, ResourceObjectOperations> roMap, ContainerDelta<ShadowAssociationType> containerDelta, PrismObject<ShadowType> subjectShadowBefore, PrismObject<ShadowType> subjectShadowAfter, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException { subjectShadowAfter = collectEntitlementsAsObjectOperation(ctx, roMap, containerDelta.getValuesToAdd(), subjectShadowBefore, subjectShadowAfter, ModificationType.ADD, result); subjectShadowAfter = collectEntitlementsAsObjectOperation(ctx, roMap, containerDelta.getValuesToDelete(), subjectShadowBefore, subjectShadowAfter, ModificationType.DELETE, result); subjectShadowAfter = collectEntitlementsAsObjectOperation(ctx, roMap, containerDelta.getValuesToReplace(), subjectShadowBefore, subjectShadowAfter, ModificationType.REPLACE, result); return subjectShadowAfter; }
if (!delta.isReplace()) { valuesToAdd = delta.getValuesToAdd(); valuesToDelete = delta.getValuesToDelete(); } else { valuesToAdd = new ArrayList<>();
setAssociationName(delta.getValuesToDelete(), associationName); setAssociationName(delta.getValuesToReplace(), associationName);
if (containerDelta.getValuesToDelete() != null) { for (PrismContainerValue<LookupTableRowType> value : (Collection<PrismContainerValue>) containerDelta.getValuesToDelete()) { if (value.getId() != null) { deleteRowById(session, tableOid, value.getId());
Collection<PrismContainerValue<C>> valuesToDelete = cdelta.getValuesToDelete(); if (valuesToDelete != null) { for (PrismContainerValue<C> cval: valuesToDelete) {
PrismAsserts.assertModifications(focusSecondaryDelta, 2); ContainerDelta<AssignmentType> assignmentDelta = focusSecondaryDelta.findContainerDelta(FocusType.F_ASSIGNMENT); assertEquals("Unexpected assignment secondary delta", 1, assignmentDelta.getValuesToDelete().size()); PrismContainerValue<AssignmentType> deletedAssignment = assignmentDelta.getValuesToDelete().iterator().next(); assertEquals("Wrong OID in deleted assignment", ROLE_JUDGE_OID, deletedAssignment.asContainerable().getTargetRef().getOid());