Search in sources :

Example 1 with RAssignment

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;
}
Also used : RAssignment(com.evolveum.midpoint.repo.sql.data.common.container.RAssignment) HashSet(java.util.HashSet)

Example 2 with RAssignment

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);
    }
}
Also used : RAssignment(com.evolveum.midpoint.repo.sql.data.common.container.RAssignment) RActivation(com.evolveum.midpoint.repo.sql.data.common.embedded.RActivation) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)

Example 3 with RAssignment

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));
}
Also used : RAssignment(com.evolveum.midpoint.repo.sql.data.common.container.RAssignment) ExclusionPolicyConstraintType(com.evolveum.midpoint.xml.ns._public.common.common_3.ExclusionPolicyConstraintType) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) RExclusion(com.evolveum.midpoint.repo.sql.data.common.container.RExclusion)

Aggregations

RAssignment (com.evolveum.midpoint.repo.sql.data.common.container.RAssignment)3 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)2 RExclusion (com.evolveum.midpoint.repo.sql.data.common.container.RExclusion)1 RActivation (com.evolveum.midpoint.repo.sql.data.common.embedded.RActivation)1 ExclusionPolicyConstraintType (com.evolveum.midpoint.xml.ns._public.common.common_3.ExclusionPolicyConstraintType)1 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)1 HashSet (java.util.HashSet)1