/** * To prevent having the transaction rolled back, this method returns null * rather than throw an exception. */ private ExperimenterGroup _getDefaultGroup(ServiceFactory sf, String name) { LocalAdmin admin = (LocalAdmin) sf.getAdminService(); try { Experimenter exp = admin.userProxy(name); ExperimenterGroup grp = admin.getDefaultGroup(exp.getId()); return grp; } catch (Exception e) { log.warn("Exception while running " + "executeDefaultGroup", e); return null; } }
/** * Returns a List of state for creating a new {@link SessionContext}. If an * exception is thrown, return nulls since throwing an exception within the * Work will set our transaction to rollback only. */ private List<Object> executeSessionContextLookup(ServiceFactory sf, Principal principal, Session session) { final LocalAdmin admin = (LocalAdmin) sf.getAdminService(); final Experimenter exp = admin.userProxy(principal.getName()); final ExperimenterGroup grp = admin.groupProxy(principal.getGroup()); return executeSessionContextLookup(sf, principal, exp, grp, session); }
cuId, uid)); setOwner(admin.userProxy(uid)); if (toPrint == null) { toPrint = new ArrayList<String>();
@Transactional(readOnly = true) public Object doWork(org.hibernate.Session session, ServiceFactory sf) { /* user and group names may change while the session is open */ final LocalAdmin admin = (LocalAdmin) sf.getAdminService(); final Experimenter exp = admin.userProxy(ctx.getCurrentUserId()); final ExperimenterGroup grp = admin.groupProxy(ctx.getCurrentGroupId()); final Principal p = new Principal(exp.getOmeName(), grp.getName(), ctx.getCurrentEventType()); return executeSessionContextLookup(sf, p, exp, grp, ctx.getSession()); } });