public ObjectReferenceType relation(QName value) { setRelation(value); return this; }
public static void normalizeRelation(ObjectReferenceType reference, RelationRegistry relationRegistry) { if (reference != null) { reference.setRelation(relationRegistry.normalizeRelation(reference.getRelation())); } }
protected ObjectReferenceType createObjectReference(String oid, QName type, QName relation) { ObjectReferenceType ref = new ObjectReferenceType(); ref.setOid(oid); ref.setType(type); ref.setRelation(relation); return ref; }
protected ObjectReferenceType createObjectReference(String oid, QName type, QName relation) { ObjectReferenceType ref = new ObjectReferenceType(); ref.setOid(oid); ref.setType(type); ref.setRelation(relation); return ref; }
public static void copyToJAXB(REmbeddedReference repo, ObjectReferenceType jaxb, PrismContext prismContext) { Validate.notNull(repo, "Repo object must not be null."); Validate.notNull(jaxb, "JAXB object must not be null."); jaxb.setType(ClassMapper.getQNameForHQLType(repo.getType())); jaxb.setRelation(stringToQName(repo.getRelation())); if (StringUtils.isNotEmpty(repo.getTargetOid())) { jaxb.setOid(repo.getTargetOid()); } }
public static void copyToJAXB(RObjectReference repo, ObjectReferenceType jaxb) { Validate.notNull(repo, "Repo object must not be null."); Validate.notNull(jaxb, "JAXB object must not be null."); jaxb.setType(ClassMapper.getQNameForHQLType(repo.getType())); jaxb.setOid(repo.getTargetOid()); jaxb.setRelation(RUtil.stringToQName(repo.getRelation())); }
public static void copyToJAXB(RContainerReference repo, ObjectReferenceType jaxb, PrismContext prismContext) { Validate.notNull(repo, "Repo object must not be null."); Validate.notNull(jaxb, "JAXB object must not be null."); jaxb.setType(ClassMapper.getQNameForHQLType(repo.getType())); jaxb.setOid(repo.getTargetOid()); jaxb.setRelation(RUtil.stringToQName(repo.getRelation())); }
private ObjectReferenceType createRef(QName type, String oid, QName relation) { ObjectReferenceType ref = new ObjectReferenceType(); ref.setType(type); ref.setOid(oid); ref.setRelation(relation); return ref; }
private void assign(AbstractRoleType source, AbstractRoleType target, QName relation) { AssignmentType assignment = ObjectTypeUtil.createAssignmentTo(target.asPrismObject(), prismContext); assignment.getTargetRef().setRelation(relation); source.getAssignment().add(assignment); }
public static <T extends ObjectType> ObjectReferenceType createObjectRef(PrismObject<T> object, QName relation) { if (object == null) { return null; } ObjectReferenceType ref = new ObjectReferenceType(); ref.setOid(object.getOid()); PrismObjectDefinition<T> definition = object.getDefinition(); if (definition != null) { ref.setType(definition.getTypeName()); } ref.setTargetName(object.asObjectable().getName()); ref.setRelation(relation); return ref; }
protected PrismContainerValue<AssignmentType> createPrismValue(String oid, QName targetTypeQName, List<ItemDelta<PrismContainerValue<AssignmentType>, PrismContainerDefinition<AssignmentType>>> additionalAttributeDeltas, ExpressionEvaluationContext params) { AssignmentType assignmentType = new AssignmentType(getPrismContext()); PrismContainerValue<AssignmentType> assignmentCVal = assignmentType.asPrismContainerValue(); ObjectReferenceType targetRef = new ObjectReferenceType(); targetRef.setOid(oid); targetRef.setType(targetTypeQName); targetRef.setRelation(getRelation()); assignmentType.setTargetRef(targetRef); assignmentType.getSubtype().addAll(getSubtypes()); try { if (additionalAttributeDeltas != null) { ItemDeltaCollectionsUtil.applyTo(additionalAttributeDeltas, assignmentCVal); } getPrismContext().adopt(assignmentCVal, FocusType.COMPLEX_TYPE, FocusType.F_ASSIGNMENT); if (InternalsConfig.consistencyChecks) { assignmentCVal.assertDefinitions("assignmentCVal in assignment expression in "+params.getContextDescription()); } } catch (SchemaException e) { // Should not happen throw new SystemException(e); } return assignmentCVal; }
@Test(enabled = false) public void test007JackAttemptAssignRoleJudgeAsOwner() throws Exception { final String TEST_NAME = "test007JackAttemptAssignRoleJudgeAsOwner"; TestUtil.displayTestTitle(this, TEST_NAME); // GIVEN Task task = taskManager.createTaskInstance(TestPolicyRules.class.getName() + "." + TEST_NAME); OperationResult result = task.getResult(); LensContext<UserType> context = createUserLensContext(); fillContextWithUser(context, USER_JACK_OID, result); addModificationToContextAssignRole(context, USER_JACK_OID, ROLE_PIRATE_OID, assignment -> assignment.getTargetRef().setRelation(SchemaConstants.ORG_OWNER) ); display("Input context", context); assertFocusModificationSanity(context); rememberCounter(InternalCounters.SHADOW_FETCH_OPERATION_COUNT); // WHEN TestUtil.displayWhen(TEST_NAME); projector.project(context, "test", task, result); // THEN TestUtil.displayThen(TEST_NAME); result.computeStatus(); TestUtil.assertSuccess(result); dumpPolicyRules(context); //dumpPolicySituations(context); assertEvaluatedTargetPolicyRules(context, 4); assertTargetTriggers(context, PolicyConstraintKindType.ASSIGNMENT_MODIFICATION, 0); }
deputyOfBarbossaAssignment.getTargetRef().setRelation(SchemaConstants.ORG_DEPUTY); AssignmentType policyRuleAssignment = new AssignmentType(prismContext); PolicyRuleType rule = new PolicyRuleType(prismContext);
private void executeAssignRole1ToJack(String TEST_NAME, boolean immediate, boolean deputy, String approverOid, QName relation) throws Exception { PrismObject<UserType> jack = getUser(userJackOid); AssignmentType assignment = createAssignmentTo(getRoleOid(1), ObjectTypes.ROLE, prismContext); assignment.getTargetRef().setRelation(relation); ObjectDelta<UserType> addRole1Delta = prismContext .deltaFor(UserType.class)
targetRef.setOid(ORG_MINISTRY_OF_OFFENSE_OID); targetRef.setType(OrgType.COMPLEX_TYPE); targetRef.setRelation(SchemaConstants.ORG_MANAGER); assignmentType.setTargetRef(targetRef); userJack.asObjectable().getAssignment().add(assignmentType);