@Override public QName getRelation() { return referenceValue.getRelation(); }
public static String toStringValue(PrismReferenceValue ref) { String rv = getReferredObjectInformation(ref); if (ref.getRelation() != null) { rv += " [" + ref.getRelation().getLocalPart() + "]"; } return rv; }
@XmlAttribute(name = "relation") public QName getRelation() { return asReferenceValue().getRelation(); }
public static void normalizeRelation(PrismReferenceValue reference, RelationRegistry relationRegistry) { if (reference != null) { reference.setRelation(relationRegistry.normalizeRelation(reference.getRelation())); } }
private void addReferences(Collection<PrismReferenceValue> extractedReferences, Collection<PrismReferenceValue> references) { for (PrismReferenceValue reference: references) { boolean found = false; for (PrismReferenceValue exVal: extractedReferences) { if (MiscUtil.equals(exVal.getOid(), reference.getOid()) && prismContext.relationsEquivalent(exVal.getRelation(), reference.getRelation())) { found = true; break; } } if (!found) { PrismReferenceValue ref = reference.cloneComplex(CloneStrategy.REUSE); // clone without full object instead of calling canonicalize() if (ref.getRelation() == null || QNameUtil.isUnqualified(ref.getRelation())) { ref.setRelation(relationRegistry.normalizeRelation(ref.getRelation())); } extractedReferences.add(ref); } } }
private boolean matches(PrismReferenceValue refVal, PrismObject<OrgType> refTarget) throws ObjectNotFoundException, SchemaException { OrgType refTargetType = refTarget.asObjectable(); if (targetOid != null) { if (!targetOid.equals(refVal.getOid())) { return false; } } if (relation != null) { if (!QNameUtil.match(relation, refVal.getRelation())) { return false; } } // TODO: more criteria return true; }
private boolean matches(PrismReferenceValue refVal) throws ObjectNotFoundException, SchemaException { if (targetOid != null) { if (!targetOid.equals(refVal.getOid())) { return false; } } if (relation != null) { if (!QNameUtil.match(relation, refVal.getRelation())) { return false; } } if (targetType != null) { if (!QNameUtil.match(targetType, refVal.getTargetType())) { return false; } } return true; }
private List<SceneItemValueImpl> toSceneItemValuesRef(Collection<PrismReferenceValue> refValues, VisualizationContext context, Task task, OperationResult result) { List<SceneItemValueImpl> rv = new ArrayList<>(); if (refValues != null) { for (PrismReferenceValue refValue : refValues) { if (refValue != null) { refValue = createRefValueWithObject(refValue, context, task, result); String name; if (refValue.getObject() != null) { name = PolyString.getOrig(refValue.getObject().getName()); } else if (refValue.getTargetName() != null) { name = refValue.getTargetName().getOrig(); } else { name = refValue.getOid(); } String relation; if (refValue.getRelation() != null) { relation = "[" + refValue.getRelation().getLocalPart() + "]"; } else { relation = null; } SceneItemValueImpl itemValue = new SceneItemValueImpl(name, relation); itemValue.setSourceValue(refValue); rv.add(itemValue); } } } return rv; }
if (value.getRelation() == null) { relations.add(context.getPrismContext().getDefaultRelation()); } else { relations.add(value.getRelation()); .add(createRefCondition(hibernateQuery, Collections.singleton(prv.getOid()), prv.getRelation(), prv.getTargetType()))); return rootOr; } else {
private boolean valuesMatch(PrismReferenceValue filterValue, PrismReferenceValue objectValue) { if (!matchOid(filterValue.getOid(), objectValue.getOid())) { return false; } if (!QNameUtil.match(PrismConstants.Q_ANY, filterValue.getRelation())) { // similar to relation-matching code in PrismReferenceValue (but awkward to unify, so keeping separate) PrismContext prismContext = getPrismContext(); QName objectRelation = objectValue.getRelation(); QName filterRelation = filterValue.getRelation(); if (prismContext != null) { if (objectRelation == null) { objectRelation = prismContext.getDefaultRelation(); } if (filterRelation == null) { filterRelation = prismContext.getDefaultRelation(); } } if (!QNameUtil.match(filterRelation, objectRelation)) { return false; } } if (!matchTargetType(filterValue.getTargetType(), objectValue.getTargetType())) { return false; } return true; }
private <F extends ObjectType> void setReferences(LensFocusContext<F> focusContext, QName name, Collection<PrismReferenceValue> targetState) throws SchemaException { ItemName itemName = ItemName.fromQName(name); PrismObject<F> focusOld = focusContext.getObjectOld(); if (focusOld == null) { if (targetState.isEmpty()) { return; } } else { PrismReference existingState = focusOld.findReference(itemName); if (existingState == null || existingState.isEmpty()) { if (targetState.isEmpty()) { return; } } else { // we don't use QNameUtil.match here, because we want to ensure we store qualified values there // (and newValues are all qualified) Comparator<PrismReferenceValue> comparator = (a, b) -> 2*a.getOid().compareTo(b.getOid()) + (Objects.equals(a.getRelation(), b.getRelation()) ? 0 : 1); if (MiscUtil.unorderedCollectionCompare(targetState, existingState.getValues(), comparator)) { return; } } } PrismReferenceDefinition itemDef = focusContext.getObjectDefinition().findItemDefinition(itemName, PrismReferenceDefinition.class); ReferenceDelta itemDelta = prismContext.deltaFactory().reference().create(itemName, itemDef); itemDelta.setValuesToReplace(targetState); focusContext.swallowToSecondaryDelta(itemDelta); }
public static ROExtReference createReference(PrismReferenceValue jaxb) { ROExtReference repo = new ROExtReference(); repo.setValue(jaxb.getOid()); repo.setRelation(RUtil.qnameToString(jaxb.getRelation())); repo.setTargetType(ClassMapper.getHQLTypeForQName(jaxb.getTargetType())); return repo; } }
public static RAExtReference createReference(PrismReferenceValue jaxb) { RAExtReference repo = new RAExtReference(); repo.setValue(jaxb.getOid()); repo.setRelation(RUtil.qnameToString(jaxb.getRelation())); repo.setTargetType(ClassMapper.getHQLTypeForQName(jaxb.getTargetType())); return repo; } }
return false; if (!relationsEquivalent(relation, other.getRelation(), strategy.isLiteralDomComparison())) { return false;
return value.getRelation() != null ? referredObjectIdentification + " [" + value.getRelation().getLocalPart() + "]" : referredObjectIdentification;
.filter(v -> USER_BARBOSSA_OID.equals(v.getOid())).findFirst().orElseThrow( () -> new AssertionError("No barbossa ref in delegation ref vals")); assertEquals("Wrong relation for barbossa delegation", SchemaConstants.ORG_DEPUTY, barbossaRef.getRelation()); PrismReferenceValue r1Ref = evaluatedAssignment.getDelegationRefVals().stream() .filter(v -> ROLE_R1_OID.equals(v.getOid())).findFirst().orElseThrow( () -> new AssertionError("No R1 ref in delegation ref vals")); assertEquals("Wrong relation for R1 delegation", SchemaConstants.ORG_APPROVER, r1Ref.getRelation());
.filter(v -> USER_BARBOSSA_OID.equals(v.getOid())).findFirst().orElseThrow( () -> new AssertionError("No barbossa ref in delegation ref vals")); assertEquals("Wrong relation for barbossa delegation", SchemaConstants.ORG_DEPUTY, barbossaRef.getRelation());
.filter(v -> USER_GUYBRUSH_OID.equals(v.getOid())).findFirst().orElseThrow( () -> new AssertionError("No guybrush ref in delegation ref vals")); assertEquals("Wrong relation for guybrush delegation", SchemaConstants.ORG_DEPUTY, guybrushRef.getRelation());
xmap.put(XNodeImpl.KEY_REFERENCE_OID, createPrimitiveXNodeStringAttr(value.getOid())); QName relation = value.getRelation(); if (relation != null) { xmap.put(XNodeImpl.KEY_REFERENCE_RELATION, createPrimitiveXNodeAttr(relation, DOMUtil.XSD_QNAME));
QName relation = filter.getOrgRef().getRelation(); if (doesRelationRestrictionExist(relation)) { relationParamName = hibernateQuery.addParameter("relation", ReferenceRestriction.getRelationsToTest(relation, context));