Mercurial > hg > openmind
changeset 63:9d342e713c2f
make RelationSortByTargetOW work with empty own-values. nicer comments.
author | casties |
---|---|
date | Mon, 09 Jan 2017 20:38:55 +0100 |
parents | 58659e865279 |
children | 83b209aa4226 |
files | src/main/java/org/mpi/openmind/repository/bo/Attribute.java src/main/java/org/mpi/openmind/repository/bo/utils/RelationSortByTargetOW.java |
diffstat | 2 files changed, 18 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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); }
--- 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){