protected void copyValues(CloneStrategy strategy, PrismReferenceImpl clone) { super.copyValues(strategy, clone); for (PrismReferenceValue value : getValues()) { try { clone.add(value.cloneComplex(strategy)); } catch (SchemaException e) { throw new IllegalStateException("Unexpected SchemaException while copying values: " + e.getMessage(), e); } } }
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); } } }