implement IS_SET and IS_NOT_SET operator according to new spec
diff --git a/org.eclipse.rmf.reqif10.search/src/org/eclipse/rmf/reqif10/search/filter/AbstractAttributeFilter.java b/org.eclipse.rmf.reqif10.search/src/org/eclipse/rmf/reqif10/search/filter/AbstractAttributeFilter.java
index a9b73af..b4f15dd 100644
--- a/org.eclipse.rmf.reqif10.search/src/org/eclipse/rmf/reqif10/search/filter/AbstractAttributeFilter.java
+++ b/org.eclipse.rmf.reqif10.search/src/org/eclipse/rmf/reqif10/search/filter/AbstractAttributeFilter.java
@@ -12,6 +12,7 @@
package org.eclipse.rmf.reqif10.search.filter;
import org.eclipse.rmf.reqif10.AttributeDefinition;
+import org.eclipse.rmf.reqif10.AttributeValue;
import org.eclipse.rmf.reqif10.SpecElementWithAttributes;
import org.eclipse.rmf.reqif10.common.util.ReqIF10Util;
@@ -38,9 +39,9 @@
if (getAttribute() instanceof AttributeDefinition){
switch (getOperator()) {
case IS_SET:
- return isSetAttribute(element, (AttributeDefinition) getAttribute());
- case IS_NOT_SET:
- return !isSetAttribute(element, (AttributeDefinition) getAttribute());
+ return isSetAttribute(element, (AttributeDefinition) getAttribute()) && hasNonNullValue(element) ;
+ case IS_NOT_SET:
+ return isSetAttribute(element, (AttributeDefinition) getAttribute()) && !hasNonNullValue(element);
default:
throw new IllegalArgumentException(
"This filter does not support the " + getOperator()
@@ -68,6 +69,19 @@
}
+ private boolean hasNonNullValue(SpecElementWithAttributes element){
+ AttributeValue attributeValue = ReqIF10Util.getAttributeValue(element, (AttributeDefinition) getAttribute());
+ if (attributeValue == null){
+ return false;
+ }
+ Object theValue = ReqIF10Util.getTheValue(attributeValue);
+ if (theValue == null){
+ return false;
+ }
+ return true;
+ }
+
+
/**
* Filters that can be applied to internalAttributes have to implement this