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:
Massimiliano Assante 2014-09-10 12:25:33 +00:00
parent 30073965ee
commit 55132203c6
1 changed files with 23 additions and 7 deletions

View File

@ -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> {
@ -11,7 +12,7 @@ public class BelongingUser implements Serializable, Comparable<BelongingUser> {
private String institution;
private String profileLink;
private boolean hasPhoto;
public BelongingUser(String username, String fullName, String avatarId,
String headline, String institution, String profileLink, boolean hasPhoto) {
super();
@ -22,6 +23,7 @@ public class BelongingUser implements Serializable, Comparable<BelongingUser> {
this.institution = institution;
this.hasPhoto = hasPhoto;
this.profileLink = profileLink;
}
public BelongingUser() {
@ -78,7 +80,7 @@ public class BelongingUser implements Serializable, Comparable<BelongingUser> {
this.institution = institution;
}
public boolean hasPhoto() {
return hasPhoto;
}
@ -86,8 +88,8 @@ public class BelongingUser implements Serializable, Comparable<BelongingUser> {
public void setHasPhoto(boolean hasPhoto) {
this.hasPhoto = hasPhoto;
}
public String getProfileLink() {
return profileLink;
@ -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);
}
}