git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerCore@96836 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a68ed9e98b
commit
d9f9b205d1
|
@ -5,8 +5,10 @@ import java.io.StringReader;
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
@ -170,13 +172,12 @@ public class GenericResource implements GenericResourceInfoI {
|
||||||
logger.debug("Remote Exception:" + e.toString());
|
logger.debug("Remote Exception:" + e.toString());
|
||||||
}
|
}
|
||||||
//remove from all collections set, the opensearch ones !
|
//remove from all collections set, the opensearch ones !
|
||||||
for(String key : pairs.keySet()){
|
Iterator<Map.Entry<String,org.gcube.common.resources.gcore.GenericResource>> iter = pairs.entrySet().iterator();
|
||||||
org.gcube.common.resources.gcore.GenericResource collection = pairs.get(key);
|
while (iter.hasNext()) {
|
||||||
|
org.gcube.common.resources.gcore.GenericResource collection = iter.next().getValue();
|
||||||
Element body = collection.profile().body();
|
Element body = collection.profile().body();
|
||||||
if(body.getElementsByTagName("type").getLength()==0)
|
if(body.getElementsByTagName("type").getLength()>0) //means opensearch collection
|
||||||
pairs.remove(key);
|
iter.remove();
|
||||||
else
|
|
||||||
logger.debug("Found tree collection: "+key);
|
|
||||||
}
|
}
|
||||||
logger.debug("# of Tree Collections found: "+ pairs.size());
|
logger.debug("# of Tree Collections found: "+ pairs.size());
|
||||||
return pairs;
|
return pairs;
|
||||||
|
@ -195,16 +196,24 @@ public class GenericResource implements GenericResourceInfoI {
|
||||||
query = queryFor(org.gcube.common.resources.gcore.GenericResource.class);
|
query = queryFor(org.gcube.common.resources.gcore.GenericResource.class);
|
||||||
// query.addCondition("$resource/Profile/SecondaryType eq 'GCUBECollection'");
|
// query.addCondition("$resource/Profile/SecondaryType eq 'GCUBECollection'");
|
||||||
query.addCondition("$resource/Profile/SecondaryType eq 'DataSource'"); //changed from GCUBECollection to DataSource (2 be same as the tree collections)
|
query.addCondition("$resource/Profile/SecondaryType eq 'DataSource'"); //changed from GCUBECollection to DataSource (2 be same as the tree collections)
|
||||||
query.addCondition("$resource/Profile/Body/SourceProperties/type eq 'opensearch'");
|
// query.addCondition("$resource/Profile/Body/SourceProperties/type eq 'opensearch'");
|
||||||
if(onlyUserCollections)
|
if(onlyUserCollections)
|
||||||
query.addCondition("$resource/Profile/Body/CollectionInfo/user eq 'true'");
|
query.addCondition("$resource/Profile/Body/CollectionInfo/user eq 'true'");
|
||||||
List<org.gcube.common.resources.gcore.GenericResource> results = client.submit(query);
|
List<org.gcube.common.resources.gcore.GenericResource> results = client.submit(query);
|
||||||
if (results == null || results.size() == 0)
|
if (results == null || results.size() == 0)
|
||||||
logger.debug("Couldn't find any OpenSearch collections within that scope! Will return empty list.");
|
logger.debug("Couldn't find any OpenSearch collections within that scope! Will return empty list.");
|
||||||
else
|
|
||||||
logger.debug("# of OpenSearch Collections found: "+ results.size());
|
|
||||||
for (org.gcube.common.resources.gcore.GenericResource gr : results)
|
for (org.gcube.common.resources.gcore.GenericResource gr : results)
|
||||||
pairs.put(gr.id(), gr);
|
pairs.put(gr.id(), gr);
|
||||||
|
//remove from all collections set, the tree collection ones !
|
||||||
|
|
||||||
|
Iterator<Map.Entry<String,org.gcube.common.resources.gcore.GenericResource>> iter = pairs.entrySet().iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
org.gcube.common.resources.gcore.GenericResource collection = iter.next().getValue();
|
||||||
|
Element body = collection.profile().body();
|
||||||
|
if(body.getElementsByTagName("type").getLength()==0)
|
||||||
|
iter.remove();
|
||||||
|
}
|
||||||
|
logger.debug("# of Opensearch Collections found: "+ pairs.size());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.debug("Remote Exception:" + e.toString());
|
logger.debug("Remote Exception:" + e.toString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue