use of com.evolveum.midpoint.repo.sql.data.common.container.ROperationExecution 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);
}
}
Aggregations