Search in sources :

Example 1 with RAssignmentExtension

use of com.evolveum.midpoint.repo.sql.data.common.any.RAssignmentExtension in project midpoint by Evolveum.

the class RAssignment method copyFromJAXB.

public static void copyFromJAXB(AssignmentType jaxb, RAssignment repo, ObjectType parent, RepositoryContext repositoryContext, IdGeneratorResult generatorResult) throws DtoTranslationException {
    Validate.notNull(repo, "Repo object must not be null.");
    Validate.notNull(jaxb, "JAXB object must not be null.");
    repo.setTransient(generatorResult.isTransient(jaxb.asPrismContainerValue()));
    repo.setOwnerOid(parent.getOid());
    repo.setId(RUtil.toInteger(jaxb.getId()));
    repo.setOrder(jaxb.getOrder());
    repo.setLifecycleState(jaxb.getLifecycleState());
    repo.setPolicySituation(RUtil.listToSet(jaxb.getPolicySituation()));
    if (jaxb.getExtension() != null) {
        RAssignmentExtension extension = new RAssignmentExtension();
        extension.setOwner(repo);
        repo.setExtension(extension);
        RAssignmentExtension.copyFromJAXB(jaxb.getExtension(), extension, RAssignmentExtensionType.EXTENSION, repositoryContext);
    }
    if (jaxb.getActivation() != null) {
        RActivation activation = new RActivation();
        RActivation.copyFromJAXB(jaxb.getActivation(), activation, repositoryContext);
        repo.setActivation(activation);
    }
    if (jaxb.getTarget() != null) {
        LOGGER.warn("Target from assignment type won't be saved. It should be translated to target reference.");
    }
    repo.setTargetRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getTargetRef(), repositoryContext.prismContext));
    repo.setTenantRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getTenantRef(), repositoryContext.prismContext));
    repo.setOrgRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getOrgRef(), repositoryContext.prismContext));
    if (jaxb.getConstruction() != null) {
        repo.setResourceRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getConstruction().getResourceRef(), repositoryContext.prismContext));
    }
    MetadataFactory.fromJAXB(jaxb.getMetadata(), repo, repositoryContext.prismContext);
}
Also used : RAssignmentExtension(com.evolveum.midpoint.repo.sql.data.common.any.RAssignmentExtension) RActivation(com.evolveum.midpoint.repo.sql.data.common.embedded.RActivation)

Aggregations

RAssignmentExtension (com.evolveum.midpoint.repo.sql.data.common.any.RAssignmentExtension)1 RActivation (com.evolveum.midpoint.repo.sql.data.common.embedded.RActivation)1