use of com.evolveum.midpoint.repo.sql.data.common.container.RAssignment in project midpoint by Evolveum.
the class RFocus method getAssignments.
@Transient
protected Set<RAssignment> getAssignments(RAssignmentOwner owner) {
Set<RAssignment> assignments = getAssignments();
Set<RAssignment> wanted = new HashSet<>();
if (assignments == null) {
return wanted;
}
Iterator<RAssignment> iterator = assignments.iterator();
while (iterator.hasNext()) {
RAssignment ass = iterator.next();
if (owner.equals(ass.getAssignmentOwner())) {
wanted.add(ass);
}
}
return wanted;
}
use of com.evolveum.midpoint.repo.sql.data.common.container.RAssignment in project midpoint by Evolveum.
the class RFocus method copyFromJAXB.
public static <T extends FocusType> void copyFromJAXB(FocusType jaxb, RFocus<T> repo, RepositoryContext repositoryContext, IdGeneratorResult generatorResult) throws DtoTranslationException {
RObject.copyFromJAXB(jaxb, repo, repositoryContext, generatorResult);
repo.getLinkRef().addAll(RUtil.safeListReferenceToSet(jaxb.getLinkRef(), repositoryContext.prismContext, repo, RReferenceOwner.USER_ACCOUNT));
repo.getRoleMembershipRef().addAll(RUtil.safeListReferenceToSet(jaxb.getRoleMembershipRef(), repositoryContext.prismContext, repo, RReferenceOwner.ROLE_MEMBER));
repo.getDelegatedRef().addAll(RUtil.safeListReferenceToSet(jaxb.getDelegatedRef(), repositoryContext.prismContext, repo, RReferenceOwner.DELEGATED));
repo.getPersonaRef().addAll(RUtil.safeListReferenceToSet(jaxb.getPersonaRef(), repositoryContext.prismContext, repo, RReferenceOwner.PERSONA));
repo.setPolicySituation(RUtil.listToSet(jaxb.getPolicySituation()));
for (AssignmentType assignment : jaxb.getAssignment()) {
RAssignment rAssignment = new RAssignment(repo, RAssignmentOwner.FOCUS);
RAssignment.copyFromJAXB(assignment, rAssignment, jaxb, repositoryContext, generatorResult);
repo.getAssignments().add(rAssignment);
}
if (jaxb.getActivation() != null) {
RActivation activation = new RActivation();
RActivation.copyFromJAXB(jaxb.getActivation(), activation, repositoryContext);
repo.setActivation(activation);
}
if (jaxb.getJpegPhoto() != null) {
RFocusPhoto photo = new RFocusPhoto();
photo.setOwner(repo);
photo.setPhoto(jaxb.getJpegPhoto());
repo.getJpegPhoto().add(photo);
repo.setHasPhoto(true);
}
}
use of com.evolveum.midpoint.repo.sql.data.common.container.RAssignment in project midpoint by Evolveum.
the class RAbstractRole method copyFromJAXB.
public static <T extends AbstractRoleType> void copyFromJAXB(AbstractRoleType jaxb, RAbstractRole<T> repo, RepositoryContext repositoryContext, IdGeneratorResult generatorResult) throws DtoTranslationException {
RFocus.copyFromJAXB(jaxb, repo, repositoryContext, generatorResult);
repo.setRequestable(jaxb.isRequestable());
repo.setDisplayName(RPolyString.copyFromJAXB(jaxb.getDisplayName()));
repo.setIdentifier(jaxb.getIdentifier());
repo.setRiskLevel(jaxb.getRiskLevel());
for (AssignmentType inducement : jaxb.getInducement()) {
RAssignment rInducement = new RAssignment(repo, RAssignmentOwner.ABSTRACT_ROLE);
RAssignment.copyFromJAXB(inducement, rInducement, jaxb, repositoryContext, generatorResult);
repo.getAssignments().add(rInducement);
}
for (ExclusionPolicyConstraintType exclusion : jaxb.getExclusion()) {
RExclusion rExclusion = new RExclusion(repo);
RExclusion.copyFromJAXB(exclusion, rExclusion, jaxb, repositoryContext, generatorResult);
repo.getExclusion().add(rExclusion);
}
for (ObjectReferenceType approverRef : jaxb.getApproverRef()) {
RObjectReference ref = RUtil.jaxbRefToRepo(approverRef, repositoryContext.prismContext, repo, RReferenceOwner.ROLE_APPROVER);
if (ref != null) {
repo.getApproverRef().add(ref);
}
}
//PrismObjectDefinition<AbstractRoleType> roleDefinition = jaxb.asPrismObject().getDefinition();
repo.setApprovalProcess(jaxb.getApprovalProcess());
repo.setOwnerRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getOwnerRef(), repositoryContext.prismContext));
}
Aggregations