public EvaluatedAssignmentImpl( @NotNull ItemDeltaItem<PrismContainerValue<AssignmentType>, PrismContainerDefinition<AssignmentType>> assignmentIdi, boolean evaluatedOld, PrismContext prismContext) { this.assignmentIdi = assignmentIdi; this.evaluatedOld = evaluatedOld; this.constructionTriple = prismContext.deltaFactory().createDeltaSetTriple(); this.personaConstructionTriple = prismContext.deltaFactory().createDeltaSetTriple(); this.roles = prismContext.deltaFactory().createDeltaSetTriple(); this.prismContext = prismContext; }
/** * Compares two (unordered) collections and creates a triple describing the differences. */ public static <V extends PrismValue> PrismValueDeltaSetTriple<V> diffPrismValueDeltaSetTriple(Collection<V> valuesOld, Collection<V> valuesNew, PrismContext prismContext) { PrismValueDeltaSetTriple<V> triple = prismContext.deltaFactory().createPrismValueDeltaSetTriple(); diff(valuesOld, valuesNew, triple); return triple; }
@Override public ObjectDelta asObjectDelta(String oid) { return prismContext.deltaFactory().object().createModifyDelta(oid, getAllDeltas(), (Class) objectClass ); }
protected <F extends FocusType> ObjectDelta<F> createAssignmentFocusEmptyDeleteDelta(PrismObject<F> existingFocus, String roleOid, QName relation) throws SchemaException { Collection<ItemDelta<?,?>> modifications = new ArrayList<>(); modifications.add((createAssignmentEmptyDeleteModification(existingFocus, roleOid, relation))); return prismContext.deltaFactory().object() .createModifyDelta(existingFocus.getOid(), modifications, existingFocus.getCompileTimeClass() ); }
protected void modifyRoleDeleteAssignment(String roleOid, AssignmentType assignment, Task task, OperationResult result) throws SchemaException, ObjectAlreadyExistsException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException { ObjectDelta<RoleType> roleDelta = prismContext.deltaFactory().object() .createModificationDeleteContainer(RoleType.class, roleOid, RoleType.F_ASSIGNMENT, assignment); executeChanges(roleDelta, null, task, result); }
protected void modifyRoleDeletePolicyException(String roleOid, PolicyExceptionType policyException, Task task, OperationResult result) throws SchemaException, ObjectAlreadyExistsException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException { ObjectDelta<RoleType> roleDelta = prismContext.deltaFactory().object() .createModificationDeleteContainer(RoleType.class, roleOid, RoleType.F_POLICY_EXCEPTION, policyException); executeChanges(roleDelta, null, task, result); }
private PropertyDelta<?> createActivationPropDelta(QName attrName, ResourceAttributeDefinition attrDef, Object value) { if (isBlank(value)) { return prismContext.deltaFactory().property().createModificationReplaceProperty(ItemPath.create(ShadowType.F_ATTRIBUTES, attrName), attrDef); } else { return prismContext.deltaFactory().property().createModificationReplaceProperty(ItemPath.create(ShadowType.F_ATTRIBUTES, attrName), attrDef, value); } }
protected <O extends ObjectType> void modifyObjectDeleteProperty(Class<O> type, String oid, ItemPath propertyPath, Task task, OperationResult result, Object... newRealValue) throws ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, ObjectAlreadyExistsException, PolicyViolationException, SecurityViolationException { ObjectDelta<O> objectDelta = prismContext.deltaFactory().object() .createModificationDeleteProperty(type, oid, propertyPath, newRealValue); Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(objectDelta); modelService.executeChanges(deltas, null, task, result); }
private ObjectDelta<? extends ObjectType> requestToDelta(ModelContext<?> modelContext, ApprovalRequest<AssignmentModification> approvalRequest, String objectOid) throws SchemaException { List<ItemDelta> modifications = new ArrayList<>(); Class<? extends ObjectType> focusClass = primaryChangeAspectHelper.getFocusClass(modelContext); for (ItemDeltaType itemDeltaType : approvalRequest.getItemToApprove().getModifications()) { modifications.add(DeltaConvertor.createItemDelta(itemDeltaType, focusClass, prismContext)); } return ((LensContext) modelContext).getPrismContext().deltaFactory().object() .createModifyDelta(objectOid, modifications, focusClass ); } //endregion
protected ObjectDelta<ShadowType> createModifyAccountShadowReplaceDelta(String accountOid, PrismObject<ResourceType> resource, ItemPath itemPath, Object... newRealValue) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException { if (itemPath.startsWithName(ShadowType.F_ATTRIBUTES)) { PropertyDelta<?> attributeDelta = createAttributeReplaceDelta(resource, ItemPath.toName(itemPath.last()), newRealValue); ObjectDelta<ShadowType> accountDelta = prismContext.deltaFactory().object() .createModifyDelta(accountOid, attributeDelta, ShadowType.class); return accountDelta; } else { ObjectDelta<ShadowType> accountDelta = prismContext.deltaFactory().object().createModificationReplaceProperty( ShadowType.class, accountOid, itemPath, newRealValue); return accountDelta; } }
private static PropertyDelta<SynchronizationSituationType> createSynchronizationSituationDelta( PrismObject<ShadowType> shadow, SynchronizationSituationType situation, PrismContext prismContext) { if (situation == null) { SynchronizationSituationType oldValue = shadow.asObjectable().getSynchronizationSituation(); return prismContext.deltaFactory().property().createModificationDeleteProperty(ShadowType.F_SYNCHRONIZATION_SITUATION, shadow.getDefinition(), oldValue); } return prismContext.deltaFactory().property().createModificationReplaceProperty(ShadowType.F_SYNCHRONIZATION_SITUATION, shadow.getDefinition(), situation); }
@Override public <T extends ObjectType> void deleteObject(Class<T> type, String oid) throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException { ObjectDelta<T> deleteDelta = prismContext.deltaFactory().object().createDeleteDelta(type, oid); Collection<ObjectDelta<? extends ObjectType>> deltaCollection = MiscSchemaUtil.createCollection(deleteDelta); modelService.executeChanges(deltaCollection, null, getCurrentTask(), getCurrentResult()); }
@Test public void test200ModifyCampaignProperties() throws Exception { OperationResult result = new OperationResult("test200ModifyCampaignProperties"); List<ItemDelta<?, ?>> modifications = new ArrayList<>(); modifications.add(prismContext.deltaFactory().property().createModificationReplaceProperty(F_NAME, campaignDef, new PolyString("Campaign 1+", "campaign 1"))); modifications.add(prismContext.deltaFactory().property().createModificationReplaceProperty(F_STATE, campaignDef, IN_REVIEW_STAGE)); executeAndCheckModification(modifications, result, 1); checksCountsStandard(result); }
@SuppressWarnings("unchecked") private ObjectDelta<? extends FocusType> assignmentToDelta(ModelContext<?> modelContext, AssignmentType assignmentType, String objectOid) { PrismObject<FocusType> focus = (PrismObject<FocusType>) modelContext.getFocusContext().getObjectNew(); PrismContainerDefinition<AssignmentType> prismContainerDefinition = focus.getDefinition().findContainerDefinition(FocusType.F_ASSIGNMENT); ItemDelta<PrismContainerValue<AssignmentType>,PrismContainerDefinition<AssignmentType>> addRoleDelta = prismContext.deltaFactory().container().create( ItemPath.EMPTY_PATH, FocusType.F_ASSIGNMENT, prismContainerDefinition); PrismContainerValue<AssignmentType> assignmentValue = assignmentType.asPrismContainerValue().clone(); addRoleDelta.addValueToAdd(assignmentValue); Class focusClass = primaryChangeAspectHelper.getFocusClass(modelContext); return modelContext.getPrismContext().deltaFactory().object().createModifyDelta(objectOid, addRoleDelta, focusClass ); }
@Test public void test210ModifyCaseProperties() throws Exception { OperationResult result = new OperationResult("test210ModifyCaseProperties"); List<ItemDelta<?, ?>> modifications = new ArrayList<>(); ItemPath case1 = ItemPath.create(F_CASE, 1L); modifications.add(prismContext.deltaFactory().property().createModificationReplaceProperty(case1.append(F_CURRENT_STAGE_OUTCOME), campaignDef, SchemaConstants.MODEL_CERTIFICATION_OUTCOME_REDUCE)); modifications.add(prismContext.deltaFactory().property().createModificationReplaceProperty(case1.append(AccessCertificationCaseType.F_STAGE_NUMBER), campaignDef, 300)); executeAndCheckModification(modifications, result, 0); checksCountsStandard(result); }
public static ObjectDelta<ShadowType> createEntitleDelta(String accountOid, QName associationName, String groupOid, PrismContext prismContext) throws SchemaException { ShadowAssociationType association = new ShadowAssociationType(); association.setName(associationName); ObjectReferenceType shadowRefType = new ObjectReferenceType(); shadowRefType.setOid(groupOid); shadowRefType.setType(ShadowType.COMPLEX_TYPE); association.setShadowRef(shadowRefType); ObjectDelta<ShadowType> delta = prismContext.deltaFactory().object().createModificationAddContainer(ShadowType.class, accountOid, ShadowType.F_ASSOCIATION, association); return delta; }
private PropertyDelta<String> createUselessStringDelta(String newVal) { PropertyDelta<String> uselessStringDelta = prismContext.deltaFactory().property().createModificationReplaceProperty( ItemPath.create(ResourceType.F_CONNECTOR_CONFIGURATION, SchemaConstants.CONNECTOR_SCHEMA_CONFIGURATION_PROPERTIES_ELEMENT_QNAME, DummyResourceContoller.CONNECTOR_DUMMY_USELESS_STRING_QNAME), prismContext.definitionFactory().createPropertyDefinition(DummyResourceContoller.CONNECTOR_DUMMY_USELESS_STRING_QNAME, DOMUtil.XSD_STRING), newVal); return uselessStringDelta; }
private PropertyModificationOperation createDeleteAttributeChange(String propertyName, String propertyValue) { PrismProperty property = createProperty(propertyName, propertyValue); ItemPath propertyPath = ItemPath.create(ShadowType.F_ATTRIBUTES, new QName(ResourceTypeUtil.getResourceNamespace(resourceType), propertyName)); PropertyDelta delta = prismContext.deltaFactory().property().create(propertyPath, property.getDefinition()); delta.addRealValuesToDelete(propertyValue); PropertyModificationOperation attributeModification = new PropertyModificationOperation(delta); return attributeModification; }
public static ItemDelta<?, ?> createExtensionDelta(PrismPropertyDefinition definition, Object realValue, PrismContext prismContext) { PrismProperty<Object> property = (PrismProperty<Object>) definition.instantiate(); property.setRealValue(realValue); return prismContext.deltaFactory().property() .createModificationReplaceProperty(ItemPath.create(TaskType.F_EXTENSION, property.getElementName()), definition, realValue); }
protected ObjectDelta<ShadowType> createAccountInitializationDelta(String accountOid, String newAccountPassword) { ObjectDelta<ShadowType> shadowDelta = prismContext.deltaFactory().object() .createEmptyModifyDelta(ShadowType.class, accountOid); ProtectedStringType passwordPs = new ProtectedStringType(); passwordPs.setClearValue(newAccountPassword); shadowDelta.addModificationReplaceProperty(SchemaConstants.PATH_PASSWORD_VALUE, passwordPs); shadowDelta.addModificationReplaceProperty(ObjectType.F_LIFECYCLE_STATE, SchemaConstants.LIFECYCLE_ACTIVE); return shadowDelta; }