release ready
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/vre-members@99668 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
30073965ee
commit
55132203c6
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.portlets.user.vremembers.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class BelongingUser implements Serializable, Comparable<BelongingUser> {
|
||||
|
@ -22,6 +23,7 @@ public class BelongingUser implements Serializable, Comparable<BelongingUser> {
|
|||
this.institution = institution;
|
||||
this.hasPhoto = hasPhoto;
|
||||
this.profileLink = profileLink;
|
||||
|
||||
}
|
||||
|
||||
public BelongingUser() {
|
||||
|
@ -97,14 +99,28 @@ public class BelongingUser implements Serializable, Comparable<BelongingUser> {
|
|||
this.profileLink = profileLink;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(BelongingUser o) {
|
||||
if (this.hasPhoto && !o.hasPhoto)
|
||||
if (this.hasHeadline() && !o.hasHeadline()) {
|
||||
return -1;
|
||||
if (!this.hasPhoto && o.hasPhoto)
|
||||
}
|
||||
if (!this.hasHeadline() && o.hasHeadline())
|
||||
return 1;
|
||||
|
||||
if ( (this.hasHeadline() && o.hasHeadline()) || ((!this.hasHeadline() && !o.hasHeadline())) ) {
|
||||
if (this.hasPhoto && !o.hasPhoto)
|
||||
return -1;
|
||||
if (!this.hasPhoto && o.hasPhoto)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
private boolean hasHeadline() {
|
||||
return (headline != null && headline.compareTo("") != 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue