/** * Constructor to create user from a local user. */ public TransferSimpUser(SimpUser user) { this.name = user.getName(); Set<SimpSession> sessions = user.getSessions(); this.sessions = new HashSet<>(sessions.size()); for (SimpSession session : sessions) { this.sessions.add(new TransferSimpSession(session)); } }
@Override public int hashCode() { return getId().hashCode(); }
@Override public boolean equals(Object other) { return (this == other || (other instanceof SimpSession && getId().equals(((SimpSession) other).getId()))); }
@Override public int hashCode() { return getId().hashCode(); }
@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 user from a local user. */ public TransferSimpUser(SimpUser user) { this.name = user.getName(); Set<SimpSession> sessions = user.getSessions(); this.sessions = new HashSet<>(sessions.size()); for (SimpSession session : sessions) { this.sessions.add(new TransferSimpSession(session)); } }
@Override public boolean equals(Object other) { return (this == other || (other instanceof SimpSession && getId().equals(((SimpSession) other).getId()))); }
/** * Constructor to create DTO from a local user subscription. */ public TransferSimpSubscription(SimpSubscription subscription) { this.id = subscription.getId(); this.session = new TransferSimpSession(); this.destination = subscription.getDestination(); }
private void afterDeserialization(SessionLookup sessionLookup) { this.sessionLookup = sessionLookup; for (TransferSimpSession session : this.sessions) { session.setUser(this); session.afterDeserialization(); } }
@Override public int hashCode() { return getId().hashCode(); }
@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 TransferSimpSubscription() { this.id = ""; this.session = new TransferSimpSession(); this.destination = ""; }
/** * Constructor to create DTO from a local user subscription. */ public TransferSimpSubscription(SimpSubscription subscription) { this.id = subscription.getId(); this.session = new TransferSimpSession(); this.destination = subscription.getDestination(); }
/** * Constructor to create user from a local user. */ public TransferSimpUser(SimpUser user) { this.name = user.getName(); Set<SimpSession> sessions = user.getSessions(); this.sessions = new HashSet<>(sessions.size()); for (SimpSession session : sessions) { this.sessions.add(new TransferSimpSession(session)); } }
/** * Default constructor for JSON deserialization. */ @SuppressWarnings("unused") public TransferSimpSubscription() { this.id = ""; this.session = new TransferSimpSession(); this.destination = ""; }
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; }
@Override public int hashCode() { return getId().hashCode(); }
@Override public boolean equals(Object other) { return (this == other || (other instanceof SimpSession && getId().equals(((SimpSession) other).getId()))); }
/** * Default constructor for JSON deserialization. */ @SuppressWarnings("unused") public TransferSimpSubscription() { this.id = ""; this.session = new TransferSimpSession(); this.destination = ""; }