commit ba5f20eb7e9fe2f87bace2832819dc8dc269ca23
Author: Katja Luther <k.luther@bgbm.org>
Date:   Mon Jul 2 15:25:37 2018 +0200

    fix problem with titleCache comparator in user and group bulkeditor

diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
index 77e21353a..521bc4745 100644
--- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
+++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
@@ -9,6 +9,7 @@
 package eu.etaxonomy.taxeditor.bulkeditor.input;
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -36,6 +37,7 @@ import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorQuery;
 import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
 import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.CdmBaseSortProvider;
+import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.TitleCacheComparator;
 import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
 import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
 import eu.etaxonomy.taxeditor.event.EventUtility;
@@ -108,6 +110,10 @@ public abstract class AbstractBulkEditorInput<T extends CdmBase> extends CdmEnti
 
 	protected abstract T loadEntity(UUID entityUuid);
 
+	public Comparator<T> getTitleComparator(){
+	    return new TitleCacheComparator();
+	}
+
 	public void setMergeTarget(T t){
 	    markedMergeTarget = t;
 	}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/GroupEditorInput.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/GroupEditorInput.java
index 706eed8f4..ec254ab65 100644
--- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/GroupEditorInput.java
+++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/GroupEditorInput.java
@@ -10,6 +10,7 @@
 package eu.etaxonomy.taxeditor.bulkeditor.input;
 
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.List;
 import java.util.UUID;
 
@@ -24,6 +25,7 @@ import eu.etaxonomy.cdm.persistence.query.OrderHint;
 import eu.etaxonomy.cdm.persistence.query.OrderHint.SortOrder;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
 import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.GroupCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.GroupNameComparator;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
@@ -124,6 +126,12 @@ public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
 		return HibernateProxyHelper.deproxy(CdmStore.getService(IAgentService.class).load(entityUuid, propertyPaths), Group.class);
 	}
 
+	@Override
+	public Comparator<Group> getTitleComparator(){
+        return new GroupNameComparator();
+    }
+
+
 
 
 }
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java
index e00ad33f6..3bf8b5dc9 100644
--- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java
+++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java
@@ -10,6 +10,7 @@
 package eu.etaxonomy.taxeditor.bulkeditor.input;
 
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.List;
 import java.util.UUID;
 
@@ -22,6 +23,7 @@ import eu.etaxonomy.cdm.persistence.query.OrderHint;
 import eu.etaxonomy.cdm.persistence.query.OrderHint.SortOrder;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
 import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.UserCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.UserNameComparator;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
@@ -123,6 +125,12 @@ public class UserEditorInput extends AbstractBulkEditorInput<User> {
 		return CdmStore.getService(IUserService.class).load(entityUuid, propertyPaths);
 	}
 
+	@Override
+	public Comparator<User> getTitleComparator(){
+        return new UserNameComparator();
+    }
+
+
 
 
 }
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/GroupNameComparator.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/GroupNameComparator.java
new file mode 100755
index 000000000..57f710859
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/GroupNameComparator.java
@@ -0,0 +1,47 @@
+/**
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider;
+
+import java.util.Comparator;
+
+import eu.etaxonomy.cdm.model.common.Group;
+
+/**
+ * @author k.luther
+ * @since 02.07.2018
+ *
+ */
+public class GroupNameComparator implements Comparator<Group> {
+    private boolean fIgnoreCase;
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int compare(Group o1, Group o2) {
+        String groupName0 = o1.getName();
+        String groupName1 = o2.getName();
+        if (groupName0 == null && groupName1 == null) {
+            return 0;
+        }
+        if (groupName0 == null) {
+            return -1;
+        }
+        if (groupName1 == null) {
+            return 1;
+        }
+        int result =  fIgnoreCase ? groupName0.compareToIgnoreCase(groupName1) :
+            groupName0.compareTo(groupName1);
+
+        if (result == 0){
+            result = o1.getUuid().compareTo(o2.getUuid());
+        }
+        return result;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/UserNameComparator.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/UserNameComparator.java
new file mode 100755
index 000000000..ba2e8a103
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/UserNameComparator.java
@@ -0,0 +1,48 @@
+/**
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider;
+
+import java.util.Comparator;
+
+import eu.etaxonomy.cdm.model.common.User;
+
+/**
+ * @author k.luther
+ * @since 02.07.2018
+ *
+ */
+public class UserNameComparator implements Comparator<User> {
+    private boolean fIgnoreCase;
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int compare(User user0, User user1) {
+        String userName0 = user0.getUsername();
+        String userName1 = user1.getUsername();
+        if (userName0 == null && userName1 == null) {
+            return 0;
+        }
+        if (userName0 == null) {
+            return -1;
+        }
+        if (userName1 == null) {
+            return 1;
+        }
+        int result =  fIgnoreCase ? userName0.compareToIgnoreCase(userName1) :
+            userName0.compareTo(userName1);
+
+        if (result == 0){
+            result = user0.getUuid().compareTo(user1.getUuid());
+        }
+        return result;
+
+    }
+
+}
