@Override public void shortDump(StringBuilder sb) { sb.append(oid); if (getTargetType() != null) { sb.append("("); sb.append(DebugUtil.formatElementName(getTargetType())); sb.append(")"); } if (targetName != null) { sb.append("('").append(targetName).append("')"); } if (getRelation() != null) { sb.append("["); sb.append(getRelation().getLocalPart()); sb.append("]"); } if (getObject() != null) { sb.append('*'); } }
public Class<Objectable> getTargetTypeCompileTimeClass(PrismContext prismContext) { QName type = getTargetType(); if (type == null) { return null; } else { PrismObjectDefinition<Objectable> objDef = prismContext.getSchemaRegistry().findObjectDefinitionByType(type); return objDef != null ? objDef.getCompileTimeClass() : null; } }
@Override public Object find(ItemPath path) { if (path == null || path.isEmpty()) { return this; } Object first = path.first(); if (!ItemPath.isName(first)) { throw new IllegalArgumentException("Attempt to resolve inside the reference value using a non-name path "+path+" in "+this); } ItemName subName = ItemPath.toName(first); if (compareLocalPart(F_OID, subName)) { return this.getOid(); } else if (compareLocalPart(F_TYPE, subName)) { return this.getTargetType(); } else if (compareLocalPart(F_RELATION, subName)) { return this.getRelation(); } else { throw new IllegalArgumentException("Attempt to resolve inside the reference value using a unrecognized path "+path+" in "+this); } }
private boolean equalsTargetType(PrismReferenceValue other) { QName otherTargetType = other.getTargetType(); if (otherTargetType == null && other.getDefinition() != null) { otherTargetType = other.getDefinition().getTargetTypeName(); } QName thisTargetType = this.getTargetType(); if (thisTargetType == null && this.getDefinition() != null) { thisTargetType = this.getDefinition().getTargetTypeName(); } return QNameUtil.match(thisTargetType, otherTargetType); }
/** * Returns a version of this value that is canonical, that means it has the minimal form. * E.g. it will have only OID and no object. */ public PrismReferenceValueImpl toCanonical() { PrismReferenceValueImpl can = new PrismReferenceValueImpl(); can.setOid(getOid()); // do NOT copy object can.setTargetType(getTargetType()); can.setRelation(getRelation()); can.setFilter(getFilter()); can.setResolutionTime(getResolutionTime()); can.setDescription(getDescription()); return can; }