From 6b92088fb5530e63fa38cb91799c95dd797087aa Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 26 Jan 2016 15:16:40 +0100 Subject: [thrift] Add UserInfo comparator --- src/main/java/org/openslx/thrifthelper/Comparators.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/main/java/org/openslx/thrifthelper/Comparators.java') diff --git a/src/main/java/org/openslx/thrifthelper/Comparators.java b/src/main/java/org/openslx/thrifthelper/Comparators.java index bffaef8..9f068c2 100644 --- a/src/main/java/org/openslx/thrifthelper/Comparators.java +++ b/src/main/java/org/openslx/thrifthelper/Comparators.java @@ -6,6 +6,7 @@ import org.openslx.bwlp.thrift.iface.ImageSummaryRead; import org.openslx.bwlp.thrift.iface.ImageVersionDetails; import org.openslx.bwlp.thrift.iface.OperatingSystem; import org.openslx.bwlp.thrift.iface.Organization; +import org.openslx.bwlp.thrift.iface.UserInfo; import org.openslx.bwlp.thrift.iface.Virtualizer; /** @@ -74,6 +75,18 @@ public class Comparators return o1.organizationId.compareTo( o2.organizationId ); } }; + + public static final Comparator user = new Comparator() { + @Override + public int compare( UserInfo o1, UserInfo o2 ) + { + if ( o1 == null || o1.userId == null ) + return o2 == null || o2.userId == null ? 0 : 1; + if ( o2 == null || o2.userId == null ) + return -1; + return o1.userId.compareTo( o2.userId ); + } + }; // public static final Comparator location = new Comparator() { // @Override -- cgit v1.2.3-55-g7522