use of com.evolveum.midpoint.repo.sql.util.GetObjectResult in project midpoint by Evolveum.
the class SqlAuditServiceImpl method resolve.
private PrismObject resolve(Session session, String oid, String defaultName, RObjectType defaultType) throws SchemaException {
if (oid == null) {
return null;
}
Query query = session.getNamedQuery("get.object");
query.setParameter("oid", oid);
query.setResultTransformer(GetObjectResult.RESULT_STYLE.getResultTransformer());
GetObjectResult object = (GetObjectResult) query.uniqueResult();
PrismObject result;
if (object != null) {
String xml = RUtil.getXmlFromByteArray(object.getFullObject(), getConfiguration().isUseZip());
result = getPrismContext().parserFor(xml).compat().parse();
} else if (defaultType != null) {
result = getPrismContext().createObject(defaultType.getJaxbClass());
result.asObjectable().setName(PolyStringType.fromOrig(defaultName != null ? defaultName : oid));
result.setOid(oid);
} else {
result = null;
}
return result;
}
Aggregations