public <T extends ObjectType> PrismObject<T> getObjectAttempt(Class<T> type, String oid,
Collection<SelectorOptions<GetOperationOptions>> options, OperationResult result)
throws ObjectNotFoundException, SchemaException {
LOGGER_PERFORMANCE.debug("> get object {}, oid={}", type.getSimpleName(), oid);
PrismObject<T> objectType = null;
Session session = null;
try {
session = baseHelper.beginReadOnlyTransaction();
objectType = getObjectInternal(session, type, oid, options, false, result);
session.getTransaction().commit();
} catch (ObjectNotFoundException ex) {
GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options);
baseHelper.rollbackTransaction(session, ex, result, !GetOperationOptions.isAllowNotFound(rootOptions));
throw ex;
} catch (SchemaException ex) {
baseHelper.rollbackTransaction(session, ex, "Schema error while getting object with oid: "
+ oid + ". Reason: " + ex.getMessage(), result, true);
throw ex;
} catch (DtoTranslationException | RuntimeException ex) {
baseHelper.handleGeneralException(ex, session, result);
} finally {
baseHelper.cleanupSessionAndResult(session, result);
}
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Get object:\n{}", objectType != null ? objectType.debugDump(3) : null);
}
return objectType;
}