@Override public boolean equals(Object object) { if (!(object instanceof AssignmentType)) { return false; } AssignmentType other = ((AssignmentType) object); return asPrismContainerValue().equivalent(other.asPrismContainerValue()); }
private void collectVirtualAssignments(Collection<AssignmentType> forcedAssignments, Mode mode) throws SchemaException { if (forcedAssignments == null) { return; } for (AssignmentType assignment : forcedAssignments) { collectAssignment(assignment.asPrismContainerValue(), mode, true); } }
@XmlSchemaType(name = "anyURI") @XmlElement(name = "policySituation") public List<String> getPolicySituation() { return PrismForJAXBUtil.getPropertyValues(asPrismContainerValue(), F_POLICY_SITUATION, String.class); }
@XmlElement(name = "orderConstraint") public List<OrderConstraintsType> getOrderConstraint() { PrismContainerValue pcv = asPrismContainerValue(); PrismContainer container = PrismForJAXBUtil.getContainer(pcv, F_ORDER_CONSTRAINT); return new AssignmentType.AnonOrderConstraint(container, pcv); }
@XmlElement(name = "policyException") public List<PolicyExceptionType> getPolicyException() { PrismContainerValue pcv = asPrismContainerValue(); PrismContainer container = PrismForJAXBUtil.getContainer(pcv, F_POLICY_EXCEPTION); return new AssignmentType.AnonPolicyException(container, pcv); }
@XmlElement(name = "assignmentRelation") public List<AssignmentRelationType> getAssignmentRelation() { PrismContainerValue pcv = asPrismContainerValue(); PrismContainer container = PrismForJAXBUtil.getContainer(pcv, F_ASSIGNMENT_RELATION); return new AssignmentType.AnonAssignmentRelation(container, pcv); }
protected AssignmentType createAssignmentIdOnly(long id) { AssignmentType assignment = new AssignmentType(); assignment.asPrismContainerValue().setId(id); return assignment; }
@XmlElement(name = "targetRef") public ObjectReferenceType getTargetRef() { PrismReferenceValue reference = PrismForJAXBUtil.getReferenceValue(asPrismContainerValue(), F_TARGET_REF); if (reference == null) { return null; } ObjectReferenceType targetRef = new ObjectReferenceType(); targetRef.setupReferenceValue(reference); return targetRef; }
@XmlElement(name = "tenantRef") public ObjectReferenceType getTenantRef() { PrismReferenceValue reference = PrismForJAXBUtil.getReferenceValue(asPrismContainerValue(), F_TENANT_REF); if (reference == null) { return null; } ObjectReferenceType tenantRef = new ObjectReferenceType(); tenantRef.setupReferenceValue(reference); return tenantRef; }
@XmlElement(name = "target") public ObjectType getTarget() { PrismReferenceValue reference = PrismForJAXBUtil.getReferenceValue(asPrismContainerValue(), F_TARGET_REF); if ((reference == null)||(reference.getObject() == null)) { return null; } return ((ObjectType) reference.getObject().asObjectable()); }
private boolean existsEquivalentValue(PrismObject<?> focusOld, PrismContainerValue<AssignmentType> assignmentValue) { FocusType focusType = (FocusType) focusOld.asObjectable(); for (AssignmentType existing : focusType.getAssignment()) { if (existing.asPrismContainerValue().equals(assignmentValue, EquivalenceStrategy.REAL_VALUE)) { return true; } } return false; }
public AssignmentType clone() { AssignmentType object = new AssignmentType(); PrismContainerValue value = asPrismContainerValue().clone(); object.setupContainerValue(value); return object; }
@SuppressWarnings("unchecked") private ObjectDelta<? extends FocusType> assignmentToDelta(Class<? extends Objectable> focusClass, AssignmentType assignmentType, boolean assignmentRemoved, String objectOid) throws SchemaException { PrismContainerValue value = assignmentType.clone().asPrismContainerValue(); S_ValuesEntry item = prismContext.deltaFor(focusClass) .item(FocusType.F_ASSIGNMENT); S_ItemEntry op = assignmentRemoved ? item.delete(value) : item.add(value); return op.asObjectDelta(objectOid); }
protected void modifyRoleDeleteInducementTarget(String roleOid, String targetOid, ModelExecuteOptions options) throws SchemaException, ObjectAlreadyExistsException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException { Task task = createTask(AbstractModelIntegrationTest.class.getName() + ".modifyRoleDeleteInducementTarget"); OperationResult result = task.getResult(); AssignmentType inducement = findInducementByTarget(roleOid, targetOid); ObjectDelta<RoleType> roleDelta = prismContext.deltaFactory().object() .createModificationDeleteContainer(RoleType.class, roleOid, RoleType.F_INDUCEMENT, inducement.asPrismContainerValue().clone()); modelService.executeChanges(MiscSchemaUtil.createCollection(roleDelta), options, task, result); result.computeStatus(); TestUtil.assertSuccess(result); }
@Override public LensContext createModelContext(Task task, OperationResult result) throws Exception { LensContext<UserType> context = createUserLensContext(); fillContextWithUser(context, USER_JACK_OID, result); addFocusDeltaToContext(context, (ObjectDelta) prismContext.deltaFor(UserType.class) .item(UserType.F_ASSIGNMENT).add( ObjectTypeUtil.createAssignmentTo(ROLE_R12_OID, ObjectTypes.ROLE, prismContext).asPrismContainerValue()) .asObjectDelta(USER_JACK_OID)); return context; }
@Override public LensContext createModelContext(Task task, OperationResult result) throws Exception { LensContext<UserType> context = createUserLensContext(); fillContextWithUser(context, USER_JACK_OID, result); addFocusDeltaToContext(context, (ObjectDelta) prismContext.deltaFor(UserType.class) .item(UserType.F_ASSIGNMENT).add( ObjectTypeUtil.createAssignmentTo(ROLE_R11_OID, ObjectTypes.ROLE, prismContext).asPrismContainerValue()) .asObjectDelta(USER_JACK_OID)); return context; }
@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 ); }
protected AssignmentType getAssignmentType(File assignmentFile) throws java.io.IOException, JAXBException, SchemaException { AssignmentType assignmentType = unmarshallValueFromFile(assignmentFile, AssignmentType.class); // We need to make sure that the assignment has a parent PrismContainerDefinition<AssignmentType> assignmentContainerDefinition = userTypeJack.asPrismObject().getDefinition().findContainerDefinition(UserType.F_ASSIGNMENT); PrismContainer<AssignmentType> assignmentContainer = assignmentContainerDefinition.instantiate(); assignmentContainer.add(assignmentType.asPrismContainerValue().clone()); return assignmentType; }
protected void removeAllAssignments(String oid, OperationResult result) throws Exception { PrismObject<UserType> user = repositoryService.getObject(UserType.class, oid, null, result); for (AssignmentType at : user.asObjectable().getAssignment()) { ObjectDelta delta = prismContext.deltaFactory().object() .createModificationDeleteContainer(UserType.class, oid, UserType.F_ASSIGNMENT, at.asPrismContainerValue().clone()); repositoryService.modifyObject(UserType.class, oid, delta.getModifications(), result); LOGGER.info("Removed assignment " + at + " from " + user); } }
protected void removeAllAssignments(String oid, OperationResult result) throws Exception { PrismObject<UserType> user = repositoryService.getObject(UserType.class, oid, null, result); for (AssignmentType at : user.asObjectable().getAssignment()) { ObjectDelta delta = prismContext.deltaFactory().object() .createModificationDeleteContainer(UserType.class, oid, UserType.F_ASSIGNMENT, at.asPrismContainerValue().clone()); repositoryService.modifyObject(UserType.class, oid, delta.getModifications(), result); display("Removed assignment " + at + " from " + user); } }