use of com.evolveum.midpoint.repo.sql.data.common.embedded.RActivation 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);
}
}
use of com.evolveum.midpoint.repo.sql.data.common.embedded.RActivation in project midpoint by Evolveum.
the class RAccessCertificationCase method toRepo.
private static RAccessCertificationCase toRepo(RAccessCertificationCase rCase, AccessCertificationCaseType case1, RepositoryContext context) throws DtoTranslationException {
// we don't try to advise hibernate - let it do its work, even if it would cost some SELECTs
rCase.setTransient(null);
rCase.setId(RUtil.toInteger(case1.getId()));
rCase.setObjectRef(RUtil.jaxbRefToEmbeddedRepoRef(case1.getObjectRef(), context.prismContext));
rCase.setTargetRef(RUtil.jaxbRefToEmbeddedRepoRef(case1.getTargetRef(), context.prismContext));
rCase.setTenantRef(RUtil.jaxbRefToEmbeddedRepoRef(case1.getTenantRef(), context.prismContext));
rCase.setOrgRef(RUtil.jaxbRefToEmbeddedRepoRef(case1.getOrgRef(), context.prismContext));
if (case1.getActivation() != null) {
RActivation activation = new RActivation();
RActivation.copyFromJAXB(case1.getActivation(), activation, context);
rCase.setActivation(activation);
}
for (AccessCertificationWorkItemType workItem : case1.getWorkItem()) {
rCase.getWorkItems().add(RAccessCertificationWorkItem.toRepo(rCase, workItem, context));
}
rCase.setReviewRequestedTimestamp(case1.getCurrentStageCreateTimestamp());
rCase.setReviewDeadline(case1.getCurrentStageDeadline());
rCase.setRemediedTimestamp(case1.getRemediedTimestamp());
rCase.setCurrentStageOutcome(case1.getCurrentStageOutcome());
rCase.setStageNumber(case1.getStageNumber());
rCase.setOutcome(case1.getOutcome());
PrismContainerValue<AccessCertificationCaseType> cvalue = case1.asPrismContainerValue();
String xml;
try {
xml = context.prismContext.xmlSerializer().serialize(cvalue, SchemaConstantsGenerated.C_VALUE);
} catch (SchemaException e) {
throw new IllegalStateException("Couldn't serialize certification case to string", e);
}
LOGGER.trace("RAccessCertificationCase full object\n{}", xml);
byte[] fullObject = RUtil.getByteArrayFromXml(xml, false);
rCase.setFullObject(fullObject);
return rCase;
}
use of com.evolveum.midpoint.repo.sql.data.common.embedded.RActivation 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);
}
Aggregations