changeset 114:70a02006675c

New clean actions to delete lost floruit_dates and empty references.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Mon, 26 Aug 2019 16:10:14 +0200
parents 8dc4ac635d11
children 42d5588d11b6
files src/main/java/org/mpi/openmind/repository/services/PersistenceService.java src/main/java/org/mpi/openmind/repository/services/utils/AttributeFilter.java src/main/java/org/mpi/openmind/repository/services/utils/Filter.java
diffstat 3 files changed, 23 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/org/mpi/openmind/repository/services/PersistenceService.java	Wed Aug 21 14:25:42 2019 +0200
+++ b/src/main/java/org/mpi/openmind/repository/services/PersistenceService.java	Mon Aug 26 16:10:14 2019 +0200
@@ -1246,10 +1246,8 @@
 			for (AttributeFilter filter : filters) {
 				hql += " ( ";
 				if (StringUtils.isNotEmpty(filter.getEntObjectClass())) {
-					hql += "att.sourceObjectClass = :sourceObjectClass" + count
-							+ " ";
-					if (StringUtils.isNotEmpty(filter.getName())
-							|| StringUtils.isNotEmpty(filter.getOwnValue()))
+					hql += "att.sourceObjectClass = :sourceObjectClass" + count + " ";
+					if (StringUtils.isNotEmpty(filter.getName()) || StringUtils.isNotEmpty(filter.getOwnValue()))
 						hql += " AND ";
 				}
 				if (StringUtils.isNotEmpty(filter.getName())) {
@@ -1258,15 +1256,15 @@
 						hql += " AND ";
 				}
 				if (StringUtils.isNotEmpty(filter.getOwnValue())) {
-                    if (filter.isNormalize()) {
-                        hql += "att.normalizedOwnValue LIKE :ownValue" + count + " ";
-                    } else if (filter.isRegex()) {
-                        hql += "REGEXP(att.ownValue, :ownValue" + count + ") = 1 ";
-                    } else if (filter.isExactMatch()) {
-                        hql += "att.ownValue = :ownValue" + count + " ";
-                    } else {
-                        hql += "att.ownValue LIKE :ownValue" + count + " ";
-                    }
+					if (filter.isNormalize()) {
+						hql += "att.normalizedOwnValue LIKE :ownValue" + count + " ";
+					} else if (filter.isRegex()) {
+						hql += "REGEXP(att.ownValue, :ownValue" + count + ") = 1 ";
+					} else if (filter.isExactMatch()) {
+						hql += "att.ownValue = :ownValue" + count + " ";
+					} else {
+						hql += "att.ownValue LIKE :ownValue" + count + " ";
+					}
 				}
 
 				hql += " ) ";
--- a/src/main/java/org/mpi/openmind/repository/services/utils/AttributeFilter.java	Wed Aug 21 14:25:42 2019 +0200
+++ b/src/main/java/org/mpi/openmind/repository/services/utils/AttributeFilter.java	Mon Aug 26 16:10:14 2019 +0200
@@ -6,8 +6,14 @@
  * @author jurzua
  */
 public class AttributeFilter extends Filter {
-    private String name;
-    private String entObjectClass;
+    public String name;
+    public String entObjectClass;
+
+	/**
+	 * match if the relation is not present.
+	 */
+	public Boolean attributeMissing = false;
+
     public AttributeFilter(){}
     
     public AttributeFilter(String name, String value, String entObjectClass){
--- a/src/main/java/org/mpi/openmind/repository/services/utils/Filter.java	Wed Aug 21 14:25:42 2019 +0200
+++ b/src/main/java/org/mpi/openmind/repository/services/utils/Filter.java	Mon Aug 26 16:10:14 2019 +0200
@@ -6,10 +6,10 @@
  */
 public abstract class Filter {
 	
-    protected String ownValue;
-    protected boolean normalize = false;
-    protected boolean isRegex = false;
-    protected boolean exactMatch = false;
+    public String ownValue;
+    public boolean normalize = false;
+    public boolean isRegex = false;
+    public boolean exactMatch = false;
 
     public boolean isNormalize() {
         return normalize;