summaryrefslogtreecommitdiffstats
path: root/idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy')
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/MetadataSearchController.groovy18
1 files changed, 12 insertions, 6 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 17cc84d..68a20fb 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
@@ -47,6 +47,7 @@ class MetadataSearchController {
/**
* Search iRODS metadata
+ * Here the data from inputs is posted.
*/
def search (MetadataSearchCommand metadataSearchCommand) {
@@ -88,7 +89,7 @@ class MetadataSearchController {
render(view:"/search/searchResult", model:[results:results])
}
-
+ //method used to finding files as well as folders matching every metadata query, final result is the sum of these results
private def connectedByAnd(AVUNode avuNode, DataObjectAO dataObjAO, CollectionAO collectionAO) {
List<MetaDataAndDomainData> queryRes1 = collectionAO.findMetadataValuesByMetadataQuery(createAVUQ(avuNode), true) //match folders names
List<MetaDataAndDomainData> queryRes2 = dataObjAO.findMetadataValuesByMetadataQuery(createAVUQ(avuNode)) //match dataObj names
@@ -97,6 +98,7 @@ class MetadataSearchController {
queryResults
}
+ //method used to finding files as well as folders matching AT LEAST ONE metadata query
private def connectedByOr(AVUNode avuNode, DataObjectAO dataObjAO, CollectionAO collectionAO) {
List<AVUQueryElement> metadataQuery = new ArrayList<AVUQueryElement>()
List<MetaDataAndDomainData> finalResult = new ArrayList<MetaDataAndDomainData>()
@@ -104,7 +106,7 @@ class MetadataSearchController {
List<MetaDataAndDomainData> queryRes2 = new ArrayList<MetaDataAndDomainData>()
List<MetaDataAndDomainData> queryResults = new ArrayList<MetaDataAndDomainData>()
- for(AVUCommand avu in avuNode.AVUs){
+ for(AVUCommand avu in avuNode.AVUs) {
metadataQuery.clear()
metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.ATTRIBUTE, AVUQueryOperatorEnum.EQUAL, avu.attribute));
metadataQuery.add(AVUQueryElement.instanceForValueQuery(AVUQueryPart.VALUE, chooseOperator(avu.operator), avu.value));
@@ -123,7 +125,7 @@ class MetadataSearchController {
}
- def createAVUQ(AVUNode avuNode) {
+ def createAVUQ(AVUNode avuNode) { //create list of metadata queries
List<AVUQueryElement> metadataQuery = new ArrayList<AVUQueryElement>()
@@ -154,6 +156,8 @@ class MetadataSearchController {
list2
}
+
+ //create list in which there are files and collections occured in both input lists
private def intersectLists(List<MetaDataAndDomainData> list1, List<MetaDataAndDomainData> list2) {
List<MetaDataAndDomainData> finalList = new ArrayList<MetaDataAndDomainData>()
@@ -204,18 +208,19 @@ class MetadataSearchController {
}
-
-class MetadataSearchCommand { //constists of the condition nodes and operators connecting them
+//Class which constists of the list of condition nodes and list of operators connecting them
+class MetadataSearchCommand {
List <AVUNode> AVUNodes = ListUtils.lazyList([], FactoryUtils.instantiateFactory(AVUNode))
List <String> AVUOps = ListUtils.lazyList([], FactoryUtils.instantiateFactory(String))
}
+//class consisted of AVU + operator
class AVUCommand {
String attribute
String operator //=, <, >, <=, >=, <>, like, not like
String value
- String unit //unused
+ String unit
static constraints = {
attribute(blank:false)
@@ -224,6 +229,7 @@ class AVUCommand {
}
+//Class consisted of list of conditions and the option (in GUI radiobutton), decripted below
class AVUNode {
List <AVUCommand> AVUs = ListUtils.lazyList([], FactoryUtils.instantiateFactory(AVUCommand))
String andOr //every condition fulfilled or at least one