Search in sources :

Example 1 with RTrigger

use of com.evolveum.midpoint.repo.sql.data.common.container.RTrigger in project midpoint by Evolveum.

the class RObject method copyFromJAXB.

public static <T extends ObjectType> void copyFromJAXB(ObjectType jaxb, RObject<T> repo, RepositoryContext repositoryContext, IdGeneratorResult generatorResult) throws DtoTranslationException {
    Validate.notNull(jaxb, "JAXB object must not be null.");
    Validate.notNull(repo, "Repo object must not be null.");
    repo.setTransient(generatorResult.isGeneratedOid());
    repo.setOid(jaxb.getOid());
    repo.setObjectTypeClass(RObjectType.getType(ClassMapper.getHQLTypeClass(jaxb.getClass())));
    repo.setName(RPolyString.copyFromJAXB(jaxb.getName()));
    repo.setLifecycleState(jaxb.getLifecycleState());
    String strVersion = jaxb.getVersion();
    int version = StringUtils.isNotEmpty(strVersion) && strVersion.matches("[0-9]*") ? Integer.parseInt(jaxb.getVersion()) : 0;
    repo.setVersion(version);
    repo.getParentOrgRef().addAll(RUtil.safeListReferenceToSet(jaxb.getParentOrgRef(), repositoryContext.prismContext, repo, RReferenceOwner.OBJECT_PARENT_ORG));
    for (TriggerType trigger : jaxb.getTrigger()) {
        RTrigger rTrigger = new RTrigger(null);
        RTrigger.copyFromJAXB(trigger, rTrigger, jaxb, repositoryContext, generatorResult);
        repo.getTrigger().add(rTrigger);
    }
    MetadataFactory.fromJAXB(jaxb.getMetadata(), repo, repositoryContext.prismContext);
    repo.setTenantRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getTenantRef(), repositoryContext.prismContext));
    if (jaxb.getExtension() != null) {
        copyFromJAXB(jaxb.getExtension().asPrismContainerValue(), repo, repositoryContext, RObjectExtensionType.EXTENSION);
    }
    repo.getTextInfoItems().addAll(RObjectTextInfo.createItemsSet(jaxb, repo, repositoryContext));
    for (OperationExecutionType opExec : jaxb.getOperationExecution()) {
        ROperationExecution rOpExec = new ROperationExecution(repo);
        ROperationExecution.copyFromJAXB(opExec, rOpExec, jaxb, repositoryContext, generatorResult);
        repo.getOperationExecutions().add(rOpExec);
    }
}
Also used : ROperationExecution(com.evolveum.midpoint.repo.sql.data.common.container.ROperationExecution) TriggerType(com.evolveum.midpoint.xml.ns._public.common.common_3.TriggerType) RTrigger(com.evolveum.midpoint.repo.sql.data.common.container.RTrigger) OperationExecutionType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationExecutionType) ROExtPolyString(com.evolveum.midpoint.repo.sql.data.common.any.ROExtPolyString) ROExtString(com.evolveum.midpoint.repo.sql.data.common.any.ROExtString) RPolyString(com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString)

Aggregations

ROExtPolyString (com.evolveum.midpoint.repo.sql.data.common.any.ROExtPolyString)1 ROExtString (com.evolveum.midpoint.repo.sql.data.common.any.ROExtString)1 ROperationExecution (com.evolveum.midpoint.repo.sql.data.common.container.ROperationExecution)1 RTrigger (com.evolveum.midpoint.repo.sql.data.common.container.RTrigger)1 RPolyString (com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString)1 OperationExecutionType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationExecutionType)1 TriggerType (com.evolveum.midpoint.xml.ns._public.common.common_3.TriggerType)1