better groups match checking for globalgroups

This commit is contained in:
ElgarL 2011-11-20 02:27:25 +00:00
parent 317b0833ef
commit 000d060ea6

View File

@ -39,10 +39,19 @@ public abstract class DataUnit {
public boolean equals(Object o) { public boolean equals(Object o) {
if (o instanceof DataUnit) { if (o instanceof DataUnit) {
DataUnit go = (DataUnit) o; DataUnit go = (DataUnit) o;
if (this.getName().equalsIgnoreCase(go.getName()) if (this.getName().equalsIgnoreCase(go.getName())) {
&& ((this.dataSource == null && go.getDataSource() == null) // Global Group match.
|| (this.dataSource.getName().equalsIgnoreCase(go.getDataSource().getName())))) { if (this.dataSource == null && go.getDataSource() == null)
return true; return true;
// This is a global group, the object to test isn't.
if (this.dataSource == null && go.getDataSource() != null)
return false;
// This is not a global group, but the object to test is.
if (this.dataSource != null && go.getDataSource() == null)
return false;
// Match on group name and world name.
if (this.dataSource.getName().equalsIgnoreCase(go.getDataSource().getName()))
return true;
} }
} }
return false; return false;