diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IMessage.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IMessage.java index af618b75a8..4f90187e7d 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IMessage.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IMessage.java @@ -19,7 +19,7 @@ **/ package com.raytheon.uf.viz.collaboration.comm.identity; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; /** @@ -32,6 +32,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 24, 2012 jkorman Initial creation + * Feb 13, 2014 2751 bclement changed to/from objects to IUser * * * @@ -50,24 +51,24 @@ public interface IMessage extends IPropertied { /** * @return the to */ - public IQualifiedID getTo(); + public IUser getTo(); /** * @param to * the to to set */ - public void setTo(IQualifiedID to); + public void setTo(IUser to); /** * @return the from */ - public IQualifiedID getFrom(); + public IUser getFrom(); /** * @param from * the from to set */ - public void setFrom(IQualifiedID from); + public void setFrom(IUser from); /** * Get the subject of this message. diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPeerToPeer.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPeerToPeer.java index e8beca6af6..0aeacb15b2 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPeerToPeer.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/IPeerToPeer.java @@ -20,7 +20,7 @@ package com.raytheon.uf.viz.collaboration.comm.identity; import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; +import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; /** * Peer to peer chat messaging interface @@ -32,6 +32,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 21, 2012 jkorman Initial creation + * Feb 13, 2014 2751 bclement changed 'to' object to UserId * * * @@ -57,7 +58,7 @@ public interface IPeerToPeer extends ISession, IEventPublisher { * @param message * The message to send. */ - public void sendPeerToPeer(IQualifiedID to, String message) + public void sendPeerToPeer(UserId to, String message) throws CollaborationException; } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISession.java index bf94345301..3ca27459fe 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISession.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISession.java @@ -39,8 +39,8 @@ package com.raytheon.uf.viz.collaboration.comm.identity; import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; -import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; /** * Base interface for sessions in which the client is interacting with others on @@ -58,6 +58,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 24, 2012 jkorman Initial creation + * Feb 13, 2014 2751 bclement changed user object to IUser * * * @@ -77,7 +78,7 @@ public interface ISession extends IEventPublisher { * * @return */ - public UserId getUserID(); + public IUser getUserID(); /** * Gets the connection status of the session. diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java index 19cd3a281a..79c76aeb0d 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/ISharedDisplaySession.java @@ -19,7 +19,6 @@ **/ package com.raytheon.uf.viz.collaboration.comm.identity; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole; import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; @@ -54,6 +53,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; * ------------ ---------- ----------- -------------------------- * Mar 21, 2012 jkorman Initial creation * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant + * Feb 13, 2014 2751 bclement changed sendObjectToPeer id to VenueParticipant * * * @@ -85,7 +85,7 @@ public interface ISharedDisplaySession extends IVenueSession { * the serializable object to send * @throws CollaborationException */ - public void sendObjectToPeer(IQualifiedID id, Object obj) + public void sendObjectToPeer(VenueParticipant id, Object obj) throws CollaborationException; /** diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueInvitationEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueInvitationEvent.java index 3d51d63e9f..4e5de69905 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueInvitationEvent.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/event/IVenueInvitationEvent.java @@ -20,7 +20,8 @@ package com.raytheon.uf.viz.collaboration.comm.identity.event; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; +import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId; /** * Encapsulates a venue invitation to the user. @@ -33,6 +34,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; * ------------ ---------- ----------- -------------------------- * Mar 21, 2012 jkorman Initial creation * Dec 18, 2013 2562 bclement removed subject getter (subject in invite) + * Feb 13, 2014 2751 bclement better types for roomid and inviter * * * @@ -47,13 +49,13 @@ public interface IVenueInvitationEvent { * * @return id in {room}@conference.{host} format */ - public IQualifiedID getRoomId(); + public VenueId getRoomId(); /** * * @return id of user that sent invitation */ - public IQualifiedID getInviter(); + public IUser getInviter(); /** * Get detailed invitation which includes subject and message if provided diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IQualifiedID.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IQualifiedID.java index 57d65667b3..46f25c532b 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IQualifiedID.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IQualifiedID.java @@ -20,7 +20,8 @@ package com.raytheon.uf.viz.collaboration.comm.identity.user; /** - * TODO Add Description + * Top level interface for objects that represent identified items on the server + * (users, rooms, etc) * *
  * 
@@ -29,6 +30,7 @@ package com.raytheon.uf.viz.collaboration.comm.identity.user;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Feb 24, 2012            jkorman     Initial creation
+ * Feb 13, 2014 2751       bclement    refactor to remove ID interface
  * 
  * 
* @@ -36,30 +38,24 @@ package com.raytheon.uf.viz.collaboration.comm.identity.user; * @version 1.0 */ -public interface IQualifiedID extends ID { +public interface IQualifiedID { + /** - * - * @param hostName + * @return server name for item */ - void setHost(String hostName); + public String getHost(); + /** - * - * @return + * @return name of item */ - String getHost(); + public String getName(); + /** - * - * @param resource + * @return fully qualified string addressing item */ - void setResource(String resource); - - /** - * - * @return - */ - String getResource(); + public String getFQName(); } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/ID.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IUser.java similarity index 73% rename from cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/ID.java rename to cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IUser.java index 0692cb3491..811b4aa9b4 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/ID.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/identity/user/IUser.java @@ -20,39 +20,29 @@ package com.raytheon.uf.viz.collaboration.comm.identity.user; /** - * TODO Add Description + * Interface for users on server. Can represent user accounts or users in a + * chatroom. * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * Feb 27, 2012            jkorman     Initial creation
- *
+ * Feb 13, 2014 2751       bclement     Initial creation
+ * 
  * 
- * - * @author jkorman - * @version 1.0 + * + * @author bclement + * @version 1.0 */ -public interface ID { +public interface IUser extends IQualifiedID { /** - * - * @param userName + * @param other + * @return true if other user represents same person as this user */ - void setName(String userName); - - /** - * - */ - String getName(); - - /** - * - * @return - */ - String getFQName(); + public boolean isSameUser(IUser other); } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/BaseMessage.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/BaseMessage.java index ba9a68a6ec..95e2710db7 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/BaseMessage.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/BaseMessage.java @@ -26,10 +26,10 @@ import java.util.HashMap; import java.util.Map; import com.raytheon.uf.viz.collaboration.comm.identity.IMessage; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; /** - * TODO Add Description + * Base concrete implementation for chat message objects * *
  * 
@@ -38,6 +38,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Feb 24, 2012            jkorman     Initial creation
+ * Feb 13, 2014 2751       bclement    changed IQualifiedID objects to IUser
  * 
  * 
* @@ -53,9 +54,9 @@ public abstract class BaseMessage implements Serializable, IMessage { private String body; - private IQualifiedID to; + private IUser to; - private IQualifiedID from; + private IUser from; private String subject; @@ -68,7 +69,7 @@ public abstract class BaseMessage implements Serializable, IMessage { * @param to * @param body */ - protected BaseMessage(IQualifiedID to, String body) { + protected BaseMessage(IUser to, String body) { this.body = body; this.to = to; initProperties(); @@ -79,7 +80,7 @@ public abstract class BaseMessage implements Serializable, IMessage { * @return the to */ @Override - public IQualifiedID getTo() { + public IUser getTo() { return to; } @@ -88,7 +89,7 @@ public abstract class BaseMessage implements Serializable, IMessage { * the to to set */ @Override - public void setTo(IQualifiedID to) { + public void setTo(IUser to) { this.to = to; } @@ -96,7 +97,7 @@ public abstract class BaseMessage implements Serializable, IMessage { * @return the from */ @Override - public IQualifiedID getFrom() { + public IUser getFrom() { return from; } @@ -105,7 +106,7 @@ public abstract class BaseMessage implements Serializable, IMessage { * the from to set */ @Override - public void setFrom(IQualifiedID from) { + public void setFrom(IUser from) { this.from = from; } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/CollaborationMessage.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/CollaborationMessage.java deleted file mode 100644 index 657342dd20..0000000000 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/CollaborationMessage.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.collaboration.comm.provider; - -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Feb 24, 2012            jkorman     Initial creation
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class CollaborationMessage extends BaseMessage { - - private static final long serialVersionUID = 1L; - - /** - * - * @param to - * @param body - */ - public CollaborationMessage(IQualifiedID to, String body) { - super(to, body); - } - - /** - * - * @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getMessageType() - */ - @Override - public MessageType getMessageType() { - return MessageType.COLLABORATION; - } - - /** - * - * @see com.raytheon.uf.viz.collaboration.comm.identity.IMessage#getBodyAsBinary(byte[]) - */ - @Override - public void getBodyAsBinary(byte[] body) { - } - -} diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/TextMessage.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/TextMessage.java index e0270cd0ad..11ce057781 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/TextMessage.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/TextMessage.java @@ -19,10 +19,10 @@ **/ package com.raytheon.uf.viz.collaboration.comm.provider; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; /** - * TODO Add Description + * Chat message object * *
  * 
@@ -31,6 +31,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Feb 24, 2012            jkorman     Initial creation
+ * Feb 13, 2014 2751       bclement    changed IQualifiedID objects to IUser
  * 
  * 
* @@ -47,7 +48,7 @@ public class TextMessage extends BaseMessage { * @param to * @param body */ - public TextMessage(IQualifiedID to, String body) { + public TextMessage(IUser to, String body) { super(to, body); } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueInvitationEvent.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueInvitationEvent.java index 5f8988e934..e9a7ad8ead 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueInvitationEvent.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/event/VenueInvitationEvent.java @@ -21,7 +21,8 @@ package com.raytheon.uf.viz.collaboration.comm.provider.event; import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; +import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; +import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId; /** * Event that is posted when a venue invitation is sent @@ -34,6 +35,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; * ------------ ---------- ----------- -------------------------- * Mar 27, 2012 jkorman Initial creation * Dec 18, 2013 2562 bclement removed subject (subject in invite) + * Feb 13, 2014 2751 bclement better types for venueid and invitor * * * @@ -43,9 +45,9 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; public class VenueInvitationEvent implements IVenueInvitationEvent { - private IQualifiedID venueId; + private VenueId venueId; - private IQualifiedID invitor; + private UserId invitor; private VenueInvite invite; @@ -56,7 +58,7 @@ public class VenueInvitationEvent implements IVenueInvitationEvent { * @param subject * @param body */ - public VenueInvitationEvent(IQualifiedID venueId, IQualifiedID invitor, + public VenueInvitationEvent(VenueId venueId, UserId invitor, VenueInvite invite) { this.venueId = venueId; this.invitor = invitor; @@ -69,7 +71,7 @@ public class VenueInvitationEvent implements IVenueInvitationEvent { * @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent#getRoomId() */ @Override - public IQualifiedID getRoomId() { + public VenueId getRoomId() { return venueId; } @@ -77,7 +79,7 @@ public class VenueInvitationEvent implements IVenueInvitationEvent { * @see com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent#getInviter() */ @Override - public IQualifiedID getInviter() { + public UserId getInviter() { return invitor; } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/Venue.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/Venue.java index 03d000085e..9b462a8807 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/Venue.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/info/Venue.java @@ -50,6 +50,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; * Dec 6, 2013 2561 bclement removed ECF * Jan 28, 2014 2698 bclement removed getInfo, added methods to replace * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant, getSubject never returns null + * Feb 13, 2014 2751 bclement changed to use VenueParticipant handle instead of alias * * * @@ -79,7 +80,7 @@ public class Venue implements IVenue { @Override public Presence getPresence(VenueParticipant user) { - Presence presence = presenceMap.get(user.getAlias()); + Presence presence = presenceMap.get(user.getHandle()); if (presence == null) { presence = new Presence(Type.unavailable); presence.setMode(Mode.away); @@ -88,7 +89,7 @@ public class Venue implements IVenue { } public void handlePresenceUpdated(VenueParticipant fromID, Presence presence) { - presenceMap.put(fromID.getAlias(), presence); + presenceMap.put(fromID.getHandle(), presence); } /* diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java index b17d8e46f3..6a0e9e889d 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java @@ -26,7 +26,7 @@ import java.util.UUID; import com.google.common.eventbus.EventBus; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.ISession; -import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; /** * Base class for chat and collaboration sessions @@ -40,6 +40,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; * Mar 21, 2012 jkorman Initial creation * Dec 6, 2013 2561 bclement removed ECF * Jan 28, 2014 2698 bclement removed false throws statements + * Feb 13, 2014 2751 bclement changed UserId object to IUser * * * @@ -119,7 +120,7 @@ public abstract class BaseSession implements ISession { * @see com.raytheon.uf.viz.collaboration.comm.identity.ISession#getUserID() */ @Override - public UserId getUserID() { + public IUser getUserID() { return connection.getUser(); } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java index c2631e42ab..446e10be52 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java @@ -58,7 +58,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEve import com.raytheon.uf.viz.collaboration.comm.identity.event.RosterChangeType; import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload.PayloadType; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayloadProvider; @@ -110,6 +109,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; * cleaned up createCollaborationVenue, removed getVenueInfo * Jan 30, 2014 2698 bclement changed arguments to create sessions, moved room connection from SessionView * Feb 3, 2014 2699 bclement removed unneeded catch in joinTextOnlyVenue + * Feb 13, 2014 2751 bclement better types for venueid and invitor * * * @@ -401,7 +401,7 @@ public class CollaborationConnection implements IEventPublisher { session.createVenue(data); VenueParticipant leader = session.getUserID(); - leader.setAlias(session.getHandle()); + leader.setHandle(session.getHandle()); session.setCurrentSessionLeader(leader); session.setCurrentDataProvider(leader); @@ -616,8 +616,9 @@ public class CollaborationConnection implements IEventPublisher { String room, String inviter, String reason, String password, Message message) { // TODO handle password protected rooms - IQualifiedID venueId = new VenueId(); + VenueId venueId = new VenueId(); venueId.setName(Tools.parseName(room)); + venueId.setHost(Tools.parseHost(room)); UserId invitor = IDConverter.convertFrom(inviter); if (message != null) { @@ -641,7 +642,7 @@ public class CollaborationConnection implements IEventPublisher { } } - private void handleChatRoomInvite(IQualifiedID venueId, UserId invitor, + private void handleChatRoomInvite(VenueId venueId, UserId invitor, String reason, Message message) { VenueInvite invite = new VenueInvite(); if (!StringUtils.isBlank(reason)) { @@ -657,7 +658,7 @@ public class CollaborationConnection implements IEventPublisher { eventBus.post(event); } - private void handleCollabInvite(IQualifiedID venueId, UserId invitor, + private void handleCollabInvite(VenueId venueId, UserId invitor, SessionPayload payload) { Object obj = payload.getData(); if (obj == null diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java index df7bbb235a..a5aedda27e 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java @@ -32,8 +32,9 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.IMessage; import com.raytheon.uf.viz.collaboration.comm.identity.IPeerToPeer; import com.raytheon.uf.viz.collaboration.comm.identity.IPropertied.Property; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; +import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; /** * @@ -49,6 +50,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; * Mar 21, 2012 jkorman Initial creation * Apr 18, 2012 njensen Cleanup * Dec 6, 2013 2561 bclement removed ECF + * Feb 13, 2014 2751 bclement changed IQualifiedID objects to IUser * * * @@ -77,7 +79,7 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer { public void sendPeerToPeer(IMessage message) throws CollaborationException { CollaborationConnection manager = getConnection(); XMPPConnection conn = manager.getXmppConnection(); - IQualifiedID to = message.getTo(); + IUser to = message.getTo(); String toId = to.getFQName(); Message xmppMessage = new Message(toId, Type.chat); xmppMessage.setBody(message.getBody()); @@ -116,7 +118,7 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer { * @throws CollaborationException */ @Override - public void sendPeerToPeer(IQualifiedID to, String message) + public void sendPeerToPeer(UserId to, String message) throws CollaborationException { TextMessage msg = new TextMessage(to, message); this.sendPeerToPeer(msg); diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerCommHelper.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerCommHelper.java index d2971541bd..fe22817887 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerCommHelper.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerCommHelper.java @@ -31,7 +31,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.ISession; import com.raytheon.uf.viz.collaboration.comm.identity.event.IHttpdCollaborationConfigurationEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.IHttpdXmppMessage; import com.raytheon.uf.viz.collaboration.comm.identity.event.ITextMessageEvent; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload; import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; import com.raytheon.uf.viz.collaboration.comm.provider.Tools; @@ -53,6 +53,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter; * Dec 18, 2013 2562 bclement added timeout for HTTP config, * data now in packet extension * Dec 19, 2013 2563 bclement removed wait for HTTP config, added reset + * Feb 13, 2014 2751 bclement changed IQualifiedID objects to IUser * * * @@ -168,7 +169,7 @@ public class PeerToPeerCommHelper implements PacketListener { * @param message */ private void routeMessage(Message message) { - IQualifiedID fromId = IDConverter.convertFrom(message.getFrom()); + IUser fromId = IDConverter.convertFrom(message.getFrom()); TextMessage textMsg = new TextMessage(fromId, message.getBody()); textMsg.setFrom(fromId); textMsg.setBody(message.getBody()); diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java index a28521649f..a873ca7106 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java @@ -76,6 +76,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant * changed args to create/configure venue * Feb 12, 2014 2793 bclement added additional null check to sendObjectToVenue + * Feb 13, 2014 2751 bclement VenueParticipant refactor * * * @@ -190,15 +191,20 @@ public class SharedDisplaySession extends VenueSession implements * java.lang.Object) */ @Override - public void sendObjectToPeer( - com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID participant, - Object obj) throws CollaborationException { + public void sendObjectToPeer(VenueParticipant participant, Object obj) + throws CollaborationException { // TODO should only send to CAVE clients if (obj == null) { return; } + // TODO should we use MUC private chat for this? + if (!participant.hasActualUserId()) { + log.warn("Attempted to send object to peer when actual userid is unknown"); + return; + } + UserId userid = participant.getUserid(); SessionPayload payload = new SessionPayload(PayloadType.Command, obj); - Message msg = new Message(participant.getFQName(), Type.normal); + Message msg = new Message(userid.getFQName(), Type.normal); msg.addExtension(payload); msg.setFrom(conn.getUser()); msg.setProperty(Tools.PROP_SESSION_ID, getSessionId()); @@ -299,7 +305,7 @@ public class SharedDisplaySession extends VenueSession implements topic = pubsubMgr.getNode(getSessionId()); topic.addItemEventListener(this); topic.addItemDeleteListener(this); - Subscription sub = findSubscription(getUserID()); + Subscription sub = findSubscription(getAccount()); if (sub == null) { sub = topic.subscribe(conn.getUser()); } @@ -435,7 +441,7 @@ public class SharedDisplaySession extends VenueSession implements return; } try { - Subscription sub = findSubscription(getUserID()); + Subscription sub = findSubscription(getAccount()); if (sub == null) { return; } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java index 88049f63e5..3ed72b0ada 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java @@ -48,8 +48,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession; import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType; import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; -import com.raytheon.uf.viz.collaboration.comm.provider.CollaborationMessage; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload; import com.raytheon.uf.viz.collaboration.comm.provider.SessionPayload.PayloadType; import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; @@ -94,6 +93,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; * Jan 28, 2014 2698 bclement removed venue info, new rooms are now invite-only * improved error handling for when room already exists * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant, added handle + * Feb 13, 2014 2751 bclement VenueParticipant refactor * * * @@ -110,7 +110,7 @@ public class VenueSession extends BaseSession implements IVenueSession { public static final String SEND_HISTORY = "[[HISTORY]]"; - private MultiUserChat muc = null; + protected MultiUserChat muc = null; private PacketListener intListener = null; @@ -190,7 +190,8 @@ public class VenueSession extends BaseSession implements IVenueSession { invite); Message msg = new Message(); msg.setTo(id.getNormalizedId()); - msg.setFrom(getUserID().getNormalizedId()); + UserId user = getAccount(); + msg.setFrom(user.getNormalizedId()); msg.setType(Type.normal); msg.addExtension(payload); String reason = ""; @@ -268,7 +269,17 @@ public class VenueSession extends BaseSession implements IVenueSession { * @return */ public static String getRoomId(String host, String roomName) { - return roomName + "@conference." + host; + return roomName + "@" + getQualifiedHost(host); + } + + /** + * Prepend conference subdomain on host + * + * @param host + * @return + */ + public static String getQualifiedHost(String host) { + return "conference." + host; } /** @@ -505,7 +516,7 @@ public class VenueSession extends BaseSession implements IVenueSession { VenueParticipant user = IDConverter.convertFromRoom(muc, participant); VenueParticipantEvent event = new VenueParticipantEvent(user, - ParticipantEventType.ARRIVED); + type); event.setEventDescription(desciption); postEvent(event); } @@ -537,7 +548,7 @@ public class VenueSession extends BaseSession implements IVenueSession { Activator.getDefault().getNetworkStats() .log(Activator.VENUE, 0, m.getBody().length()); String fromStr = m.getFrom(); - IQualifiedID from; + IUser from; if (IDConverter.isRoomSystemMessage(fromStr)) { postEvent(new VenueUserEvent(m.getBody())); } else { @@ -693,7 +704,7 @@ public class VenueSession extends BaseSession implements IVenueSession { * user that the message is from * @return Should the message be accepted. */ - private boolean accept(Message message, IQualifiedID from) { + private boolean accept(Message message, IUser from) { if (this.muc == null) { // we don't seem to be in a room return false; @@ -767,7 +778,7 @@ public class VenueSession extends BaseSession implements IVenueSession { * user that the message is from * @return The converted message. */ - private IMessage convertMessage(Message msg, IQualifiedID from) { + private IMessage convertMessage(Message msg, IUser from) { IMessage message = null; String body = msg.getBody(); @@ -775,7 +786,7 @@ public class VenueSession extends BaseSession implements IVenueSession { if (body.startsWith(SEND_TXT)) { body = body.substring(SEND_TXT.length()); } - message = new CollaborationMessage(null, body); + message = new TextMessage(null, body); message.setFrom(from); } return message; @@ -802,6 +813,13 @@ public class VenueSession extends BaseSession implements IVenueSession { return handle; } + /** + * @return userid of this account + */ + public UserId getAccount() { + return getConnection().getUser(); + } + /* * (non-Javadoc) * @@ -811,9 +829,9 @@ public class VenueSession extends BaseSession implements IVenueSession { */ @Override public VenueParticipant getUserID() { - UserId account = super.getUserID(); - return new VenueParticipant(account.getName(), account.getHost(), - handle); + UserId account = getAccount(); + return new VenueParticipant(this.venue.getName(), + getQualifiedHost(account.getHost()), handle, account); } } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/IDConverter.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/IDConverter.java index 222b81c713..9472f4a4f6 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/IDConverter.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/IDConverter.java @@ -37,6 +37,7 @@ import org.jivesoftware.smackx.muc.Occupant; * Dec 6, 2013 2561 bclement removed ECF * Jan 30, 2014 2698 bclement reworked convertFromRoom for venue participants * Feb 3, 2014 2699 bclement fixed room id parsing when handle has special characters + * Feb 13, 2014 2751 bclement VenueParticipant refactor * * * @@ -78,16 +79,16 @@ public class IDConverter { } String cleanId = id.substring(0, id.length() - handle.length()); String host = StringUtils.parseServer(cleanId); - - String name = null; + String roomName = StringUtils.parseName(id); + VenueParticipant rval = new VenueParticipant(roomName, host, handle); Occupant occupant; if (room != null && (occupant = room.getOccupant(id)) != null) { if (occupant.getJid() != null) { // get actual user name - name = StringUtils.parseName(occupant.getJid()); + rval.setUserid(convertFrom(occupant.getJid())); } } - return new VenueParticipant(name, host, handle); + return rval; } public static String normalizeHostname(String hostname) { diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserId.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserId.java index 783001e25d..9c6979475b 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserId.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/UserId.java @@ -25,7 +25,7 @@ import org.apache.commons.lang.builder.EqualsBuilder; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; /** * Parsed user id string @@ -41,6 +41,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; * Dec 6, 2013 2561 bclement removed ECF * Jan 30, 2014 2698 bclement removed unneeded isSameUser(string, string) * improved other isSameUser so it won't blow up on nulls + * Feb 13, 2014 2751 bclement changed to implement IUser * * * @@ -49,7 +50,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; */ @DynamicSerialize @XmlRootElement(name = "userId") -public class UserId implements IQualifiedID { +public class UserId implements IUser { @DynamicSerializeElement protected String name; @@ -102,7 +103,6 @@ public class UserId implements IQualifiedID { * @param userName * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setUserName(java.lang.String) */ - @Override public void setName(String userName) { name = userName; } @@ -121,7 +121,6 @@ public class UserId implements IQualifiedID { * @param hostName * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHostName(java.lang.String) */ - @Override public void setHost(String hostname) { host = IDConverter.normalizeHostname(hostname); } @@ -136,23 +135,18 @@ public class UserId implements IQualifiedID { return host; } + /** - * * @param resourceName - * The resource associated with this id. - * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setResourceName(java.lang.String) */ - @Override public void setResource(String resourceName) { resource = resourceName; } + /** - * - * @return The resource associated with this id. - * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getResource() + * @return */ - @Override public String getResource() { return resource; } @@ -253,7 +247,22 @@ public class UserId implements IQualifiedID { return isSameUser(IDConverter.convertFrom(id)); } - public boolean isSameUser(UserId other) { + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.collaboration.comm.identity.user.IUser#isSameUser + * (com.raytheon.uf.viz.collaboration.comm.identity.user.IUser) + */ + @Override + public boolean isSameUser(IUser other) { + if (other instanceof VenueParticipant) { + VenueParticipant vp = (VenueParticipant) other; + if (!vp.hasActualUserId()) { + return false; + } + other = vp.getUserid(); + } EqualsBuilder builder = new EqualsBuilder(); builder.append(this.name, other.getName()); builder.append(this.host, other.getHost()); diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueId.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueId.java index ce6c54b569..d275a93044 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueId.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueId.java @@ -31,6 +31,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 29, 2012 jkorman Initial creation + * Feb 13, 2014 2751 bclement removed resource, fixed getFQN * * * @@ -42,14 +43,11 @@ public class VenueId implements IQualifiedID { private String host; - private String resource; - private String name; /** * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHost(java.lang.String) */ - @Override public void setHost(String hostName) { host = hostName; } @@ -62,26 +60,9 @@ public class VenueId implements IQualifiedID { return host; } - /** - * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setResource(java.lang.String) - */ - @Override - public void setResource(String resource) { - this.resource = resource; - } - - /** - * @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getResource() - */ - @Override - public String getResource() { - return resource; - } - /** * @see com.raytheon.uf.viz.collaboration.comm.identity.user.ID#setName(java.lang.String) */ - @Override public void setName(String venueName) { name = venueName; } @@ -99,8 +80,7 @@ public class VenueId implements IQualifiedID { */ @Override public String getFQName() { - // FIXME - return null; + return name + "@" + host; } } diff --git a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueParticipant.java b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueParticipant.java index 3181e2d9c5..8c4bb1b4d3 100644 --- a/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueParticipant.java +++ b/cave/com.raytheon.uf.viz.collaboration.comm/src/com/raytheon/uf/viz/collaboration/comm/provider/user/VenueParticipant.java @@ -25,6 +25,8 @@ import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; /** * Parsed ID string from venue. Not guaranteed to have username, but will always @@ -37,6 +39,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jan 29, 2014 bclement Initial creation + * Feb 13, 2014 2751 bclement no longer is a subclass of UserId * * * @@ -45,7 +48,19 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; */ @DynamicSerialize @XmlRootElement(name = "participant") -public class VenueParticipant extends UserId { +public class VenueParticipant implements IUser { + + @DynamicSerializeElement + private String handle; + + @DynamicSerializeElement + private String host; + + @DynamicSerializeElement + private UserId userid; + + @DynamicSerializeElement + private String room; /** * @@ -54,21 +69,33 @@ public class VenueParticipant extends UserId { } /** - * @param userName + * @param room + * name of venue * @param hostName + * qualified name of host including conference subdomain + * @param handle + * public name of user in room + * @param userid + * actual userid of user */ - public VenueParticipant(String userName, String hostName) { - super(userName, hostName); + public VenueParticipant(String room, String hostName, String handle, + UserId userid) { + this(room, hostName, handle); + this.userid = userid; } /** - * @param userName + * @param room + * name of venue * @param hostName - * @param resource + * qualified name of host including conference subdomain + * @param handle + * public name of user in room */ - public VenueParticipant(String userName, String hostName, String handle) { - this(userName, hostName); - setAlias(handle); + public VenueParticipant(String room, String hostName, String handle) { + this.room = room; + this.host = hostName; + this.handle = handle; } /* @@ -81,7 +108,8 @@ public class VenueParticipant extends UserId { public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); builder.append(host); - builder.append(alias); + builder.append(handle); + builder.append(room); return builder.toHashCode(); } @@ -100,29 +128,26 @@ public class VenueParticipant extends UserId { if (this == obj) { return true; } - if (!(obj instanceof UserId)) { + if (!(obj instanceof VenueParticipant)) { return false; } - UserId user = (UserId) obj; + VenueParticipant other = (VenueParticipant) obj; EqualsBuilder builder = new EqualsBuilder(); - builder.append(alias, user.alias); - builder.append(host, user.host); + builder.append(handle, other.handle); + builder.append(host, other.host); + builder.append(room, other.room); return builder.isEquals(); } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.collaboration.comm.provider.user.UserId#isSameUser - * (java.lang.String) + /** + * @param id + * @return true if id represents same venue participant as this one */ - @Override public boolean isSameUser(String id) { if (!IDConverter.isFromRoom(id)) { - return false; + return hasActualUserId() && userid.isSameUser(id); } - UserId other = IDConverter.convertFromRoom(null, id); + VenueParticipant other = IDConverter.convertFromRoom(null, id); return isSameUser(other); } @@ -130,12 +155,123 @@ public class VenueParticipant extends UserId { * (non-Javadoc) * * @see - * com.raytheon.uf.viz.collaboration.comm.provider.user.UserId#isSameUser - * (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId) + * com.raytheon.uf.viz.collaboration.comm.identity.user.IUser#isSameUser + * (com.raytheon.uf.viz.collaboration.comm.identity.user.IUser) */ @Override - public boolean isSameUser(UserId other) { + public boolean isSameUser(IUser other) { + if (other instanceof UserId) { + return hasActualUserId() && userid.isSameUser(other); + } + if (!(other instanceof VenueParticipant)) { + return false; + } return equals(other); } + @Override + public String toString() { + return getFQName(); + } + + /** + * @return id of room that this participant is in (includes hostname) + */ + public String getRoomId() { + return room + "@" + host; + } + + /** + * @return true if actually userid of participant is known + */ + public boolean hasActualUserId() { + return this.userid != null; + } + + /** + * @return the handle + */ + public String getHandle() { + return handle; + } + + /** + * @param handle + * the handle to set + */ + public void setHandle(String handle) { + this.handle = handle; + } + + /** + * @return the host + */ + public String getHost() { + return host; + } + + /** + * @param host + * the host to set + */ + public void setHost(String host) { + this.host = host; + } + + /** + * @return the userid + */ + public UserId getUserid() { + return userid; + } + + /** + * @param userid + * the userid to set + */ + public void setUserid(UserId userid) { + this.userid = userid; + } + + /** + * name of venue + * + * @return the room + */ + public String getRoom() { + return room; + } + + /** + * @param room + * name of venue + */ + public void setRoom(String room) { + this.room = room; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getName + * () + */ + @Override + public String getName() { + return handle; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#getFQName + * () + */ + @Override + public String getFQName() { + return getRoomId() + "/" + handle; + } + } diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/DataProviderEventController.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/DataProviderEventController.java index 039560dc94..967ad0482c 100644 --- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/DataProviderEventController.java +++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/DataProviderEventController.java @@ -52,6 +52,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 26, 2012 njensen Initial creation + * Feb 13, 2014 2751 bclement VenueParticipant refactor * * * @@ -72,7 +73,7 @@ public class DataProviderEventController extends @Subscribe public void participantChanged(IVenueParticipantEvent event) { if (event.getEventType().equals(ParticipantEventType.ARRIVED) - && !event.getParticipant().equals(session.getUserID())) { + && !event.getParticipant().isSameUser(session.getUserID())) { try { AbstractEditor active = container.getActiveSharedEditor(); if (active != null) { diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/SharedEditorsManager.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/SharedEditorsManager.java index f6a0360f27..3526db109e 100644 --- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/SharedEditorsManager.java +++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/roles/dataprovider/SharedEditorsManager.java @@ -39,7 +39,7 @@ import com.google.common.eventbus.Subscribe; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession; -import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; +import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; import com.raytheon.uf.viz.collaboration.display.Activator; import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer; import com.raytheon.uf.viz.collaboration.display.editor.ActivateRemoteDisplay; @@ -82,6 +82,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor; * ------------ ---------- ----------- -------------------------- * Jun 8, 2012 mschenke Initial creation * Jan 28, 2014 2698 bclement removed venue info + * Feb 13, 2014 2751 bclement VenueParticipant refactor * * * @@ -95,8 +96,8 @@ public class SharedEditorsManager implements IRemoteDisplayContainer { @Subscribe public void remoteDisplayRequested(RemoteDisplayRequested event) { String userId = event.getUserId(); - UserId user = null; - for (UserId uid : session.getVenue().getParticipants()) { + VenueParticipant user = null; + for (VenueParticipant uid : session.getVenue().getParticipants()) { if (uid.getFQName().equals(userId)) { user = uid; break; diff --git a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java index 4c20e527bb..cc523c89f8 100644 --- a/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java +++ b/cave/com.raytheon.uf.viz.collaboration.display/src/com/raytheon/uf/viz/collaboration/display/rsc/telestrator/CollaborationDrawingResource.java @@ -29,7 +29,6 @@ import com.google.common.eventbus.Subscribe; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent; -import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; import com.raytheon.uf.viz.collaboration.display.Activator; import com.raytheon.uf.viz.collaboration.display.data.SessionContainer; @@ -305,7 +304,7 @@ public class CollaborationDrawingResource extends @Subscribe public void participantChanged(IVenueParticipantEvent event) { - UserId user = event.getParticipant(); + VenueParticipant user = event.getParticipant(); switch (event.getEventType()) { case DEPARTED: synchronized (layerMap) { @@ -415,7 +414,7 @@ public class CollaborationDrawingResource extends } } - public void sendEventToUser(Object event, UserId user) { + public void sendEventToUser(Object event, VenueParticipant user) { try { container.getSession().sendObjectToPeer(user, event); } catch (CollaborationException e) { diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/AbstractUserLabelProvider.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/AbstractUserLabelProvider.java index 4c00f78042..f1dc613f20 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/AbstractUserLabelProvider.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/AbstractUserLabelProvider.java @@ -34,9 +34,9 @@ import org.jivesoftware.smack.packet.RosterPacket.ItemStatus; import org.jivesoftware.smack.packet.RosterPacket.ItemType; import com.raytheon.uf.viz.collaboration.comm.identity.info.SiteConfigInformation; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; import com.raytheon.uf.viz.collaboration.comm.provider.user.ContactsManager; -import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; /** @@ -50,6 +50,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; * ------------ ---------- ----------- -------------------------- * Jul 24, 2012 bsteffen Initial creation * Jan 27, 2014 2700 bclement added roster entry support + * Feb 13, 2014 2751 bclement made generic for IUsers * * * @@ -57,18 +58,15 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; * @version 1.0 */ -public abstract class AbstractUserLabelProvider extends ColumnLabelProvider { +public abstract class AbstractUserLabelProvider extends + ColumnLabelProvider { protected Map imageMap = new HashMap(); @Override public String getText(Object element) { - UserId user; - if (element instanceof UserId) { - user = (UserId) element; - } else if ( element instanceof RosterEntry){ - user = IDConverter.convertFrom((RosterEntry) element); - } else { + T user = convertObject(element); + if (user == null) { return null; } StringBuilder name = new StringBuilder(); @@ -91,14 +89,18 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider { return name.toString(); } + /** + * Cast object to appropriate type + * + * @param element + * @return null if object cannot be cast + */ + abstract protected T convertObject(Object element); + @Override public Image getImage(Object element) { - UserId user; - if (element instanceof UserId) { - user = (UserId) element; - } else if (element instanceof RosterEntry) { - user = IDConverter.convertFrom((RosterEntry) element); - } else { + T user = convertObject(element); + if (user == null) { return null; } Presence presence = getPresence(user); @@ -125,12 +127,8 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider { @Override public String getToolTipText(Object element) { - UserId user; - if (element instanceof UserId) { - user = (UserId) element; - } else if (element instanceof RosterEntry) { - user = IDConverter.convertFrom((RosterEntry) element); - } else { + T user = convertObject(element); + if (user == null) { return null; } Presence presence = getPresence(user); @@ -187,7 +185,7 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider { imageMap.clear(); } - protected String getDisplayName(UserId user) { + protected static String getLocalAlias(UserId user) { CollaborationConnection connection = CollaborationConnection .getConnection(); if (connection == null) { @@ -201,6 +199,16 @@ public abstract class AbstractUserLabelProvider extends ColumnLabelProvider { } } - protected abstract Presence getPresence(UserId user); + /** + * @param user + * @return display text for user name + */ + abstract protected String getDisplayName(T user); + + /** + * @param user + * @return last known presence for user + */ + abstract protected Presence getPresence(T user); } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ConnectionSubscriber.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ConnectionSubscriber.java index 9332135907..816db9ba12 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ConnectionSubscriber.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ConnectionSubscriber.java @@ -39,7 +39,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession; import com.raytheon.uf.viz.collaboration.comm.identity.event.IHttpdCollaborationConfigurationEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.ITextMessageEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole; import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; @@ -71,6 +71,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager; * Jan 14, 2014 2630 bclement added away timeout * Jan 27, 2014 2700 bclement added auto subscribe property listener * Jan 30, 2014 2698 bclement moved xmpp join logic to dialog so we can reprompt user on failure + * Feb 13, 2014 2751 bclement messages return IUser instead of IQualifiedID * * * @@ -226,7 +227,7 @@ public class ConnectionSubscriber { @Override public void run() { - IQualifiedID peer = message.getFrom(); + IUser peer = message.getFrom(); UserId user = null; if (peer instanceof UserId) { diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/InviteDialog.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/InviteDialog.java index 975ff3c686..dcf60109f1 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/InviteDialog.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/InviteDialog.java @@ -40,8 +40,9 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession; import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent; import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenueInvite; import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; +import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId; import com.raytheon.uf.viz.collaboration.ui.prefs.HandleUtil; import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase; @@ -59,6 +60,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase; * Jan 30, 2014 2698 bclement added logic to join room and reprompt if failed * Feb 3, 2014 2699 bclement added default handle preference * Feb 11, 2014 2699 bclement require non-blank handle + * Feb 13, 2014 2751 bclement better types for roomid and inviter * * * @@ -110,8 +112,8 @@ public class InviteDialog extends CaveSWTDialogBase { super(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL, CAVE.NONE); setText("Session Invitation"); - IQualifiedID inviter = event.getInviter(); - IQualifiedID room = event.getRoomId(); + IUser inviter = event.getInviter(); + VenueId room = event.getRoomId(); StringBuilder sb = new StringBuilder(); VenueInvite invite = event.getInvite(); this.sharedDisplay = invite instanceof SharedDisplayVenueInvite; diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeLabelProvider.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeLabelProvider.java index aa67a4e6c7..c3b9df6468 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeLabelProvider.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/UsersTreeLabelProvider.java @@ -39,6 +39,7 @@ import org.jivesoftware.smack.packet.Presence; import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession; import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; +import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter; import com.raytheon.uf.viz.collaboration.comm.provider.user.SharedGroup; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer; @@ -58,6 +59,7 @@ import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer; * Jan 24, 2014 2701 bclement removed local groups, added shared groups * Jan 27, 2014 2700 bclement pass roster entries directly to userLabelProvider * Jan 28, 2014 2698 bclement removed venue info + * Feb 13, 2014 2751 bclement made AbstractUsersLabelProvider generic * * * @@ -66,7 +68,7 @@ import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer; */ public class UsersTreeLabelProvider extends ColumnLabelProvider { - private AbstractUserLabelProvider userLabelProvider = new AbstractUserLabelProvider() { + private AbstractUserLabelProvider userLabelProvider = new AbstractUserLabelProvider() { @Override protected Presence getPresence(UserId user) { @@ -77,6 +79,22 @@ public class UsersTreeLabelProvider extends ColumnLabelProvider { } return connection.getContactsManager().getPresence(user); } + + protected String getDisplayName(UserId user) { + return getLocalAlias(user); + } + + @Override + protected UserId convertObject(Object element) { + if (element instanceof RosterEntry) { + return IDConverter.convertFrom((RosterEntry) element); + } else if (element instanceof UserId) { + return (UserId) element; + } else { + return null; + } + } + }; private List listeners; diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java index d6a5eeb501..f83d5e3c05 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java @@ -68,6 +68,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.collaboration.comm.identity.IMessage; +import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.ui.Activator; @@ -94,6 +95,7 @@ import com.raytheon.viz.ui.views.CaveFloatingView; * Mar 16, 2012 244 rferrel Initial creation * Dec 19, 2013 2563 bclement moved color lookup into runAsync block * Jan 30, 2014 2698 bclement get display name from child class + * Feb 13, 2014 2751 bclement made generic * * * @@ -101,7 +103,8 @@ import com.raytheon.viz.ui.views.CaveFloatingView; * @version 1.0 */ -public abstract class AbstractSessionView extends CaveFloatingView { +public abstract class AbstractSessionView extends + CaveFloatingView { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(AbstractSessionView.class); @@ -123,8 +126,6 @@ public abstract class AbstractSessionView extends CaveFloatingView { private StyledText composeText; - private UserId[] userIds = null; - protected SessionMsgArchive msgArchive; private List alertWords = null; @@ -149,7 +150,6 @@ public abstract class AbstractSessionView extends CaveFloatingView { public AbstractSessionView() { imageMap = new HashMap(); - userIds = CollaborationUtils.getIds(); fonts = new HashMap(); colors = new HashMap(); dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); @@ -311,17 +311,18 @@ public abstract class AbstractSessionView extends CaveFloatingView { * * @param message */ + @SuppressWarnings("unchecked") public void appendMessage(IMessage message) { - UserId userId = (UserId) message.getFrom(); + T userId = (T) message.getFrom(); long timestamp = message.getTimeStamp(); String body = message.getBody(); String subject = message.getSubject(); appendMessage(userId, timestamp, body, subject); } - protected abstract String getDisplayName(UserId userId); + protected abstract String getDisplayName(T userId); - public void appendMessage(final UserId userId, final long timestamp, + public void appendMessage(final T userId, final long timestamp, final String body, final String subject) { VizApp.runAsync(new Runnable() { @Override @@ -345,7 +346,7 @@ public abstract class AbstractSessionView extends CaveFloatingView { String name = getDisplayName(userId); UserId myUser = connection.getUser(); - if (!myUser.equals(userId) + if (!myUser.isSameUser(userId) && Activator.getDefault().getPreferenceStore() .getBoolean("notifications")) { createNotifier(name, time, body); @@ -443,10 +444,10 @@ public abstract class AbstractSessionView extends CaveFloatingView { } protected abstract void styleAndAppendText(StringBuilder sb, int offset, - String name, UserId userId, String subject, List ranges); + String name, T userId, String subject, List ranges); protected abstract void styleAndAppendText(StringBuilder sb, int offset, - String name, UserId userId, List ranges, Color color); + String name, T userId, List ranges, Color color); /** * Find keys words in body of message starting at offset. /** @@ -567,21 +568,6 @@ public abstract class AbstractSessionView extends CaveFloatingView { messagesText.setFont(new Font(Display.getCurrent(), data)); } - /** - * @return the userIds - */ - public UserId[] getUserIds() { - return userIds; - } - - /** - * @param userIds - * the userIds to set - */ - public void setUserIds(UserId[] userIds) { - this.userIds = userIds; - } - public void setAlertWords(List words) { alertWords = words; } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java index 3a40d226b1..a9edc197ec 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java @@ -53,6 +53,7 @@ import com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider; * Dec 6, 2013 2561 bclement removed ECF * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant * added JID and display name if available + * Feb 13, 2014 2751 bclement VenueParticipant refactor * * * @@ -60,7 +61,8 @@ import com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider; * @version 1.0 */ -public class ParticipantsLabelProvider extends AbstractUserLabelProvider { +public class ParticipantsLabelProvider extends + AbstractUserLabelProvider { protected String sessionId = null; @@ -178,9 +180,9 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider { protected boolean isSessionLeader(VenueParticipant user) { ISession session = getSession(); if (session instanceof SharedDisplaySession) { - UserId leader = ((SharedDisplaySession) session) + VenueParticipant leader = ((SharedDisplaySession) session) .getCurrentSessionLeader(); - return user.getAlias().equals(leader.getAlias()); + return user.getHandle().equals(leader.getHandle()); } return false; } @@ -188,9 +190,9 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider { protected boolean isDataProvider(VenueParticipant user) { ISession session = getSession(); if (session instanceof SharedDisplaySession) { - UserId provider = ((SharedDisplaySession) session) + VenueParticipant provider = ((SharedDisplaySession) session) .getCurrentDataProvider(); - return user.getAlias().equals(provider.getAlias()); + return user.getHandle().equals(provider.getHandle()); } return false; } @@ -231,10 +233,10 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider { // } } } - if (user.getName() != null) { - builder.append("\nJID: ").append(user.getNormalizedId()); - builder.append("\nDisplay Name: ").append( - super.getDisplayName(user)); + if (user.hasActualUserId()) { + UserId actual = user.getUserid(); + builder.append("\nJID: ").append(actual.getNormalizedId()); + builder.append("\nDisplay Name: ").append(getLocalAlias(actual)); } return builder.toString(); } @@ -252,9 +254,9 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider { } @Override - protected Presence getPresence(UserId user) { + protected Presence getPresence(VenueParticipant user) { IVenueSession session = (IVenueSession) getSession(); - return session.getVenue().getPresence((VenueParticipant) user); + return session.getVenue().getPresence(user); } /* @@ -265,8 +267,24 @@ public class ParticipantsLabelProvider extends AbstractUserLabelProvider { * (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId) */ @Override - protected String getDisplayName(UserId user) { - return user.getAlias(); + protected String getDisplayName(VenueParticipant user) { + return user.getHandle(); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.collaboration.ui.AbstractUserLabelProvider#convertObject + * (java.lang.Object) + */ + @Override + protected VenueParticipant convertObject(Object element) { + if (element instanceof VenueParticipant) { + return (VenueParticipant) element; + } else { + return null; + } } } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java index fbcbe5a078..3f202c20da 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java @@ -41,7 +41,6 @@ import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; import com.raytheon.uf.viz.collaboration.comm.identity.IPeerToPeer; -import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterItem; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; @@ -58,13 +57,14 @@ import com.raytheon.uf.viz.collaboration.ui.actions.PrintLogActionContributionIt * ------------ ---------- ----------- -------------------------- * Mar 1, 2012 rferrel Initial creation * Jan 30, 2014 2698 bclement added getDisplayName + * Feb 13, 2014 2751 bclement made parent generic * * * * @author rferrel * @version 1.0 */ -public class PeerToPeerView extends AbstractSessionView implements +public class PeerToPeerView extends AbstractSessionView implements IPrintableView { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(PeerToPeerView.class); @@ -79,7 +79,7 @@ public class PeerToPeerView extends AbstractSessionView implements private static Color black = null; - private IQualifiedID peer; + private UserId peer; private boolean online = true; @@ -238,13 +238,13 @@ public class PeerToPeerView extends AbstractSessionView implements return new SessionMsgArchive(me.getHost(), me.getName(), peer.getName()); } - public void setPeer(IQualifiedID peer) { + public void setPeer(UserId peer) { this.peer = peer; setPartName(getSessionName()); initMessageArchive(); } - public IQualifiedID getPeer() { + public UserId getPeer() { return peer; } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionFeedView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionFeedView.java index be56a86ebc..e12bc74933 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionFeedView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionFeedView.java @@ -40,7 +40,6 @@ import com.google.common.eventbus.Subscribe; import com.raytheon.uf.viz.collaboration.comm.identity.IMessage; import com.raytheon.uf.viz.collaboration.comm.identity.info.SiteConfigInformation; import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection; -import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant; import com.raytheon.uf.viz.collaboration.ui.Activator; import com.raytheon.uf.viz.collaboration.ui.SiteColorInformation; @@ -62,6 +61,7 @@ import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants; * Dec 19, 2013 2563 bclement moved participant filter logic to one method * Jan 08, 2014 2563 bclement changes to match SiteConfigurationManager user sites config * Jan 30, 2014 2698 bclement changed UserId to VenueParticipant + * Feb 13, 2014 2751 bclement VenueParticipant refactor * * * @@ -272,9 +272,10 @@ public class SessionFeedView extends SessionView { @Override protected void styleAndAppendText(StringBuilder sb, int offset, - String name, UserId userId, String subject, List ranges) { - if (subject != null && userId instanceof VenueParticipant) { - setColorForSite((VenueParticipant) userId, subject); + String name, VenueParticipant userId, String subject, + List ranges) { + if (subject != null) { + setColorForSite(userId, subject); } super.styleAndAppendText(sb, offset, name, userId, subject, ranges); } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java index dda67036d2..bb11d2112f 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java @@ -96,13 +96,15 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager; * Dec 6, 2013 2561 bclement removed ECF * Dec 19, 2013 2563 bclement reworked participant event logic * Jan 28, 2014 2698 bclement removed venue info + * Feb 13, 2014 2751 bclement VenueParticipant refactor * * * * @author rferrel * @version 1.0 */ -public class SessionView extends AbstractSessionView implements IPrintableView { +public class SessionView extends AbstractSessionView + implements IPrintableView { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(SessionView.class); @@ -337,10 +339,10 @@ public class SessionView extends AbstractSessionView implements IPrintableView { usersTable.setSorter(new ViewerSorter() { @Override public int compare(Viewer viewer, Object e1, Object e2) { - UserId c1 = (UserId) e1; - UserId c2 = (UserId) e1; + VenueParticipant c1 = (VenueParticipant) e1; + VenueParticipant c2 = (VenueParticipant) e1; - return c1.getAlias().compareTo(c2.getAlias()); + return c1.getHandle().compareTo(c2.getHandle()); } }); @@ -427,8 +429,8 @@ public class SessionView extends AbstractSessionView implements IPrintableView { String message = getComposedMessage(); if (message.length() > 0) { try { - UserId id = CollaborationConnection.getConnection().getUser(); - appendMessage(id, System.currentTimeMillis(), message, null); + appendMessage(session.getUserID(), System.currentTimeMillis(), + message, null); session.sendChatMessage(message); } catch (CollaborationException e) { // TODO Auto-generated catch block. Please revise as @@ -448,17 +450,10 @@ public class SessionView extends AbstractSessionView implements IPrintableView { */ @Override protected void styleAndAppendText(StringBuilder sb, int offset, - String name, UserId userId, String subject, List ranges) { - RGB rgb = null; - // messages from the venue itself will not be of type VenueParticipant, - // they default to black - if (userId instanceof VenueParticipant) { - rgb = colorManager.getColorFromUser((VenueParticipant) userId); - } + String name, VenueParticipant userId, String subject, + List ranges) { + RGB rgb = colorManager.getColorFromUser((VenueParticipant) userId); if (mappedColors.get(rgb) == null) { - if (rgb == null) { - rgb = new RGB(0, 0, 0); - } Color col = new Color(Display.getCurrent(), rgb); mappedColors.put(rgb, col); } @@ -476,7 +471,8 @@ public class SessionView extends AbstractSessionView implements IPrintableView { */ @Override protected void styleAndAppendText(StringBuilder sb, int offset, - String name, UserId userId, List ranges, Color color) { + String name, VenueParticipant userId, List ranges, + Color color) { StyleRange range = new StyleRange(messagesText.getCharCount(), offset, color, null, SWT.NORMAL); ranges.add(range); @@ -774,10 +770,11 @@ public class SessionView extends AbstractSessionView implements IPrintableView { * * @see com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView# * getDisplayName - * (com.raytheon.uf.viz.collaboration.comm.provider.user.UserId) + * (com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID) */ @Override - protected String getDisplayName(UserId userId) { - return userId.getAlias(); + protected String getDisplayName(VenueParticipant userId) { + return userId.getHandle(); } + }