# HG changeset patch # User casties # Date 1483990735 -3600 # Node ID 9d342e713c2f38a32e31d3477a9baf1d5e1a6b86 # Parent 58659e8652792bac4ae79fddbe6244c2f00b2233 make RelationSortByTargetOW work with empty own-values. nicer comments. diff -r 58659e865279 -r 9d342e713c2f src/main/java/org/mpi/openmind/repository/bo/Attribute.java --- a/src/main/java/org/mpi/openmind/repository/bo/Attribute.java Fri Jan 06 16:57:01 2017 +0100 +++ b/src/main/java/org/mpi/openmind/repository/bo/Attribute.java Mon Jan 09 20:38:55 2017 +0100 @@ -110,8 +110,15 @@ setOwnValue(value); } - public Attribute(String label, String contentType, String value) { - this.setObjectClass(label); + /** + * Create an Attribute with the given object_class, content_type and own_value. + * + * @param oc + * @param contentType + * @param value + */ + public Attribute(String oc, String contentType, String value) { + this.setObjectClass(oc); this.setContentType(contentType); this.setOwnValue(value); } diff -r 58659e865279 -r 9d342e713c2f src/main/java/org/mpi/openmind/repository/bo/utils/RelationSortByTargetOW.java --- a/src/main/java/org/mpi/openmind/repository/bo/utils/RelationSortByTargetOW.java Fri Jan 06 16:57:01 2017 +0100 +++ b/src/main/java/org/mpi/openmind/repository/bo/utils/RelationSortByTargetOW.java Mon Jan 09 20:38:55 2017 +0100 @@ -10,7 +10,15 @@ if(r1.getTarget() != null && r2.getTarget() != null){ String r1OW = r1.getTarget().getOwnValue(); String r2OW = r2.getTarget().getOwnValue(); - return r1OW.compareTo(r2OW); + if (r1OW == null) { + if (r2OW == null) { + return 0; + } else { + return -1; + } + } else { + return r1OW.compareTo(r2OW); + } }else if(r1.getTarget() == null){ return -1; }else if(r2.getTarget() == null){