Search in sources :

Example 1 with ROperationalState

use of com.evolveum.midpoint.repo.sql.data.common.embedded.ROperationalState in project midpoint by Evolveum.

the class RResource method copyFromJAXB.

public static void copyFromJAXB(ResourceType jaxb, RResource repo, RepositoryContext repositoryContext, IdGeneratorResult generatorResult) throws DtoTranslationException {
    RObject.copyFromJAXB(jaxb, repo, repositoryContext, generatorResult);
    repo.setName(RPolyString.copyFromJAXB(jaxb.getName()));
    repo.setConnectorRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getConnectorRef(), repositoryContext.prismContext));
    if (jaxb.getConnector() != null) {
        LOGGER.warn("Connector from resource type won't be saved. It should be translated to connector reference.");
    }
    try {
        if (jaxb.getBusiness() != null) {
            ResourceBusinessConfigurationType business = jaxb.getBusiness();
            repo.getApproverRef().addAll(RUtil.safeListReferenceToSet(business.getApproverRef(), repositoryContext.prismContext, repo, RReferenceOwner.RESOURCE_BUSINESS_CONFIGURATON_APPROVER));
            repo.setAdministrativeState(RUtil.getRepoEnumValue(business.getAdministrativeState(), RResourceAdministrativeState.class));
        }
        if (jaxb.getOperationalState() != null) {
            ROperationalState repoOpState = new ROperationalState();
            ROperationalState.copyFromJAXB(jaxb.getOperationalState(), repoOpState);
            repo.setOperationalState(repoOpState);
        }
    } catch (Exception ex) {
        throw new DtoTranslationException(ex.getMessage(), ex);
    }
}
Also used : ROperationalState(com.evolveum.midpoint.repo.sql.data.common.embedded.ROperationalState) DtoTranslationException(com.evolveum.midpoint.repo.sql.util.DtoTranslationException) ResourceBusinessConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceBusinessConfigurationType) DtoTranslationException(com.evolveum.midpoint.repo.sql.util.DtoTranslationException) RResourceAdministrativeState(com.evolveum.midpoint.repo.sql.data.common.enums.RResourceAdministrativeState)

Aggregations

ROperationalState (com.evolveum.midpoint.repo.sql.data.common.embedded.ROperationalState)1 RResourceAdministrativeState (com.evolveum.midpoint.repo.sql.data.common.enums.RResourceAdministrativeState)1 DtoTranslationException (com.evolveum.midpoint.repo.sql.util.DtoTranslationException)1 ResourceBusinessConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceBusinessConfigurationType)1