public static List<PrismReferenceValue> objectReferenceListToPrismReferenceValues(Collection<ObjectReferenceType> refList) throws SchemaException { List<PrismReferenceValue> rv = new ArrayList<>(); for (ObjectReferenceType ref : refList) { rv.add(ref.asReferenceValue()); } return rv; }
public static PrismObject<?> getPrismObjectFromReference(ObjectReferenceType ref) { if (ref == null) { return null; } return ref.asReferenceValue().getObject(); }
protected void assertRefEquals(String message, ObjectReferenceType expected, ObjectReferenceType actual) { if (expected == null && actual == null) { return; } if (expected == null || actual == null) { fail(message + ": expected=" + expected + ", actual=" + actual); } PrismAsserts.assertRefEquivalent(message, expected.asReferenceValue(), actual.asReferenceValue()); }
public void addReferenceValueIgnoreNull(String key, ObjectReferenceType value) { if (value != null) { addReferenceValue(key, value.asReferenceValue()); } }
@XmlElement(defaultValue = "import") @XmlSchemaType(name = "string") public EvaluationTimeType getResolutionTime() { return asReferenceValue().getResolutionTime(); }
public static Objectable getObjectFromReference(ObjectReferenceType ref) { if (ref == null) { return null; } if (ref.asReferenceValue().getObject() == null) { return null; } return ref.asReferenceValue().getObject().asObjectable(); }
@NotNull public static Collection<PrismReferenceValue> getDelegatorReferences(@NotNull UserType user, @NotNull RelationRegistry relationRegistry) { return user.getDelegatedRef().stream() .filter(ref -> relationRegistry.isDelegation(ref.getRelation())) .map(ref -> ref.asReferenceValue().clone()) .collect(Collectors.toList()); }
public SimpleObjectRefImpl(NotificationFunctionsImpl functions, ObjectReferenceType ref) { Validate.notNull(ref); this.oid = ref.getOid(); if (ref.asReferenceValue().getObject() != null) { this.objectType = (ObjectType) ref.asReferenceValue().getObject().asObjectable(); } this.functions = functions; }
public void setTarget(PrismObject<?> targetObject, PrismContext prismContext) { if (targetObject != null) { this.target = ObjectTypeUtil.createObjectRef((ObjectType) targetObject.asObjectable(), prismContext).asReferenceValue(); } else { this.target = null; } }
public static <T extends ObjectType> ObjectReferenceType createObjectRefWithFullObject(PrismObject<T> object, PrismContext prismContext) { if (object == null) { return null; } ObjectReferenceType ref = createObjectRef(object, prismContext); ref.asReferenceValue().setObject(object); return ref; }
public static PolyStringType getName(ObjectReferenceType ref) { if (ref == null) { return null; } else if (ref.asReferenceValue().getObject() != null && ref.asReferenceValue().getObject().getName() != null) { return new PolyStringType(ref.asReferenceValue().getObject().getName()); } else { return ref.getTargetName(); } }
public static List<PrismReferenceValue> createReferences(Collection<String> oids, RelationKindType kind, RelationRegistry relationRegistry) { List<PrismReferenceValue> rv = new ArrayList<>(); for (QName relation : relationRegistry.getAllRelationsFor(kind)) { for (String oid : oids) { rv.add(new ObjectReferenceType().oid(oid).relation(relation).asReferenceValue()); } } return rv; }
public ObjectReferenceType clone() { ObjectReferenceType object = new ObjectReferenceType(); PrismReferenceValue value = asReferenceValue().clone(); object.setupReferenceValue(value); return object; }
public static WfContextType getWorkflowContext(ApprovalSchemaExecutionInformationType info) { if (info == null || info.getTaskRef() == null || info.getTaskRef().asReferenceValue().getObject() == null) { return null; } @SuppressWarnings({ "unchecked", "raw" }) PrismObject<TaskType> task = info.getTaskRef().asReferenceValue().getObject(); return task.asObjectable().getWorkflowContext(); }
private NameImpl createSceneName(String oid, ObjectReferenceType objectRef) { NameImpl nv = new NameImpl(oid); nv.setId(oid); if (objectRef != null && objectRef.asReferenceValue() != null && objectRef.asReferenceValue().getObject() != null){ PrismObject<ObjectType> object = objectRef.asReferenceValue().getObject(); if (object.asObjectable().getName() != null){ nv.setDisplayName(object.asObjectable().getName().getOrig()); } } nv.setNamesAreResourceKeys(false); return nv; }
protected <F extends FocusType> PrismReferenceValue getSingleLinkRef(PrismObject<F> focus) { F focusType = focus.asObjectable(); assertEquals("Unexpected number of linkRefs", 1, focusType.getLinkRef().size()); ObjectReferenceType linkRefType = focusType.getLinkRef().get(0); String accountOid = linkRefType.getOid(); assertFalse("No linkRef oid", StringUtils.isBlank(accountOid)); PrismReferenceValue accountRefValue = linkRefType.asReferenceValue(); assertEquals("OID mismatch in linkRefValue", accountOid, accountRefValue.getOid()); return accountRefValue; }
public String resolveRefName(ObjectReferenceType ref) { if (ref == null) { return null; } PrismReferenceValue refValue = ref.asReferenceValue(); Object name = refValue.getTargetName() != null ? ref.getTargetName().getOrig() : null; if (!(name instanceof String)) { LOGGER.error("Couldn't resolve object name"); } return (String) name; }
protected List<PrismReferenceValue> getPotentialAssignees(PrismObject<UserType> user) { List<PrismReferenceValue> rv = new ArrayList<>(); rv.add(ObjectTypeUtil.createObjectRef(user, prismContext).asReferenceValue()); rv.addAll(DeputyUtils.getDelegatorReferences(user.asObjectable(), relationRegistry)); return rv; }
protected void addUserParent(UserType user, ObjectReferenceType parentOrgRef, OperationResult opResult) throws Exception { List<ItemDelta> modifications = new ArrayList<>(); PrismReferenceValue existingValue = parentOrgRef.asReferenceValue(); ItemDelta readdParent = prismContext.deltaFactory().reference().createModificationAdd(UserType.class, UserType.F_PARENT_ORG_REF, existingValue.clone()); modifications.add(readdParent); repositoryService.modifyObject(UserType.class, user.getOid(), modifications, opResult); }
private SecurityPolicyType postProcessPasswordPolicy(ValuePolicyType passwordPolicyType) { SecurityPolicyType securityPolicyType = new SecurityPolicyType(); CredentialsPolicyType creds = new CredentialsPolicyType(); PasswordCredentialsPolicyType passwd = new PasswordCredentialsPolicyType(); ObjectReferenceType passwordPolicyRef = new ObjectReferenceType(); passwordPolicyRef.asReferenceValue().setObject(passwordPolicyType.asPrismObject()); passwd.setValuePolicyRef(passwordPolicyRef); creds.setPassword(passwd); securityPolicyType.setCredentials(creds); setDeprecatedPasswordPolicyProperties(passwordPolicyType, passwd); return securityPolicyType; }