public Long getCurrentSessionId() { return getSession().getId(); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public SessionContextImpl(Session session, Set<AdminPrivilege> adminPrivileges, List<Long> lGroups, List<Long> mGroups, List<String> roles, SessionStats stats, Roles _roles, SessionContext previous) { this._roles = _roles; this.stats = stats; this.session = session; if (previous != null) { this.count = previous.count(); this.shareId = previous.getCurrentShareId(); } else { this.count = new SessionContext.Count(session.getUuid()); } this.adminPrivileges = ImmutableSet.copyOf(adminPrivileges); this.leaderOfGroups = Collections.unmodifiableList(new ArrayList( lGroups)); this.memberOfGroups = Collections.unmodifiableList(new ArrayList( mGroups)); this.roles = Collections.unmodifiableList(new ArrayList(roles)); // Force NPE getCurrentGroupPermissions(); }
/** * Takes a snapshot as from * {@link #executeSessionContextLookup(ServiceFactory, Principal, Session)} * and turns it into a {@link SessionContext} instance. * List argument should never be null. Abort if * {@link #executeSessionContextLookup(ServiceFactory, Principal, Session)} * returns null. */ @SuppressWarnings("unchecked") protected SessionContext createSessionContext(List<?> list, SessionContext previous) { final Experimenter exp = (Experimenter) list.get(0); final ExperimenterGroup grp = (ExperimenterGroup) list.get(1); final Set<AdminPrivilege> adminPrivileges = (Set<AdminPrivilege>) list.get(2); final List<Long> memberOfGroupsIds = (List<Long>) list.get(3); final List<Long> leaderOfGroupsIds = (List<Long>) list.get(4); final List<String> userRoles = (List<String>) list.get(5); final Principal principal = (Principal) list.get(6); final Session session = (Session) list.get(7); parseAndSetDefaultType(principal.getEventType(), session); session.getDetails().setOwner(exp); session.getDetails().setGroup(grp); SessionContext sessionContext = new SessionContextImpl(session, adminPrivileges, leaderOfGroupsIds, memberOfGroupsIds, userRoles, factory .createStats(), roles, previous); return sessionContext; }
public String getCurrentSessionUuid() { return getSession().getUuid(); }