changeset 104:8ce343218005

add wildcard for relation name in Entity.getSource/TargetRelations().
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Thu, 20 Dec 2018 19:15:45 +0100
parents 1149eb948036
children 94d354107165
files src/main/java/org/mpi/openmind/repository/bo/Entity.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/org/mpi/openmind/repository/bo/Entity.java	Wed Nov 14 18:31:55 2018 +0100
+++ b/src/main/java/org/mpi/openmind/repository/bo/Entity.java	Thu Dec 20 19:15:45 2018 +0100
@@ -177,7 +177,7 @@
     
     /**
      * Returns a list of source Relations of this Entity with the given relation name and target object class.
-     * 
+     * relationName="*" accepts all relations.
      * tarObjClass="*" accepts all target objects.
      * 
      * @param relationName
@@ -191,7 +191,7 @@
                 throw new IllegalAccessException("This Entity is lightweight, so its relations and attributes were not loaded from the DB.");
             }
             for (Relation relation : this.getSourceRelations()) {
-                if (relation.getObjectClass().equals(relationName)) {
+                if (relationName.equals("*") || relation.getObjectClass().equals(relationName)) {
                 	if (tarObjClass.equals("*") || relation.getTargetObjectClass().equals(tarObjClass)) {
                 		list.add(relation);
                     }
@@ -205,7 +205,7 @@
     
     /**
      * Returns a list of target Relations of this Entity with the given relation name and source object class.
-     * 
+     * relationName="*" accepts all relations.
      * srcObjClass="*" accepts all source objects.
      * 
      * @param relationName
@@ -219,7 +219,7 @@
                 throw new IllegalAccessException("This Entity is lightweight, so its relations and attributes were not loaded from the DB.");
             }
             for (Relation relation : this.getTargetRelations()) {
-                if (relation.getObjectClass().equals(relationName)) {
+                if (relationName.equals("*") || relation.getObjectClass().equals(relationName)) {
                 	if (srcObjClass.equals("*") || relation.getSourceObjectClass().equals(srcObjClass)) {
                 		list.add(relation);
                     }