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;
|
package org.gcube.portlets.user.vremembers.shared;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class BelongingUser implements Serializable, Comparable<BelongingUser> {
|
public class BelongingUser implements Serializable, Comparable<BelongingUser> {
|
||||||
|
@ -11,7 +12,7 @@ public class BelongingUser implements Serializable, Comparable<BelongingUser> {
|
||||||
private String institution;
|
private String institution;
|
||||||
private String profileLink;
|
private String profileLink;
|
||||||
private boolean hasPhoto;
|
private boolean hasPhoto;
|
||||||
|
|
||||||
public BelongingUser(String username, String fullName, String avatarId,
|
public BelongingUser(String username, String fullName, String avatarId,
|
||||||
String headline, String institution, String profileLink, boolean hasPhoto) {
|
String headline, String institution, String profileLink, boolean hasPhoto) {
|
||||||
super();
|
super();
|
||||||
|
@ -22,6 +23,7 @@ public class BelongingUser implements Serializable, Comparable<BelongingUser> {
|
||||||
this.institution = institution;
|
this.institution = institution;
|
||||||
this.hasPhoto = hasPhoto;
|
this.hasPhoto = hasPhoto;
|
||||||
this.profileLink = profileLink;
|
this.profileLink = profileLink;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BelongingUser() {
|
public BelongingUser() {
|
||||||
|
@ -78,7 +80,7 @@ public class BelongingUser implements Serializable, Comparable<BelongingUser> {
|
||||||
this.institution = institution;
|
this.institution = institution;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean hasPhoto() {
|
public boolean hasPhoto() {
|
||||||
return hasPhoto;
|
return hasPhoto;
|
||||||
}
|
}
|
||||||
|
@ -86,8 +88,8 @@ public class BelongingUser implements Serializable, Comparable<BelongingUser> {
|
||||||
public void setHasPhoto(boolean hasPhoto) {
|
public void setHasPhoto(boolean hasPhoto) {
|
||||||
this.hasPhoto = hasPhoto;
|
this.hasPhoto = hasPhoto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getProfileLink() {
|
public String getProfileLink() {
|
||||||
return profileLink;
|
return profileLink;
|
||||||
|
@ -97,14 +99,28 @@ public class BelongingUser implements Serializable, Comparable<BelongingUser> {
|
||||||
this.profileLink = profileLink;
|
this.profileLink = profileLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(BelongingUser o) {
|
public int compareTo(BelongingUser o) {
|
||||||
if (this.hasPhoto && !o.hasPhoto)
|
if (this.hasHeadline() && !o.hasHeadline()) {
|
||||||
return -1;
|
return -1;
|
||||||
if (!this.hasPhoto && o.hasPhoto)
|
}
|
||||||
|
if (!this.hasHeadline() && o.hasHeadline())
|
||||||
return 1;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean hasHeadline() {
|
||||||
|
return (headline != null && headline.compareTo("") != 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue