/** * Default constructor for JSON deserialization. */ @SuppressWarnings("unused") public TransferSimpSession() { this.id = ""; this.user = new TransferSimpUser(); this.subscriptions = new HashSet<>(4); }
@Override @Nullable public SimpSession getSession(String sessionId) { if (this.sessionLookup != null) { return this.sessionLookup.findSessions(getName()).get(sessionId); } for (TransferSimpSession session : this.sessions) { if (session.getId().equals(sessionId)) { return session; } } return null; }
@Override public Set<SimpSession> getSessions() { if (this.sessionLookup != null) { Map<String, SimpSession> sessions = this.sessionLookup.findSessions(getName()); return new HashSet<>(sessions.values()); } return new HashSet<>(this.sessions); }
/** * Constructor to create DTO from the local user session. */ public TransferSimpSession(SimpSession session) { this.id = session.getId(); this.user = new TransferSimpUser(); Set<SimpSubscription> subscriptions = session.getSubscriptions(); this.subscriptions = new HashSet<>(subscriptions.size()); for (SimpSubscription subscription : subscriptions) { this.subscriptions.add(new TransferSimpSubscription(subscription)); } }
/** * Constructor to create DTO from a local user registry. */ public UserRegistrySnapshot(String id, SimpUserRegistry registry) { this.id = id; Set<SimpUser> users = registry.getUsers(); this.users = new HashMap<>(users.size()); for (SimpUser user : users) { this.users.put(user.getName(), new TransferSimpUser(user)); } }
@Override @Nullable public SimpSession getSession(String sessionId) { if (this.sessionLookup != null) { return this.sessionLookup.findSessions(getName()).get(sessionId); } for (TransferSimpSession session : this.sessions) { if (session.getId().equals(sessionId)) { return session; } } return null; }
@Override public boolean hasSessions() { if (this.sessionLookup != null) { return !this.sessionLookup.findSessions(getName()).isEmpty(); } return !this.sessions.isEmpty(); }
@Override @Nullable public SimpSession getSession(String sessionId) { if (this.sessionLookup != null) { return this.sessionLookup.findSessions(getName()).get(sessionId); } for (TransferSimpSession session : this.sessions) { if (session.getId().equals(sessionId)) { return session; } } return null; }
/** * Default constructor for JSON deserialization. */ @SuppressWarnings("unused") public TransferSimpSession() { this.id = ""; this.user = new TransferSimpUser(); this.subscriptions = new HashSet<>(4); }
private void afterDeserialization(SessionLookup sessionLookup) { this.sessionLookup = sessionLookup; for (TransferSimpSession session : this.sessions) { session.setUser(this); session.afterDeserialization(); } }
@Override public boolean hasSessions() { if (this.sessionLookup != null) { return !this.sessionLookup.findSessions(getName()).isEmpty(); } return !this.sessions.isEmpty(); }
/** * Default constructor for JSON deserialization. */ @SuppressWarnings("unused") public TransferSimpSession() { this.id = ""; this.user = new TransferSimpUser(); this.subscriptions = new HashSet<>(4); }
@Override public Set<SimpSession> getSessions() { if (this.sessionLookup != null) { Map<String, SimpSession> sessions = this.sessionLookup.findSessions(getName()); return new HashSet<>(sessions.values()); } return new HashSet<>(this.sessions); }
/** * Constructor to create DTO from the local user session. */ public TransferSimpSession(SimpSession session) { this.id = session.getId(); this.user = new TransferSimpUser(); Set<SimpSubscription> subscriptions = session.getSubscriptions(); this.subscriptions = new HashSet<>(subscriptions.size()); for (SimpSubscription subscription : subscriptions) { this.subscriptions.add(new TransferSimpSubscription(subscription)); } }
/** * Constructor to create DTO from a local user registry. */ public UserRegistrySnapshot(String id, SimpUserRegistry registry) { this.id = id; Set<SimpUser> users = registry.getUsers(); this.users = new HashMap<>(users.size()); for (SimpUser user : users) { this.users.put(user.getName(), new TransferSimpUser(user)); } }
private void afterDeserialization(SessionLookup sessionLookup) { this.sessionLookup = sessionLookup; for (TransferSimpSession session : this.sessions) { session.setUser(this); session.afterDeserialization(); } }
@Override @Nullable public SimpSession getSession(String sessionId) { if (this.sessionLookup != null) { return this.sessionLookup.findSessions(getName()).get(sessionId); } for (TransferSimpSession session : this.sessions) { if (session.getId().equals(sessionId)) { return session; } } return null; }
/** * Constructor to create DTO from the local user session. */ public TransferSimpSession(SimpSession session) { this.id = session.getId(); this.user = new TransferSimpUser(); Set<SimpSubscription> subscriptions = session.getSubscriptions(); this.subscriptions = new HashSet<>(subscriptions.size()); for (SimpSubscription subscription : subscriptions) { this.subscriptions.add(new TransferSimpSubscription(subscription)); } }
/** * Default constructor for JSON deserialization. */ @SuppressWarnings("unused") public TransferSimpSession() { this.id = ""; this.user = new TransferSimpUser(); this.subscriptions = new HashSet<>(4); }
/** * Constructor to create DTO from a local user registry. */ public UserRegistrySnapshot(String id, SimpUserRegistry registry) { this.id = id; Set<SimpUser> users = registry.getUsers(); this.users = new HashMap<>(users.size()); for (SimpUser user : users) { this.users.put(user.getName(), new TransferSimpUser(user)); } }