summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulina Jankowska <paulinkaj1@gmail.com>2013-09-06 07:55:01 (GMT)
committer Paulina Jankowska <paulinkaj1@gmail.com>2013-09-06 07:55:01 (GMT)
commitbf269fdd5b4f1a06387bc8a9181412cba57f3d0e (patch)
tree58ab373559ade9ca00549fbbeb29c58486830173
parent8e0cf27ec64f503d18ca5c43213f020be6f59a7c (diff)
downloadQCG-Data-bf269fdd5b4f1a06387bc8a9181412cba57f3d0e.zip
QCG-Data-bf269fdd5b4f1a06387bc8a9181412cba57f3d0e.tar.gz
QCG-Data-bf269fdd5b4f1a06387bc8a9181412cba57f3d0e.tar.bz2
Numeric operators without >, it is possible to enter numeric values idrop-web
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy26
1 files changed, 25 insertions, 1 deletions
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy
index 68a20fb..30b8807 100644
--- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy
@@ -130,8 +130,15 @@ class MetadataSearchController {
List<AVUQueryElement> metadataQuery = new ArrayList<AVUQueryElement>()
for(AVUCommand avu in avuNode.AVUs){
+
metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.ATTRIBUTE, AVUQueryOperatorEnum.EQUAL, avu.attribute));
- metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.VALUE, chooseOperator(avu.operator), avu.value));
+ if((avu.value).isNumber() && avu.operator in ["<", "<=", ">="]) //">"
+ {
+ metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.VALUE, chooseNumOperator(avu.operator), avu.value));
+ } else {
+ metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.VALUE, chooseOperator(avu.operator), avu.value));
+ }
+
if(!avu.unit.empty){
metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.UNITS, AVUQueryOperatorEnum.EQUAL, avu.unit));
}
@@ -204,6 +211,23 @@ class MetadataSearchController {
break
}
}
+
+ def chooseNumOperator(String op) {
+ switch(op) {
+ /*case ">":
+ AVUQueryOperatorEnum.NUM_GREATER_THAN;
+ break*/
+ case "<":
+ AVUQueryOperatorEnum.NUM_LESS_THAN;
+ break
+ case ">=":
+ AVUQueryOperatorEnum.NUM_GREATER_OR_EQUAL;
+ break
+ case "<=":
+ AVUQueryOperatorEnum.NUM_LESS_OR_EQUAL;
+ break
+ }
+ }
}