Issue #429 major refactor of UserId, make CollaborationGroupView use actual objects instead of wrappers
Former-commit-id: 68f7aaecfe8c78db56a70e8d33a9d990bf5fa467
This commit is contained in:
parent
a4b0addeee
commit
0241e8857f
33 changed files with 639 additions and 1481 deletions
|
@ -60,6 +60,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenue
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem;
|
||||
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.Presence;
|
||||
|
@ -67,7 +68,6 @@ import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
|
|||
import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterEntry;
|
||||
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.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.login.LoginData;
|
||||
|
@ -104,7 +104,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
*/
|
||||
private CollaborationConnection sessionManager;
|
||||
|
||||
String loginId;
|
||||
private UserId loginId;
|
||||
|
||||
private LoginData loginData;
|
||||
|
||||
|
@ -119,9 +119,9 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
/**
|
||||
* User information such as sessions and groups user is in.
|
||||
*/
|
||||
Map<String, DataUser> usersMap;
|
||||
Map<UserId, IRosterEntry> usersMap;
|
||||
|
||||
Set<DataGroup> groupsSet;
|
||||
Set<IRosterGroup> groups;
|
||||
|
||||
private boolean linkCollaboration;
|
||||
|
||||
|
@ -159,36 +159,25 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
*/
|
||||
private CollaborationDataManager() {
|
||||
linkCollaboration = false;
|
||||
groupsSet = new HashSet<DataGroup>();
|
||||
usersMap = new HashMap<String, DataUser>();
|
||||
groups = new HashSet<IRosterGroup>();
|
||||
usersMap = new HashMap<UserId, IRosterEntry>();
|
||||
sessionsMap = new HashMap<String, IVenueSession>();
|
||||
eventBus = new EventBus();
|
||||
}
|
||||
|
||||
private void populateGroups() {
|
||||
IRoster roster = sessionManager.getRosterManager().getRoster();
|
||||
System.out.println("rosterManager Name " + roster.getUser().getName()
|
||||
+ ": group size " + roster.getGroups().size() + ": entry size "
|
||||
+ roster.getEntries().size());
|
||||
|
||||
groupsSet.clear();
|
||||
|
||||
for (IRosterGroup rosterGroup : roster.getGroups()) {
|
||||
String groupName = rosterGroup.getName();
|
||||
DataGroup group = new DataGroup(groupName);
|
||||
groupsSet.add(group);
|
||||
groups.add(rosterGroup);
|
||||
for (IRosterEntry rosterEntry : rosterGroup.getEntries()) {
|
||||
DataUser user = getUser(CollaborationUtils
|
||||
.makeUserId(rosterEntry));
|
||||
user.addGroup(groupName);
|
||||
user.setPresence(rosterEntry.getPresence());
|
||||
usersMap.put(rosterEntry.getUser(), rosterEntry);
|
||||
}
|
||||
}
|
||||
|
||||
// Orphan users not in any group.
|
||||
for (IRosterEntry rosterEntry : roster.getEntries()) {
|
||||
DataUser user = getUser(CollaborationUtils.makeUserId(rosterEntry));
|
||||
user.setPresence(rosterEntry.getPresence());
|
||||
usersMap.put(rosterEntry.getUser(), rosterEntry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,29 +189,23 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
* display.
|
||||
* @return groups
|
||||
*/
|
||||
public List<String> getGroups(boolean allGroups) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
public List<IRosterItem> getGroups(boolean allGroups) {
|
||||
List<IRosterItem> result = new ArrayList<IRosterItem>();
|
||||
if (allGroups) {
|
||||
for (DataGroup dataGroup : groupsSet) {
|
||||
result.add(dataGroup.getId());
|
||||
}
|
||||
} else {
|
||||
for (DataGroup dataGroup : groupsSet) {
|
||||
if (dataGroup.isDisplay()) {
|
||||
result.add(dataGroup.getId());
|
||||
}
|
||||
for (IRosterGroup dataGroup : groups) {
|
||||
result.add(dataGroup);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<String> getUsersInGroup(String groupId) {
|
||||
List<String> userList = new ArrayList<String>();
|
||||
for (String userId : usersMap.keySet()) {
|
||||
DataUser user = usersMap.get(userId);
|
||||
for (String group : user.groups) {
|
||||
public List<IRosterEntry> getUsersInGroup(IRosterItem groupId) {
|
||||
List<IRosterEntry> userList = new ArrayList<IRosterEntry>();
|
||||
for (UserId userId : usersMap.keySet()) {
|
||||
IRosterEntry user = usersMap.get(userId);
|
||||
for (IRosterGroup group : user.getGroups()) {
|
||||
if (groupId.equals(group)) {
|
||||
userList.add(userId);
|
||||
userList.add(user);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -232,39 +215,14 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
|
||||
public boolean displayGroup(String groupId) {
|
||||
boolean display = true;
|
||||
for (DataGroup group : groupsSet) {
|
||||
if (groupId.equals(group.getId())) {
|
||||
display = group.isDisplay();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// TODO maybe need to make this displayGroup function do something
|
||||
return display;
|
||||
}
|
||||
|
||||
public List<String> getOrphanUsers() {
|
||||
List<String> orphanList = new ArrayList<String>();
|
||||
for (String userId : usersMap.keySet()) {
|
||||
DataUser user = usersMap.get(userId);
|
||||
if (user.groups.size() == 0 && userId.equals(loginId) == false) {
|
||||
orphanList.add(userId);
|
||||
}
|
||||
}
|
||||
return orphanList;
|
||||
}
|
||||
|
||||
public String getLoginId() {
|
||||
public UserId getLoginId() {
|
||||
return loginId;
|
||||
}
|
||||
|
||||
public DataUser getUser(String id) {
|
||||
DataUser user = usersMap.get(id);
|
||||
if (user == null) {
|
||||
user = new DataUser(id);
|
||||
usersMap.put(id, user);
|
||||
}
|
||||
return usersMap.get(id);
|
||||
}
|
||||
|
||||
public void setLinkCollaboration(boolean state) {
|
||||
this.linkCollaboration = state;
|
||||
}
|
||||
|
@ -287,7 +245,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
*
|
||||
* @return sessionManager or null if unable to get connection.
|
||||
*/
|
||||
synchronized public CollaborationConnection getSessionManager() {
|
||||
synchronized public CollaborationConnection getCollaborationConnection() {
|
||||
// Get user's server account information and make connection.
|
||||
if (isConnected() == false) {
|
||||
VizApp.runSync(new Runnable() {
|
||||
|
@ -495,7 +453,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
*/
|
||||
public String createCollaborationSession(String venue, String subject)
|
||||
throws CollaborationException {
|
||||
CollaborationConnection sessionManager = getSessionManager();
|
||||
CollaborationConnection sessionManager = getCollaborationConnection();
|
||||
IVenueSession session = null;
|
||||
String sessionId = null;
|
||||
// try {
|
||||
|
@ -517,7 +475,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
|
||||
public String createTextOnlySession(String venueName, String subject)
|
||||
throws CollaborationException {
|
||||
CollaborationConnection sessionManager = getSessionManager();
|
||||
CollaborationConnection sessionManager = getCollaborationConnection();
|
||||
IVenueSession session = null;
|
||||
String sessionId = null;
|
||||
session = sessionManager.createTextOnlyVenue(venueName, subject);
|
||||
|
@ -683,10 +641,8 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
@Subscribe
|
||||
public void handleModifiedPresence(IRosterEntry entry) {
|
||||
final IRosterEntry rosterEntry = entry;
|
||||
String userId = CollaborationUtils.makeUserId(rosterEntry);
|
||||
DataUser user = usersMap.get(userId);
|
||||
IRosterEntry user = usersMap.get(entry.getUser());
|
||||
if (user != null) {
|
||||
user.setPresence(rosterEntry.getPresence());
|
||||
// Assumes only UI updates will be registered.
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
|
@ -709,10 +665,6 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
final IRosterChangeEvent rosterChangeEvent = event;
|
||||
// TODO update the event's user groups here for the desired type
|
||||
IRosterEntry rosterEntry = rosterChangeEvent.getEntry();
|
||||
String userId = CollaborationUtils.makeUserId(rosterEntry);
|
||||
DataUser user = getUser(userId);
|
||||
System.out.println("=== RosterChangeEvent<" + event.getType() + ">: "
|
||||
+ userId);
|
||||
IPresence presence = rosterChangeEvent.getEntry().getPresence();
|
||||
if (presence != null) {
|
||||
System.out.println("\t" + presence.getMode() + "/"
|
||||
|
@ -722,39 +674,39 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
Collection<IRosterGroup> userGroups = rosterEntry.getGroups();
|
||||
switch (rosterChangeEvent.getType()) {
|
||||
case ADD:
|
||||
user.clearGroups();
|
||||
for (IRosterGroup group : userGroups) {
|
||||
String groupName = group.getName();
|
||||
user.addGroup(groupName);
|
||||
DataGroup dataGroup = null;
|
||||
for (DataGroup dGroup : groupsSet) {
|
||||
if (groupName.equals(dGroup.getId())) {
|
||||
dataGroup = dGroup;
|
||||
boolean matched = false;
|
||||
for (IRosterGroup dGroup : groups) {
|
||||
if (dGroup.getName().equals(group.getName())) {
|
||||
dGroup = group;
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dataGroup == null) {
|
||||
groupsSet.add(new DataGroup(groupName));
|
||||
if (!matched) {
|
||||
groups.add(group);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DELETE:
|
||||
// Assume user no longer exists and remove.
|
||||
usersMap.remove(user);
|
||||
usersMap.remove(rosterEntry);
|
||||
break;
|
||||
case MODIFY:
|
||||
// Assume only the presence needs to be updated.
|
||||
IPresence precsence = rosterEntry.getPresence();
|
||||
if (precsence == null) {
|
||||
if (presence == null) {
|
||||
// Nothing to do don't bother doing eventBus post.
|
||||
return;
|
||||
}
|
||||
user.setPresence(precsence);
|
||||
for (UserId id : usersMap.keySet()) {
|
||||
if (rosterEntry.getUser().equals(id)) {
|
||||
usersMap.put(id, rosterEntry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PRESENCE:
|
||||
break;
|
||||
// case PRESENCE:
|
||||
// System.out.println("\tIgnore assume only presence change");
|
||||
// return;
|
||||
// break;
|
||||
default:
|
||||
statusHandler.handle(Priority.PROBLEM, "Unhandled type: "
|
||||
+ rosterChangeEvent.getType());
|
||||
|
@ -771,6 +723,13 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the usersMap
|
||||
*/
|
||||
public Map<UserId, IRosterEntry> getUsersMap() {
|
||||
return usersMap;
|
||||
}
|
||||
|
||||
public void registerEventHandler(Object handler) {
|
||||
eventBus.register(handler);
|
||||
}
|
||||
|
|
|
@ -1,105 +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.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 22, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CollaborationGroup extends CollaborationNode {
|
||||
protected boolean modifiable;
|
||||
|
||||
protected List<CollaborationNode> children;
|
||||
|
||||
public CollaborationGroup(String id) {
|
||||
super(id);
|
||||
children = new ArrayList<CollaborationNode>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modifiable
|
||||
* the modifiable to set
|
||||
*/
|
||||
public void setModifiable(boolean modifiable) {
|
||||
this.modifiable = modifiable;
|
||||
}
|
||||
|
||||
public boolean getModifiable() {
|
||||
return modifiable;
|
||||
}
|
||||
|
||||
public void addChild(CollaborationNode child) {
|
||||
children.add(child);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the users
|
||||
*/
|
||||
public List<CollaborationNode> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void removeChild(CollaborationNode child) {
|
||||
if (children.contains(child)) {
|
||||
if (child instanceof CollaborationGroup) {
|
||||
CollaborationGroup groupNode = (CollaborationGroup) child;
|
||||
groupNode.removeChildren();
|
||||
}
|
||||
children.remove(child);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeChildren() {
|
||||
for (CollaborationNode child : children) {
|
||||
if (child instanceof CollaborationGroup) {
|
||||
CollaborationGroup groupNode = (CollaborationGroup) child;
|
||||
groupNode.removeChildren();
|
||||
}
|
||||
}
|
||||
children.clear();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.data.CollaborationNode#getImageKey()
|
||||
*/
|
||||
@Override
|
||||
public String getImageKey() {
|
||||
return "group";
|
||||
}
|
||||
}
|
|
@ -19,6 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
|
@ -28,42 +31,48 @@ package com.raytheon.uf.viz.collaboration.data;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 6, 2012 rferrel Initial creation
|
||||
* Apr 23, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SessionGroup extends CollaborationGroup {
|
||||
boolean sessionRoot;
|
||||
public class CollaborationGroupContainer {
|
||||
private List<Object> objects;
|
||||
|
||||
public SessionGroup(String id) {
|
||||
super(id);
|
||||
this.sessionRoot = false;
|
||||
}
|
||||
|
||||
public boolean isSessionRoot() {
|
||||
return sessionRoot;
|
||||
}
|
||||
|
||||
public void setSessionRoot(boolean sessionRoot) {
|
||||
this.sessionRoot = sessionRoot;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
/**
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.data.CollaborationNode#getImageKey()
|
||||
*/
|
||||
@Override
|
||||
public String getImageKey() {
|
||||
return "session_group";
|
||||
public CollaborationGroupContainer() {
|
||||
objects = new ArrayList<Object>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param objects
|
||||
* the objects to set
|
||||
*/
|
||||
public void setObjects(List<Object> objects) {
|
||||
this.objects = objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the objects
|
||||
*/
|
||||
public List<Object> getObjects() {
|
||||
return objects;
|
||||
}
|
||||
|
||||
public void addObject(Object o) {
|
||||
objects.add(o);
|
||||
}
|
||||
|
||||
public void removeObject(Object o) {
|
||||
objects.remove(o);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
objects.clear();
|
||||
}
|
||||
}
|
|
@ -1,99 +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.data;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 22, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CollaborationNode implements Comparable<CollaborationNode> {
|
||||
|
||||
private String text;
|
||||
|
||||
private boolean local;
|
||||
|
||||
String id;
|
||||
|
||||
public CollaborationNode(String id) {
|
||||
super();
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getImageKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the buddy
|
||||
*/
|
||||
public boolean isLocal() {
|
||||
return local;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param buddy
|
||||
* the buddy to set
|
||||
*/
|
||||
public void setLocal(boolean local) {
|
||||
this.local = local;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(CollaborationNode o) {
|
||||
return id.compareTo(o.id);
|
||||
}
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
package com.raytheon.uf.viz.collaboration.data;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 1, 2012 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
public class CollaborationUser extends CollaborationNode {
|
||||
|
||||
String session;
|
||||
|
||||
UserId iChatID;
|
||||
|
||||
public CollaborationUser(String id) {
|
||||
super(id);
|
||||
this.session = null;
|
||||
// this.roles = new ArrayList<DataUser.RoleType>();
|
||||
// this.status = DataUser.StatusType.NOT_ON_LINE;
|
||||
// this.statusMessage = "";
|
||||
}
|
||||
|
||||
public CollaborationUser(String id, String session) {
|
||||
super(id);
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.data.CollaborationNode#getImageKey()
|
||||
*/
|
||||
@Override
|
||||
public String getImageKey() {
|
||||
if (getType() == Type.AVAILABLE) {
|
||||
return getMode().toString();
|
||||
}
|
||||
return "contact_disabled";
|
||||
}
|
||||
|
||||
public IPresence.Mode getMode() {
|
||||
return CollaborationDataManager.getInstance().getUser(id).mode;
|
||||
}
|
||||
|
||||
public IPresence.Type getType() {
|
||||
return CollaborationDataManager.getInstance().getUser(id).type;
|
||||
}
|
||||
|
||||
public void setPresence(IPresence presence) {
|
||||
CollaborationDataManager.getInstance().getUser(id)
|
||||
.setPresence(presence);
|
||||
}
|
||||
|
||||
// public void setMode(IPresence.Mode mode) {
|
||||
// CollaborationDataManager.getInstance().getUser(id).mode = mode;
|
||||
// }
|
||||
//
|
||||
// public void setType(IPresence.Type type) {
|
||||
// CollaborationDataManager.getInstance().getUser(id).type = type;
|
||||
// }
|
||||
|
||||
// public void setStatus(IPresence.Mode mode) {
|
||||
// if (mode.getMode().equals(Mode.AWAY)) {
|
||||
// CollaborationDataManager.getInstance().getUser(id).mode =
|
||||
// StatusType.AWAY;
|
||||
// } else if (mode.getMode().equals(Mode.DND)) {
|
||||
// CollaborationDataManager.getInstance().getUser(id).mode =
|
||||
// StatusType.DO_NOT_DISTURB;
|
||||
// } else if (mode.getMode().equals(Mode.AVAILABLE)) {
|
||||
// CollaborationDataManager.getInstance().getUser(id).mode =
|
||||
// StatusType.AVAILABLE;
|
||||
// }
|
||||
// }
|
||||
|
||||
public String getStatusMessage() {
|
||||
return CollaborationDataManager.getInstance().getUser(id).statusMessage;
|
||||
}
|
||||
|
||||
// public void setStatusMessage(String statusMessage) {
|
||||
// CollaborationDataManager.getInstance().getUser(id).statusMessage =
|
||||
// statusMessage;
|
||||
// }
|
||||
}
|
|
@ -1,75 +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.data;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 1, 2012 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
public class DataGroup {
|
||||
/**
|
||||
* The fully qualified group name. When a subgroup the name should contain
|
||||
* all the groups ancestors. For example if "C" is a subgroup of "B" which
|
||||
* is a subgroup of "A" then C's id would be "A.B.C".
|
||||
*/
|
||||
String id;
|
||||
|
||||
/**
|
||||
* Indicates if the user wants to display the groups information.
|
||||
*/
|
||||
boolean display;
|
||||
|
||||
/**
|
||||
* Only allow classes in the package to use the constructor.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
DataGroup(String id) {
|
||||
this.id = id;
|
||||
this.display = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return display
|
||||
*/
|
||||
public boolean isDisplay() {
|
||||
return display;
|
||||
}
|
||||
|
||||
public void setDisplay(boolean display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
|
@ -1,136 +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.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||
|
||||
/**
|
||||
* A Data class that contains all the user information needed for the current
|
||||
* instance of CAVE.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 1, 2012 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DataUser {
|
||||
private static final Map<String, IPresence.Mode> modeMap = new HashMap<String, IPresence.Mode>();
|
||||
static {
|
||||
for (Mode mode : Mode.values()) {
|
||||
modeMap.put(mode.name(), mode);
|
||||
}
|
||||
}
|
||||
|
||||
IPresence.Mode mode;
|
||||
|
||||
IPresence.Type type;
|
||||
|
||||
String statusMessage;
|
||||
|
||||
/**
|
||||
* The groups being tracked that user belongs to.
|
||||
*/
|
||||
Set<String> groups;
|
||||
|
||||
/**
|
||||
* The active sessions the user is in.
|
||||
*/
|
||||
private Map<String, String> sessionsMap;
|
||||
|
||||
/**
|
||||
* Only allow classes in the package to use the constructor.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
DataUser(String id) {
|
||||
groups = new HashSet<String>();
|
||||
sessionsMap = new HashMap<String, String>();
|
||||
mode = Mode.EXTENDED_AWAY;
|
||||
type = Type.UNKNOWN;
|
||||
}
|
||||
|
||||
public void addGroup(String group) {
|
||||
groups.add(group);
|
||||
}
|
||||
|
||||
public Set<String> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
public void clearGroups() {
|
||||
groups.clear();
|
||||
}
|
||||
|
||||
public String getSessString(String key) {
|
||||
return sessionsMap.get(key);
|
||||
}
|
||||
|
||||
public void setPresence(IPresence presence) {
|
||||
type = presence.getType();
|
||||
mode = presence.getMode();
|
||||
statusMessage = presence.getStatusMessage();
|
||||
if (statusMessage == null) {
|
||||
statusMessage = "";
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @param mode
|
||||
// * the mode to set
|
||||
// */
|
||||
// public void setMode(Mode status) {
|
||||
// this.mode = status;
|
||||
// }
|
||||
//
|
||||
// public void setMode(String name) {
|
||||
// this.mode = modeMap.get(name);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @return the mode
|
||||
*/
|
||||
public Mode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
// public void setType(Type type) {
|
||||
// this.type = type;
|
||||
// }
|
||||
}
|
|
@ -1,48 +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.data;
|
||||
|
||||
/**
|
||||
* A special group to places users not in any group.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 11, 2012 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class OrphanGroup extends CollaborationGroup {
|
||||
|
||||
/**
|
||||
* @param id
|
||||
*/
|
||||
public OrphanGroup(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
}
|
|
@ -36,8 +36,6 @@ package com.raytheon.uf.viz.collaboration.data;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class LoginUser extends CollaborationUser {
|
||||
public LoginUser(String id) {
|
||||
super(id);
|
||||
}
|
||||
public class SessionGroupContainer extends CollaborationGroupContainer {
|
||||
|
||||
}
|
|
@ -37,6 +37,7 @@ import org.eclipse.swt.widgets.MessageBox;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
|
@ -72,7 +73,7 @@ public class ChangePasswordDialog extends CaveSWTDialog {
|
|||
private Control createDialogArea(Composite parent) {
|
||||
CollaborationDataManager manager = CollaborationDataManager
|
||||
.getInstance();
|
||||
String user = manager.getLoginId();
|
||||
UserId user = manager.getLoginId();
|
||||
Composite body = new Composite(parent, SWT.NONE);
|
||||
body.setLayout(new GridLayout(2, false));
|
||||
// body.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
|
||||
|
@ -83,7 +84,7 @@ public class ChangePasswordDialog extends CaveSWTDialog {
|
|||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
gd.horizontalSpan = 2;
|
||||
userLabel.setLayoutData(gd);
|
||||
userLabel.setText(user);
|
||||
userLabel.setText(user.getFQName());
|
||||
|
||||
label = new Label(body, SWT.NONE);
|
||||
label.setText("New Password: ");
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -28,10 +28,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
|
||||
/**
|
||||
|
@ -82,44 +78,9 @@ public class CollaborationUtils {
|
|||
* @param node
|
||||
* @return image
|
||||
*/
|
||||
public static Image getNodeImage(CollaborationNode node) {
|
||||
String name = node.getImageKey().toLowerCase() + ".gif";
|
||||
public static Image getNodeImage(String name) {
|
||||
return IconUtil.getImageDescriptor(Activator.getDefault().getBundle(),
|
||||
name).createImage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make userId of the form username@site; using the information in the
|
||||
* Roster Entry.
|
||||
*
|
||||
* @param rosterEntry
|
||||
* @return userId
|
||||
*/
|
||||
public static String makeUserId(IRosterEntry rosterEntry) {
|
||||
UserId chatId = rosterEntry.getUser();
|
||||
String userId = chatId.getName() + Tools.NAME_DELIM + chatId.getHost();
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make userId of the form username@site; using the information in the Venue
|
||||
* Participant.
|
||||
*
|
||||
* @param participant
|
||||
* @return userId
|
||||
*/
|
||||
public static String makeUserId(UserId participant) {
|
||||
StringBuilder sb = new StringBuilder(participant.getName());
|
||||
sb.append(Tools.NAME_DELIM);
|
||||
int start = sb.length();
|
||||
|
||||
String host = participant.getHost();
|
||||
|
||||
sb.append(host);
|
||||
if (host.startsWith(PREFIX_CONFERENCE)) {
|
||||
sb.replace(start, start + PREFIX_CONFERENCE.length(), "");
|
||||
}
|
||||
return sb.toString();
|
||||
name.toLowerCase() + ".gif").createImage();
|
||||
}
|
||||
|
||||
public static void sendChatMessage(List<String> ids, String message) {
|
||||
|
|
|
@ -325,7 +325,7 @@ public class CreateSessionDialog extends CaveSWTDialog {
|
|||
err = "Name contains invalid characters.";
|
||||
} else {
|
||||
Collection<IVenueInfo> info = CollaborationDataManager
|
||||
.getInstance().getSessionManager().getVenueInfo();
|
||||
.getInstance().getCollaborationConnection().getVenueInfo();
|
||||
for (IVenueInfo i : info) {
|
||||
if (name.equals(i.getVenueName())) {
|
||||
err = "Session already exists. Pick a different name.";
|
||||
|
|
|
@ -23,7 +23,9 @@ package com.raytheon.uf.viz.collaboration.ui;
|
|||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationGroup;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationGroupContainer;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -42,12 +44,6 @@ import com.raytheon.uf.viz.collaboration.data.CollaborationGroup;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class UsersTreeContentProvider implements ITreeContentProvider {
|
||||
// UsersTree rootNode;
|
||||
//
|
||||
// public UsersTreeContentProvider(UsersTree rootNode) {
|
||||
// this.rootNode = rootNode;
|
||||
// }
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -80,19 +76,22 @@ public class UsersTreeContentProvider implements ITreeContentProvider {
|
|||
*/
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
// if (rootNode != null) {
|
||||
// if (rootNode.getChildren() != null) {
|
||||
// return rootNode.getChildren().toArray();
|
||||
// }
|
||||
// }
|
||||
// return new Object[0];
|
||||
CollaborationGroup group = (CollaborationGroup) inputElement;
|
||||
if (group.getChildren() != null) {
|
||||
return group.getChildren().toArray();
|
||||
if (inputElement instanceof IRosterGroup) {
|
||||
IRosterGroup group = (IRosterGroup) inputElement;
|
||||
if (group.getEntries() != null) {
|
||||
return group.getEntries().toArray();
|
||||
} else {
|
||||
return new Object[0];
|
||||
}
|
||||
} else if (inputElement instanceof SessionGroupContainer) {
|
||||
SessionGroupContainer group = (SessionGroupContainer) inputElement;
|
||||
return group.getObjects().toArray();
|
||||
} else if (inputElement instanceof CollaborationGroupContainer) {
|
||||
CollaborationGroupContainer cont = (CollaborationGroupContainer) inputElement;
|
||||
return cont.getObjects().toArray();
|
||||
} else {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -104,18 +103,16 @@ public class UsersTreeContentProvider implements ITreeContentProvider {
|
|||
*/
|
||||
@Override
|
||||
public Object[] getChildren(Object parentElement) {
|
||||
// if (parentElement instanceof UsersTree) {
|
||||
// UsersTree parent = (UsersTree) parentElement;
|
||||
// List<UsersTree> children = parent.getChildren();
|
||||
// if (children != null) {
|
||||
// return children.toArray();
|
||||
// } else {
|
||||
// return new Object[0];
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
CollaborationGroup group = (CollaborationGroup) parentElement;
|
||||
return group.getChildren().toArray();
|
||||
// the only things that can have children are the sessions item or the
|
||||
// groups items
|
||||
if (parentElement instanceof SessionGroupContainer) {
|
||||
SessionGroupContainer cont = (SessionGroupContainer) parentElement;
|
||||
return cont.getObjects().toArray();
|
||||
} else if (parentElement instanceof IRosterGroup) {
|
||||
IRosterGroup group = (IRosterGroup) parentElement;
|
||||
return group.getEntries().toArray();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -140,25 +137,22 @@ public class UsersTreeContentProvider implements ITreeContentProvider {
|
|||
*/
|
||||
@Override
|
||||
public boolean hasChildren(Object element) {
|
||||
// if (element instanceof UsersTree) {
|
||||
// UsersTree elem = (UsersTree) element;
|
||||
// return elem.hasChildren();
|
||||
// }
|
||||
// return false;
|
||||
if (element instanceof CollaborationGroup) {
|
||||
CollaborationGroup group = (CollaborationGroup) element;
|
||||
if (group.getChildren().size() <= 0) {
|
||||
if (element instanceof IRosterGroup) {
|
||||
IRosterGroup group = (IRosterGroup) element;
|
||||
if (group.getEntries().size() <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else if (element instanceof SessionGroupContainer) {
|
||||
SessionGroupContainer cont = (SessionGroupContainer) element;
|
||||
if (cont.getObjects() != null && cont.getObjects().size() > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// public Object findItem(String text) {
|
||||
// UsersTree item = rootNode.findChildByText(text);
|
||||
// return item;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -35,9 +35,13 @@ import org.eclipse.swt.graphics.Font;
|
|||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationGroup;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionGroup;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -78,11 +82,13 @@ public class UsersTreeLabelProvider implements ITableLabelProvider,
|
|||
for (String key : imageMap.keySet()) {
|
||||
imageMap.get(key).dispose();
|
||||
}
|
||||
if (boldFont != null && !boldFont.isDisposed()) {
|
||||
boldFont.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLabelProperty(Object element, String property) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -96,30 +102,55 @@ public class UsersTreeLabelProvider implements ITableLabelProvider,
|
|||
if (Activator.getDefault() == null) {
|
||||
return null;
|
||||
}
|
||||
Image image = null;
|
||||
if (element instanceof CollaborationNode) {
|
||||
CollaborationNode node = (CollaborationNode) element;
|
||||
String key = node.getImageKey();
|
||||
if (key != null) {
|
||||
image = imageMap.get(key);
|
||||
if (image == null) {
|
||||
image = CollaborationUtils.getNodeImage(node);
|
||||
if (image != null) {
|
||||
imageMap.put(key, image);
|
||||
String key = "";
|
||||
if (element instanceof UserId) {
|
||||
String mode = CollaborationDataManager.getInstance()
|
||||
.getCollaborationConnection().getPresence().getMode()
|
||||
.toString();
|
||||
key = mode;
|
||||
} else if (element instanceof IRosterEntry) {
|
||||
IRosterEntry entry = (IRosterEntry) element;
|
||||
if (entry.getPresence().getType() == Type.AVAILABLE) {
|
||||
key = entry.getPresence().getMode().toString();
|
||||
} else {
|
||||
key = "contact_disabled";
|
||||
}
|
||||
} else if (element instanceof IRosterGroup) {
|
||||
key = "group";
|
||||
} else if (element instanceof IVenueSession) {
|
||||
// key = "session_group";
|
||||
} else if (element instanceof SessionGroupContainer) {
|
||||
key = "session_group";
|
||||
}
|
||||
|
||||
if (imageMap.get(key) == null && !key.equals("")) {
|
||||
imageMap.put(key, CollaborationUtils.getNodeImage(key));
|
||||
}
|
||||
}
|
||||
return image;
|
||||
|
||||
return imageMap.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnText(Object element, int index) {
|
||||
CollaborationNode elem = (CollaborationNode) element;
|
||||
if (elem.getText() == null) {
|
||||
return elem.getId();
|
||||
if (element instanceof IRosterEntry) {
|
||||
IRosterEntry entry = (IRosterEntry) element;
|
||||
if (entry.getUser().getAlias() == null) {
|
||||
return entry.getUser().getName();
|
||||
} else {
|
||||
return entry.getUser().getAlias();
|
||||
}
|
||||
return elem.getText();
|
||||
} else if (element instanceof IRosterGroup) {
|
||||
return ((IRosterGroup) element).getName();
|
||||
} else if (element instanceof SessionGroupContainer) {
|
||||
return "Active Sessions";
|
||||
} else if (element instanceof UserId) {
|
||||
return ((UserId) element).getName() + " - "
|
||||
+ ((UserId) element).getHost();
|
||||
} else if (element instanceof IVenueSession) {
|
||||
return ((IVenueSession) element).getVenue().getInfo()
|
||||
.getVenueDescription();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -157,21 +188,17 @@ public class UsersTreeLabelProvider implements ITableLabelProvider,
|
|||
*/
|
||||
@Override
|
||||
public Font getFont(Object element, int columnIndex) {
|
||||
if (element instanceof CollaborationGroup) {
|
||||
if (element instanceof SessionGroup
|
||||
&& !((SessionGroup) element).isSessionRoot()) {
|
||||
if (element instanceof IRosterGroup
|
||||
|| element instanceof SessionGroupContainer) {
|
||||
// for this case do nothing, as it is not the top level of
|
||||
// session groups
|
||||
} else {
|
||||
if (boldFont == null) {
|
||||
Font currFont = Display.getCurrent().getSystemFont();
|
||||
boldFont = new Font(Display.getCurrent(),
|
||||
currFont.toString(),
|
||||
boldFont = new Font(Display.getCurrent(), currFont.toString(),
|
||||
currFont.getFontData()[0].getHeight(), SWT.BOLD);
|
||||
}
|
||||
return boldFont;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,11 +23,10 @@ package com.raytheon.uf.viz.collaboration.ui;
|
|||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerSorter;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationGroup;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
|
||||
import com.raytheon.uf.viz.collaboration.data.LoginUser;
|
||||
import com.raytheon.uf.viz.collaboration.data.OrphanGroup;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionGroup;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -54,40 +53,34 @@ public class UsersTreeViewerSorter extends ViewerSorter {
|
|||
}
|
||||
|
||||
// Make login user top node
|
||||
if (e1 instanceof LoginUser) {
|
||||
if (e1 instanceof UserId) {
|
||||
return -1;
|
||||
}
|
||||
if (e2 instanceof LoginUser) {
|
||||
|
||||
if (e2 instanceof UserId) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// session group before all other types but login user.
|
||||
if (e1 instanceof SessionGroup) {
|
||||
if ((e2 instanceof SessionGroup) == false) {
|
||||
if (e1 instanceof SessionGroupContainer) {
|
||||
if ((e2 instanceof SessionGroupContainer) == false) {
|
||||
return -1;
|
||||
}
|
||||
} else if (e2 instanceof SessionGroup) {
|
||||
} else if (e2 instanceof SessionGroupContainer) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// OrpahGroup always at the bottom
|
||||
if (e1 instanceof OrphanGroup) {
|
||||
return 1;
|
||||
}
|
||||
if (e2 instanceof OrphanGroup) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Groups before users.
|
||||
if (e1 instanceof CollaborationGroup) {
|
||||
if (!(e2 instanceof CollaborationGroup)) {
|
||||
if (e1 instanceof IRosterGroup) {
|
||||
if (!(e2 instanceof IRosterGroup)) {
|
||||
return -1;
|
||||
}
|
||||
} else if (e1 instanceof CollaborationGroup) {
|
||||
} else if (e1 instanceof IRosterGroup) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Either both are groups or both are users.
|
||||
return ((CollaborationNode) e1).compareTo((CollaborationNode) e2);
|
||||
return ((IRosterItem) e1).getName().compareTo(
|
||||
((IRosterItem) e2).getName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ public class ChangeStatusDialog extends CaveSWTDialog {
|
|||
super.preOpened();
|
||||
LoginData loginData = CollaborationDataManager.getInstance()
|
||||
.getLoginData();
|
||||
userLabel.setText(loginData.getAccount());
|
||||
userLabel.setText(loginData.getAccount().getFQName());
|
||||
statusCombo.select(CollaborationUtils.statusModesIndex(loginData
|
||||
.getMode()));
|
||||
statusCombo.select(CollaborationUtils.statusModesIndex(loginData
|
||||
|
|
|
@ -7,6 +7,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
|
||||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
|
@ -94,8 +95,8 @@ public class LoginData implements ISerializableObject {
|
|||
return modeMessage;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return user + "@" + server;
|
||||
public UserId getAccount() {
|
||||
return new UserId(user, server);
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
|
|
|
@ -56,8 +56,6 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterEventSubscriber;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.DataUser;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
@ -378,18 +376,12 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
// .getSelectionIndex()], messageTF
|
||||
// .getText().trim());
|
||||
try {
|
||||
sessionManager = new CollaborationConnection(loginData
|
||||
.getAccount(), loginData.getPassword(),
|
||||
sessionManager = new CollaborationConnection(
|
||||
loginData.getAccount(), loginData
|
||||
.getPassword(),
|
||||
rosterEventSubscriber);
|
||||
DataUser dUser = CollaborationDataManager
|
||||
.getInstance().getUser(
|
||||
loginData.getAccount());
|
||||
// // TODO set mode and message here.
|
||||
// dUser.setMode(loginData.getMode());
|
||||
// dUser.type = Type.AVAILABLE;
|
||||
// dUser.statusMessage = loginData.getModeMessage();
|
||||
setReturnValue(loginData);
|
||||
LoginDialog.this.getShell().dispose();
|
||||
close();
|
||||
} catch (Exception e) {
|
||||
if (focusField == null) {
|
||||
focusField = passwordTF;
|
||||
|
|
|
@ -85,14 +85,10 @@ public abstract class AbstractSessionView extends ViewPart implements
|
|||
|
||||
private StyledText composeText;
|
||||
|
||||
// protected Action chatAction;
|
||||
|
||||
protected abstract String getSessionImageName();
|
||||
|
||||
protected abstract String getSessionName();
|
||||
|
||||
// protected abstract void populateSashForm(SashForm sashForm);
|
||||
|
||||
public abstract void sendMessage();
|
||||
|
||||
protected abstract void setMessageLabel(Composite comp);
|
||||
|
@ -142,7 +138,6 @@ public abstract class AbstractSessionView extends ViewPart implements
|
|||
Composite messagesComp = new Composite(parent, SWT.NONE);
|
||||
GridLayout layout = new GridLayout(1, false);
|
||||
messagesComp.setLayout(layout);
|
||||
// TODO, wrap label in view
|
||||
setMessageLabel(messagesComp);
|
||||
messagesText = new StyledText(messagesComp, SWT.MULTI | SWT.WRAP
|
||||
| SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
|
||||
|
@ -216,23 +211,21 @@ public abstract class AbstractSessionView extends ViewPart implements
|
|||
*/
|
||||
public void appendMessage(IMessage message) {
|
||||
UserId userId = (UserId) message.getFrom();
|
||||
String name = message.getFrom().getName();
|
||||
long timestamp = message.getTimeStamp();
|
||||
String body = message.getBody();
|
||||
appendMessage(userId, name, timestamp, body);
|
||||
appendMessage(userId, timestamp, body);
|
||||
}
|
||||
|
||||
public void appendMessage(UserId userId, String name, long timestamp,
|
||||
String body) {
|
||||
public void appendMessage(UserId userId, long timestamp, String body) {
|
||||
IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) getSite()
|
||||
.getAdapter(IWorkbenchSiteProgressService.class);
|
||||
service.warnOfContentChange();
|
||||
|
||||
// String fqName = message.getFrom().getFQName();
|
||||
// String name = message.getFrom().getName();
|
||||
if (name == null) {
|
||||
name = userId.getFQName().substring(0,
|
||||
userId.getFQName().indexOf("@"));
|
||||
String name = null;
|
||||
if (userId.getAlias() == null || userId.getAlias().isEmpty()) {
|
||||
name = userId.getName();
|
||||
} else {
|
||||
name = userId.getAlias();
|
||||
}
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(timestamp);
|
||||
|
|
|
@ -41,12 +41,11 @@ 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.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -98,9 +97,9 @@ public class CollaborationSessionView extends SessionView {
|
|||
public void run() {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
.getSelection();
|
||||
CollaborationUser selectedUser = (CollaborationUser) selection
|
||||
IRosterEntry selectedUser = (IRosterEntry) selection
|
||||
.getFirstElement();
|
||||
switchLeader(selectedUser.getId());
|
||||
switchLeader(selectedUser.getUser());
|
||||
};
|
||||
};
|
||||
ActionContributionItem leaderItem = new ActionContributionItem(
|
||||
|
@ -113,9 +112,9 @@ public class CollaborationSessionView extends SessionView {
|
|||
public void run() {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
.getSelection();
|
||||
CollaborationUser selectedUser = (CollaborationUser) selection
|
||||
IRosterEntry selectedUser = (IRosterEntry) selection
|
||||
.getFirstElement();
|
||||
switchDataProvider(selectedUser.getId());
|
||||
switchDataProvider(selectedUser.getUser());
|
||||
};
|
||||
};
|
||||
ActionContributionItem dataProviderItem = new ActionContributionItem(
|
||||
|
@ -138,20 +137,20 @@ public class CollaborationSessionView extends SessionView {
|
|||
switchToAction.setMenuCreator(creator);
|
||||
}
|
||||
|
||||
private void switchDataProvider(String fqname) {
|
||||
System.out.println("Send switchDataProvider request. " + fqname);
|
||||
private void switchDataProvider(UserId userId) {
|
||||
System.out.println("Send switchDataProvider request. "
|
||||
+ userId.getFQName());
|
||||
// TODO need to send invite/request for transfer, and then if successful
|
||||
// deactivate the local ones since we won't receive the message
|
||||
}
|
||||
|
||||
private void switchLeader(String fqname) {
|
||||
System.out.println("Send switchLeader request. " + fqname);
|
||||
private void switchLeader(UserId userId) {
|
||||
System.out.println("Send switchLeader request. " + userId.getFQName());
|
||||
// TODO need to send invite/request for transfer, and then if successful
|
||||
// deactivate the local ones since we won't receive the message
|
||||
TransferRoleCommand trc = new TransferRoleCommand();
|
||||
UserId vp = new UserId(Tools.parseName(fqname), Tools.parseHost(fqname));
|
||||
trc.setUser(vp);
|
||||
session.setCurrentSessionLeader(vp);
|
||||
trc.setUser(userId);
|
||||
session.setCurrentSessionLeader(userId);
|
||||
trc.setRole(SharedDisplayRole.SESSION_LEADER);
|
||||
try {
|
||||
session.sendObjectToVenue(trc);
|
||||
|
@ -167,14 +166,14 @@ public class CollaborationSessionView extends SessionView {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String buildParticipantTooltip(CollaborationUser user) {
|
||||
protected String buildParticipantTooltip(IRosterEntry user) {
|
||||
StringBuilder builder = new StringBuilder(
|
||||
super.buildParticipantTooltip(user));
|
||||
// TODO these should be smarter ifs
|
||||
boolean isSessionLeader = Tools.parseName(user.getId()).equals(
|
||||
session.getCurrentSessionLeader().getName());
|
||||
boolean isDataProvider = Tools.parseName(user.getId()).equals(
|
||||
session.getCurrentDataProvider().getName());
|
||||
boolean isSessionLeader = user.getUser().equals(
|
||||
session.getCurrentSessionLeader());
|
||||
boolean isDataProvider = user.getUser().equals(
|
||||
session.getCurrentDataProvider());
|
||||
if (isSessionLeader || isDataProvider) {
|
||||
builder.append("\n-- Roles --");
|
||||
if (isSessionLeader) {
|
||||
|
@ -219,9 +218,8 @@ public class CollaborationSessionView extends SessionView {
|
|||
try {
|
||||
((IVenueSession) session).sendChatMessage(message);
|
||||
} catch (CollaborationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
// appropriate.
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Unable to send chat message", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -240,10 +238,9 @@ public class CollaborationSessionView extends SessionView {
|
|||
|| session.hasRole(SharedDisplayRole.SESSION_LEADER)) {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
.getSelection();
|
||||
CollaborationUser selectedUser = (CollaborationUser) selection
|
||||
IRosterEntry selectedUser = (IRosterEntry) selection
|
||||
.getFirstElement();
|
||||
String selectedUserName = Tools.parseName(selectedUser.getId());
|
||||
if (!selectedUserName.equals(session.getUserID().getName())) {
|
||||
if (!selectedUser.getUser().equals(session.getUserID())) {
|
||||
manager.add(switchToAction);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ import org.eclipse.swt.graphics.RGB;
|
|||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
|
||||
|
@ -111,13 +111,13 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
|||
return null;
|
||||
}
|
||||
|
||||
CollaborationUser user = (CollaborationUser) element;
|
||||
IRosterEntry user = (IRosterEntry) element;
|
||||
Image image = null;
|
||||
String key = user.getImageKey();
|
||||
String key = user.getPresence().getMode().toString();
|
||||
if (key != null) {
|
||||
image = imageMap.get(key);
|
||||
if (image == null) {
|
||||
image = CollaborationUtils.getNodeImage(user);
|
||||
image = CollaborationUtils.getNodeImage(key);
|
||||
if (image != null) {
|
||||
imageMap.put(key, image);
|
||||
}
|
||||
|
@ -129,8 +129,8 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
|||
|
||||
@Override
|
||||
public String getColumnText(Object element, int columnIndex) {
|
||||
CollaborationUser user = (CollaborationUser) element;
|
||||
return user.getText();
|
||||
IRosterEntry user = (IRosterEntry) element;
|
||||
return user.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -143,20 +143,9 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
|||
if (colors == null) {
|
||||
colors = new HashMap<UserId, Color>();
|
||||
}
|
||||
// String host = ((CollaborationUser) element).
|
||||
String id = ((CollaborationUser) element).getId();
|
||||
String[] uid = null;
|
||||
if (id != null) {
|
||||
uid = ((CollaborationUser) element).getId().split("@");
|
||||
}
|
||||
UserId userId = new UserId(uid[0], uid[1]);
|
||||
UserId userId = ((IRosterEntry) element).getUser();
|
||||
RGB color = SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
||||
.getColorManager().getColors().get(userId);
|
||||
if (color == null) {
|
||||
userId.setHost("conference." + uid[1]);
|
||||
color = SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
||||
.getColorManager().getColors().get(userId);
|
||||
}
|
||||
|
||||
// add to map so we can dispose
|
||||
if (color == null) {
|
||||
|
|
|
@ -22,7 +22,6 @@ package com.raytheon.uf.viz.collaboration.ui.session;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.SashForm;
|
||||
import org.eclipse.swt.custom.StyleRange;
|
||||
|
@ -89,71 +88,6 @@ public class PeerToPeerView extends AbstractSessionView {
|
|||
sashForm.setWeights(new int[] { 20, 5 });
|
||||
}
|
||||
|
||||
protected void createActions() {
|
||||
// TODO create peer-to-peer chat action here
|
||||
// chatAction = new Action("Chat") {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// try {
|
||||
// CollaborationDataManager dataManager = CollaborationDataManager
|
||||
// .getInstance();
|
||||
// CollaborationUser user = (CollaborationUser) ((IStructuredSelection)
|
||||
// usersTable
|
||||
// .getSelection()).getFirstElement();
|
||||
// String session = dataManager.createCollaborationSession(
|
||||
// user.getId(), "Chatting...");
|
||||
// PlatformUI
|
||||
// .getWorkbench()
|
||||
// .getActiveWorkbenchWindow()
|
||||
// .getActivePage()
|
||||
// .showView(CollaborationSessionView.ID, session,
|
||||
// IWorkbenchPage.VIEW_ACTIVATE);
|
||||
// // }
|
||||
// } catch (PartInitException e) {
|
||||
// statusHandler.handle(Priority.PROBLEM,
|
||||
// "Unable to open chat", e);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
}
|
||||
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// private void createContextMenu() {
|
||||
// MenuManager menuManager = new MenuManager();
|
||||
// menuManager.setRemoveAllWhenShown(true);
|
||||
// menuManager.addMenuListener(new IMenuListener() {
|
||||
// /*
|
||||
// * (non-Javadoc)
|
||||
// *
|
||||
// * @see
|
||||
// * org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse
|
||||
// * .jface.action.IMenuManager)
|
||||
// */
|
||||
// @Override
|
||||
// public void menuAboutToShow(IMenuManager manager) {
|
||||
// fillContextMenu(manager);
|
||||
// }
|
||||
// });
|
||||
// // Menu menu = menuManager.createContextMenu(usersTable.getControl());
|
||||
// // usersTable.getControl().setMenu(menu);
|
||||
// // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
|
||||
// // .getActivePart().getSite()
|
||||
// // .registerContextMenu(menuManager, usersTable);
|
||||
// // usersTable.getTable().setMenu(menu);
|
||||
// }
|
||||
|
||||
protected void fillContextMenu(IMenuManager manager) {
|
||||
// IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
// .getSelection();
|
||||
// do something here!
|
||||
// Object ob = selection.getFirstElement();
|
||||
// System.out.println(ob.toString());
|
||||
// manager.add(chatAction);
|
||||
// manager.add(new Separator());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -178,16 +112,14 @@ public class PeerToPeerView extends AbstractSessionView {
|
|||
try {
|
||||
CollaborationDataManager manager = CollaborationDataManager
|
||||
.getInstance();
|
||||
IPeerToPeer p2p = (IPeerToPeer) manager.getSessionManager()
|
||||
.getPeerToPeerSession();
|
||||
IPeerToPeer p2p = (IPeerToPeer) manager
|
||||
.getCollaborationConnection().getPeerToPeerSession();
|
||||
p2p.sendPeerToPeer(peer, message);
|
||||
appendMessage((UserId) peer, manager.getLoginId(),
|
||||
System.currentTimeMillis(), message);
|
||||
appendMessage(manager.getLoginId(), System.currentTimeMillis(),
|
||||
message);
|
||||
} catch (CollaborationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
// appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to send message to " + peer.getName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -195,11 +127,10 @@ public class PeerToPeerView extends AbstractSessionView {
|
|||
protected void styleAndAppendText(StringBuilder sb, int offset,
|
||||
String name, UserId userId, List<StyleRange> ranges) {
|
||||
Color color = null;
|
||||
if (!userId.getFQName().equals(
|
||||
CollaborationDataManager.getInstance().getLoginId())) {
|
||||
color = userColor;
|
||||
} else {
|
||||
if (!userId.equals(CollaborationDataManager.getInstance().getLoginId())) {
|
||||
color = chatterColor;
|
||||
} else {
|
||||
color = userColor;
|
||||
}
|
||||
StyleRange range = new StyleRange(messagesText.getCharCount(), offset,
|
||||
color, null, SWT.NORMAL);
|
||||
|
|
|
@ -64,21 +64,16 @@ 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.IMessage;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||
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.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
|
||||
|
@ -156,7 +151,7 @@ public class SessionView extends AbstractSessionView {
|
|||
public void run() {
|
||||
try {
|
||||
CollaborationConnection sessionManager = CollaborationDataManager
|
||||
.getInstance().getSessionManager();
|
||||
.getInstance().getCollaborationConnection();
|
||||
ISession session = sessionManager.getPeerToPeerSession();
|
||||
// TODO this doesn't seem right to use the session's
|
||||
// sessionId
|
||||
|
@ -346,9 +341,10 @@ public class SessionView extends AbstractSessionView {
|
|||
usersTable.setLabelProvider(labelProvider);
|
||||
usersTable.setSorter(new ViewerSorter() {
|
||||
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||
CollaborationUser c1 = (CollaborationUser) e1;
|
||||
CollaborationUser c2 = (CollaborationUser) e1;
|
||||
return c1.compareTo(c2);
|
||||
IRosterEntry c1 = (IRosterEntry) e1;
|
||||
IRosterEntry c2 = (IRosterEntry) e1;
|
||||
return c1.getUser().getFQName()
|
||||
.compareTo(c2.getUser().getFQName());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -358,7 +354,7 @@ public class SessionView extends AbstractSessionView {
|
|||
TableItem item = usersTable.getTable().getItem(
|
||||
new Point(e.x, e.y));
|
||||
if (item != null) {
|
||||
CollaborationUser user = (CollaborationUser) item.getData();
|
||||
IRosterEntry user = (IRosterEntry) item.getData();
|
||||
usersTable.getTable().setToolTipText(
|
||||
buildParticipantTooltip(user));
|
||||
} else {
|
||||
|
@ -367,21 +363,15 @@ public class SessionView extends AbstractSessionView {
|
|||
}
|
||||
});
|
||||
|
||||
List<CollaborationUser> users = new ArrayList<CollaborationUser>();
|
||||
List<IRosterEntry> users = new ArrayList<IRosterEntry>();
|
||||
if (session != null) {
|
||||
for (UserId participant : session.getVenue().getParticipants()) {
|
||||
|
||||
String userId = CollaborationUtils.makeUserId(participant);
|
||||
CollaborationUser user = new CollaborationUser(userId,
|
||||
sessionId);
|
||||
if (user.getType() == Type.UNKNOWN) {
|
||||
// Unknown user assume mode/type
|
||||
user.setPresence(new Presence(Mode.AVAILABLE,
|
||||
Type.AVAILABLE, ""));
|
||||
CollaborationDataManager manager = CollaborationDataManager
|
||||
.getInstance();
|
||||
IRosterEntry entry = manager.getUsersMap().get(participant);
|
||||
if (entry != null) {
|
||||
users.add(manager.getUsersMap().get(participant));
|
||||
}
|
||||
|
||||
user.setText(participant.getFQName());
|
||||
users.add(user);
|
||||
}
|
||||
} else {
|
||||
participantsLabel.setEnabled(false);
|
||||
|
@ -393,11 +383,12 @@ public class SessionView extends AbstractSessionView {
|
|||
((GridData) usersComp.getLayoutData()).exclude = true;
|
||||
}
|
||||
|
||||
protected String buildParticipantTooltip(CollaborationUser user) {
|
||||
protected String buildParticipantTooltip(IRosterEntry user) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Status : ").append(user.getMode().getMode())
|
||||
.append("\n");
|
||||
builder.append("Message : \"").append(user.getStatusMessage());
|
||||
builder.append("Status : ")
|
||||
.append(user.getPresence().getMode().getMode()).append("\n");
|
||||
builder.append("Message : \"").append(
|
||||
user.getPresence().getStatusMessage());
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
@ -640,28 +631,20 @@ public class SessionView extends AbstractSessionView {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void participantArrived(UserId participant) {
|
||||
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
||||
.getInput();
|
||||
String name = participant.getFQName();
|
||||
String userId = CollaborationUtils.makeUserId(participant);
|
||||
for (CollaborationUser user : users) {
|
||||
if (userId.equals(user.getId())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
CollaborationUser user = new CollaborationUser(userId, sessionId);
|
||||
user.setText(name);
|
||||
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
|
||||
IRosterEntry user = CollaborationDataManager.getInstance()
|
||||
.getUsersMap().get(participant);
|
||||
users.add(user);
|
||||
usersTable.refresh();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void participantDeparted(UserId participant) {
|
||||
String userId = CollaborationUtils.makeUserId(participant);
|
||||
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
||||
.getInput();
|
||||
System.out.println("++++ handle departed here: "
|
||||
+ participant.getName() + ", " + participant.getFQName());
|
||||
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
|
||||
for (int i = 0; i < users.size(); ++i) {
|
||||
if (userId.equals(users.get(i).getId())) {
|
||||
if (participant.equals(users.get(i).getUser())) {
|
||||
users.remove(i);
|
||||
usersTable.refresh();
|
||||
break;
|
||||
|
@ -679,9 +662,6 @@ public class SessionView extends AbstractSessionView {
|
|||
// Ignore the presence's mode/type. May not be the same as the user's.
|
||||
// TODO Keep as a place holder for now since it may be needed to set
|
||||
// leader/provider roles.
|
||||
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
||||
.getInput();
|
||||
String name = participant.getFQName();
|
||||
String userId = CollaborationUtils.makeUserId(participant);
|
||||
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,9 @@ import java.util.List;
|
|||
import org.eclipse.swt.graphics.Image;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
|
||||
|
@ -56,12 +57,10 @@ public class SharedDisplayParticipantsLabelProvider extends
|
|||
if (image != null) {
|
||||
ISharedDisplaySession sdSession = SharedDisplaySessionMgr
|
||||
.getSessionContainer(sessionId).getSession();
|
||||
CollaborationUser user = (CollaborationUser) element;
|
||||
String userId = user.getId();
|
||||
String sessionLeaderId = CollaborationUtils.makeUserId(sdSession
|
||||
.getCurrentSessionLeader());
|
||||
String dataProviderId = CollaborationUtils.makeUserId(sdSession
|
||||
.getCurrentDataProvider());
|
||||
IRosterEntry user = (IRosterEntry) element;
|
||||
UserId userId = user.getUser();
|
||||
UserId sessionLeaderId = sdSession.getCurrentSessionLeader();
|
||||
UserId dataProviderId = sdSession.getCurrentDataProvider();
|
||||
List<SharedDisplayRole> roleList = new ArrayList<SharedDisplayRole>();
|
||||
if (userId.equals(sessionLeaderId)) {
|
||||
roleList.add(SharedDisplayRole.SESSION_LEADER);
|
||||
|
@ -86,24 +85,25 @@ public class SharedDisplayParticipantsLabelProvider extends
|
|||
* -
|
||||
* @return image - modified with indicator(s)
|
||||
*/
|
||||
private Image getModifier(List<SharedDisplayRole> roles,
|
||||
CollaborationUser user) {
|
||||
String key = user.getImageKey();
|
||||
private Image getModifier(List<SharedDisplayRole> roles, IRosterEntry user) {
|
||||
// String key = user.getImageKey();
|
||||
String key = "";
|
||||
StringBuilder modKey = new StringBuilder(key);
|
||||
int roleCnt = 0;
|
||||
if (roles.contains(SharedDisplayRole.SESSION_LEADER)) {
|
||||
++roleCnt;
|
||||
modKey.append(":")
|
||||
.append(SharedDisplayRole.SESSION_LEADER.toString());
|
||||
modKey.append(":").append(
|
||||
SharedDisplayRole.SESSION_LEADER.toString());
|
||||
}
|
||||
if (roles.contains(SharedDisplayRole.DATA_PROVIDER)) {
|
||||
++roleCnt;
|
||||
modKey.append(":").append(SharedDisplayRole.DATA_PROVIDER.toString());
|
||||
modKey.append(":").append(
|
||||
SharedDisplayRole.DATA_PROVIDER.toString());
|
||||
}
|
||||
Image image = imageMap.get(modKey.toString());
|
||||
|
||||
if (image == null) {
|
||||
image = CollaborationUtils.getNodeImage(user);
|
||||
image = CollaborationUtils.getNodeImage(key);
|
||||
// original image is 16x16
|
||||
image.getImageData();
|
||||
imageMap.put(modKey.toString(), image);
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
|||
|
||||
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.provider.user.UserId;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -81,7 +82,7 @@ public interface IVenueSession extends ISession {
|
|||
* The intended subject of the venue conversation.
|
||||
* @return
|
||||
*/
|
||||
public void sendInvitation(String id, VenueInvite invite)
|
||||
public void sendInvitation(UserId id, VenueInvite invite)
|
||||
throws CollaborationException;
|
||||
|
||||
/**
|
||||
|
@ -93,7 +94,7 @@ public interface IVenueSession extends ISession {
|
|||
* Any text that the user may wish to include.
|
||||
* @return
|
||||
*/
|
||||
public void sendInvitation(List<String> ids, VenueInvite invite)
|
||||
public void sendInvitation(List<UserId> ids, VenueInvite invite)
|
||||
throws CollaborationException;
|
||||
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public interface IRoster {
|
|||
* @param nickName
|
||||
* @param groups
|
||||
*/
|
||||
void sendRosterAdd(String account, String nickName, String[] groups)
|
||||
void sendRosterAdd(UserId account, String[] groups)
|
||||
throws CollaborationException;
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,7 @@ public interface IRosterManager {
|
|||
* @param nickName
|
||||
* @param groups
|
||||
*/
|
||||
void sendRosterAdd(String account, String nickName, String[] groups)
|
||||
void sendRosterAdd(UserId account, String[] groups)
|
||||
throws CollaborationException;
|
||||
|
||||
/**
|
||||
|
|
|
@ -231,7 +231,6 @@ public class Roster extends RosterItem implements IRoster {
|
|||
// so update with the presence.
|
||||
RosterEntry ret = (RosterEntry) re;
|
||||
ret.setPresence(entry.getPresence());
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
// nothing to do. And this shouldn't happen!
|
||||
|
@ -257,9 +256,9 @@ public class Roster extends RosterItem implements IRoster {
|
|||
* @param groups
|
||||
*/
|
||||
@Override
|
||||
public void sendRosterAdd(String account, String nickName, String[] groups)
|
||||
public void sendRosterAdd(UserId account, String[] groups)
|
||||
throws CollaborationException {
|
||||
rosterManager.sendRosterAdd(account, nickName, groups);
|
||||
rosterManager.sendRosterAdd(account, groups);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -340,5 +339,4 @@ public class Roster extends RosterItem implements IRoster {
|
|||
System.out
|
||||
.println("##########################################################################");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.comm.provider.roster;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.ecf.core.identity.ID;
|
||||
import org.eclipse.ecf.core.util.ECFException;
|
||||
|
@ -31,6 +33,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.listener.IRosterListener;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
|
||||
|
@ -127,7 +130,7 @@ public class RosterManager implements IRosterManager {
|
|||
* @param groups
|
||||
*/
|
||||
@Override
|
||||
public void sendRosterAdd(String account, String nickName, String[] groups)
|
||||
public void sendRosterAdd(UserId account, String[] groups)
|
||||
throws CollaborationException {
|
||||
org.eclipse.ecf.presence.roster.IRosterManager manager = baseRoster
|
||||
.getPresenceContainerAdapter().getRosterManager();
|
||||
|
@ -136,7 +139,8 @@ public class RosterManager implements IRosterManager {
|
|||
.getRosterSubscriptionSender();
|
||||
|
||||
try {
|
||||
sender.sendRosterAdd(account, nickName, groups);
|
||||
sender.sendRosterAdd(account.getFQName(), account.getAlias(),
|
||||
groups);
|
||||
} catch (ECFException e) {
|
||||
throw new CollaborationException();
|
||||
}
|
||||
|
@ -157,7 +161,7 @@ public class RosterManager implements IRosterManager {
|
|||
IRosterSubscriptionSender sender = manager
|
||||
.getRosterSubscriptionSender();
|
||||
|
||||
ID id = sessionManager.createID(userId.getFQName());
|
||||
ID id = sessionManager.createID(userId);
|
||||
try {
|
||||
sender.sendRosterRemove(id);
|
||||
} catch (ECFException e) {
|
||||
|
@ -189,6 +193,22 @@ public class RosterManager implements IRosterManager {
|
|||
*/
|
||||
public void updateEntry(IRosterEntry entry) {
|
||||
IRosterEntry modified = roster.modifyRosterEntry(entry);
|
||||
IPresenceContainerAdapter adapter = baseRoster
|
||||
.getPresenceContainerAdapter();
|
||||
org.eclipse.ecf.presence.roster.IRosterManager manager = adapter
|
||||
.getRosterManager();
|
||||
List<String> groups = new ArrayList<String>();
|
||||
for (IRosterGroup grp : entry.getGroups()) {
|
||||
groups.add(grp.getName());
|
||||
}
|
||||
try {
|
||||
manager.getRosterSubscriptionSender().sendRosterAdd(
|
||||
entry.getUser().getFQName(), entry.getUser().getAlias(),
|
||||
groups.toArray(new String[0]));
|
||||
} catch (ECFException e) {
|
||||
// TODO handle better
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (modified != null) {
|
||||
sessionManager.getEventPublisher().post(entry);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
|
||||
private Map<String, ISession> sessions;
|
||||
|
||||
private String account;
|
||||
private UserId account;
|
||||
|
||||
private String password;
|
||||
|
||||
|
@ -156,7 +156,7 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
* @throws ContainerCreateException
|
||||
*
|
||||
*/
|
||||
public CollaborationConnection(String account, String password)
|
||||
public CollaborationConnection(UserId account, String password)
|
||||
throws CollaborationException {
|
||||
this(account, password, (IRosterEventSubscriber) null);
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
* @throws ContainerCreateException
|
||||
*
|
||||
*/
|
||||
public CollaborationConnection(String account, String password,
|
||||
public CollaborationConnection(UserId account, String password,
|
||||
IPresence initialPresence) throws Exception {
|
||||
this(account, password, (IRosterEventSubscriber) null);
|
||||
if (accountManager != null) {
|
||||
|
@ -194,7 +194,7 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
* A roster event subscriber.
|
||||
* @throws CollaborationException
|
||||
*/
|
||||
public CollaborationConnection(String account, String password,
|
||||
public CollaborationConnection(UserId account, String password,
|
||||
IRosterEventSubscriber rosterEventSubscriber)
|
||||
throws CollaborationException {
|
||||
eventBus = new EventBus();
|
||||
|
@ -315,7 +315,7 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
*
|
||||
* @return The account string.
|
||||
*/
|
||||
public String getAccount() {
|
||||
public UserId getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
|
@ -422,10 +422,7 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
if (session != null) {
|
||||
session.joinVenue(venueName);
|
||||
|
||||
String name = Tools.parseName(account);
|
||||
String host = Tools.parseHost(account);
|
||||
UserId me = new UserId(name, host);
|
||||
session.setUserId(me);
|
||||
session.setUserId(account);
|
||||
if (invitation.getInvite() instanceof SharedDisplayVenueInvite) {
|
||||
SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation
|
||||
.getInvite();
|
||||
|
@ -455,14 +452,9 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
session = new SharedDisplaySession(container, eventBus, this);
|
||||
|
||||
session.createVenue(venueName, subject);
|
||||
String name = Tools.parseName(account);
|
||||
String host = Tools.parseHost(account);
|
||||
|
||||
UserId me = new UserId(name, host);
|
||||
|
||||
session.setCurrentSessionLeader(me);
|
||||
session.setCurrentDataProvider(me);
|
||||
session.setUserId(me);
|
||||
session.setCurrentSessionLeader(account);
|
||||
session.setCurrentDataProvider(account);
|
||||
session.setUserId(account);
|
||||
|
||||
sessions.put(session.getSessionId(), session);
|
||||
return session;
|
||||
|
@ -741,11 +733,12 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public ID createID(String name) throws CollaborationException {
|
||||
public ID createID(UserId name) throws CollaborationException {
|
||||
ID id = null;
|
||||
try {
|
||||
if (connectionNamespace != null) {
|
||||
id = IDFactory.getDefault().createID(connectionNamespace, name);
|
||||
id = IDFactory.getDefault().createID(connectionNamespace,
|
||||
name.getFQName());
|
||||
}
|
||||
} catch (IDCreateException idce) {
|
||||
throw new CollaborationException("Could not create id");
|
||||
|
|
|
@ -233,7 +233,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
* java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void sendInvitation(String id, VenueInvite invite)
|
||||
public void sendInvitation(UserId id, VenueInvite invite)
|
||||
throws CollaborationException {
|
||||
IChatRoomInvitationSender sender = getConnectionPresenceAdapter()
|
||||
.getChatRoomManager().getInvitationSender();
|
||||
|
@ -241,7 +241,7 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
String msgBody = Tools.marshallData(invite);
|
||||
ID roomId = venueInfo.getConnectedID();
|
||||
ID userId = IDFactory.getDefault().createID(
|
||||
getConnectionNamespace(), id);
|
||||
getConnectionNamespace(), id.getFQName());
|
||||
|
||||
try {
|
||||
sender.sendInvitation(roomId, userId, invite.getSubject(),
|
||||
|
@ -267,10 +267,10 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
* java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void sendInvitation(List<String> ids, VenueInvite invite)
|
||||
public void sendInvitation(List<UserId> ids, VenueInvite invite)
|
||||
throws CollaborationException {
|
||||
if (ids != null) {
|
||||
for (String id : ids) {
|
||||
for (UserId id : ids) {
|
||||
sendInvitation(id, invite);
|
||||
}
|
||||
}
|
||||
|
@ -450,8 +450,8 @@ public class VenueSession extends BaseSession implements IVenueSession {
|
|||
|
||||
String name = Tools.parseName(from.getName());
|
||||
|
||||
String account = getSessionManager().getAccount();
|
||||
String aName = Tools.parseName(account);
|
||||
UserId account = getSessionManager().getAccount();
|
||||
String aName = account.getFQName();
|
||||
if (aName.equals(name)) {
|
||||
acceptMessage = false;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class UserId implements IQualifiedID {
|
|||
public UserId(String userName, String hostName, String resource,
|
||||
String alias) {
|
||||
this.name = userName;
|
||||
this.host = hostName;
|
||||
setHost(hostName);
|
||||
this.resource = resource;
|
||||
this.alias = alias;
|
||||
}
|
||||
|
@ -112,8 +112,11 @@ public class UserId implements IQualifiedID {
|
|||
* @see com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID#setHostName(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setHost(String hostName) {
|
||||
host = hostName;
|
||||
public void setHost(String hostname) {
|
||||
if (hostname.startsWith(CONF_ID)) {
|
||||
hostname = hostname.substring(CONF_ID.length());
|
||||
}
|
||||
host = hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,11 +158,7 @@ public class UserId implements IQualifiedID {
|
|||
public String getFQName() {
|
||||
StringBuilder sb = new StringBuilder(name);
|
||||
sb.append("@");
|
||||
String hostname = host;
|
||||
if (hostname.startsWith(CONF_ID)) {
|
||||
hostname = hostname.substring(CONF_ID.length());
|
||||
}
|
||||
sb.append(hostname);
|
||||
sb.append(host);
|
||||
sb.append("/");
|
||||
if (resource != null) {
|
||||
sb.append(resource);
|
||||
|
|
Loading…
Add table
Reference in a new issue