Merge "Issue #3056 made venue participant equals method case insensitive" into development

Former-commit-id: 8df505325c [formerly d6f1435a902615724aed2ff0279a6deb29933ce1]
Former-commit-id: fe3ff669a7
This commit is contained in:
Nate Jensen 2014-04-22 12:50:27 -05:00 committed by Gerrit Code Review
commit cc1da5fb88
2 changed files with 38 additions and 7 deletions

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.viz.collaboration.comm.provider.user;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -40,6 +39,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IUser;
* ------------ ---------- ----------- --------------------------
* Jan 29, 2014 bclement Initial creation
* Feb 13, 2014 2751 bclement no longer is a subclass of UserId
* Apr 22, 2014 3056 bclement made equals case insensitive
*
* </pre>
*
@ -131,12 +131,38 @@ public class VenueParticipant implements IUser {
if (!(obj instanceof VenueParticipant)) {
return false;
}
/*
* the xmpp server lower cases room names so we may get them back as
* lower case when we have them locally as upper/mixed case. Treat case
* insensitive.
*/
VenueParticipant other = (VenueParticipant) obj;
EqualsBuilder builder = new EqualsBuilder();
builder.append(handle, other.handle);
builder.append(host, other.host);
builder.append(room, other.room);
return builder.isEquals();
if (!stringFieldEquals(this.handle, other.handle)){
return false;
}
if (!stringFieldEquals(this.room, other.room)) {
return false;
}
if (!stringFieldEquals(this.host, other.host)) {
return false;
}
return true;
}
/**
* @param field
* @param other
* @return true if both arguments are null or arguments are equal ignoring
* case
*/
private boolean stringFieldEquals(String field, String other) {
boolean rval;
if (field == null) {
rval = other == null;
} else {
rval = field.equalsIgnoreCase(other);
}
return rval;
}
/**

View file

@ -94,6 +94,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* Feb 11, 2014 2699 bclement require non-blank handle
* Mar 06, 2014 2848 bclement moved session creation logic to separate method
* Apr 16, 2014 3021 bclement increased width of dialog
* Apr 22, 2014 3056 bclement made room name lowercase to match xmpp server
*
* </pre>
*
@ -452,7 +453,11 @@ public class CreateSessionDialog extends CaveSWTDialog {
List<String> errorMessages = new ArrayList<String>();
String subject = subjectTF.getText().trim();
String err = validateVenueName();
String name = nameTF.getText();
/*
* xmpp server lowercases all room names, lowercase here to
* match when we get names back from the server
*/
String name = nameTF.getText().toLowerCase();
if (err != null) {
focusField = nameTF;
errorMessages.add(err);