public static RObjectReference jaxbRefToRepo( ObjectReferenceType reference, PrismContext prismContext, RObject owner, RReferenceOwner refOwner) { if (reference == null) { return null; } Validate.notNull(owner, "Owner of reference must not be null."); Validate.notNull(refOwner, "Reference owner of reference must not be null."); Validate.notEmpty(reference.getOid(), "Target oid reference must not be null."); RObjectReference repoRef = RReferenceOwner.createObjectReference(refOwner); repoRef.setOwner(owner); RObjectReference.copyFromJAXB(reference, repoRef, prismContext); return repoRef; }
public static List<ObjectReferenceType> safeSetReferencesToList( Set<? extends RObjectReference> set, PrismContext prismContext) { if (set == null || set.isEmpty()) { return new ArrayList<>(); } List<ObjectReferenceType> list = new ArrayList<>(); for (RObjectReference str : set) { ObjectReferenceType ort = new ObjectReferenceType(); RObjectReference.copyToJAXB(str, ort, prismContext); list.add(ort); } return list; }