use of com.evolveum.midpoint.repo.sql.data.RepositoryContext in project midpoint by Evolveum.
the class ObjectUpdater method createDataObjectFromJAXB.
public <T extends ObjectType> RObject createDataObjectFromJAXB(PrismObject<T> prismObject, PrismIdentifierGenerator.Operation operation) throws SchemaException {
PrismIdentifierGenerator generator = new PrismIdentifierGenerator();
IdGeneratorResult generatorResult = generator.generate(prismObject, operation);
T object = prismObject.asObjectable();
RObject rObject;
Class<? extends RObject> clazz = ClassMapper.getHQLTypeClass(object.getClass());
try {
rObject = clazz.newInstance();
Method method = clazz.getMethod("copyFromJAXB", object.getClass(), clazz, RepositoryContext.class, IdGeneratorResult.class);
method.invoke(clazz, object, rObject, new RepositoryContext(repositoryService, prismContext), generatorResult);
} catch (Exception ex) {
String message = ex.getMessage();
if (StringUtils.isEmpty(message) && ex.getCause() != null) {
message = ex.getCause().getMessage();
}
throw new SchemaException(message, ex);
}
return rObject;
}
Aggregations