updated
This commit is contained in:
parent
5e85a182ac
commit
771e5dda9c
9
pom.xml
9
pom.xml
|
@ -72,7 +72,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>3.6.4-SNAPSHOT</version>
|
||||
<version>3.7.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -276,6 +276,13 @@
|
|||
<version>3.1.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.json/json -->
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20220320</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -6,18 +6,13 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
||||
import org.gcube.common.keycloak.KeycloakClient;
|
||||
import org.gcube.common.keycloak.KeycloakClientFactory;
|
||||
import org.gcube.common.keycloak.model.AccessToken.Access;
|
||||
import org.gcube.common.keycloak.model.ModelUtils;
|
||||
import org.gcube.common.keycloak.model.TokenResponse;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.informationsystem.contexts.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.resourceregistry.api.contexts.ContextCache;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
|
||||
|
@ -107,15 +102,17 @@ public class RegistryClientRequester {
|
|||
val = "GenericResource";
|
||||
if (t.getName().equals("HostingNode"))
|
||||
val = "GHN";
|
||||
try {
|
||||
|
||||
if (val!=null) {
|
||||
ArrayList<String> subtrees = UtilityResource.getSubResourcesTreeQuery(resourceRegistryClient, t.getName());
|
||||
if (!subtrees.isEmpty())
|
||||
retval.put(val, subtrees);
|
||||
}
|
||||
ArrayList<String> subtrees = new ArrayList<String>();
|
||||
try {
|
||||
subtrees = UtilityResource.getSubResourcesTreeQuery(resourceRegistryClient, t.getName());
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
retval.put(val, subtrees);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -287,6 +287,10 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
|
|||
|
||||
HashMap<String, ArrayList<String>> results = RegistryClientRequester.getResourcesTree(scope);
|
||||
|
||||
System.out.println("get result type tree: ("+results.size()+") /n"
|
||||
+ results.keySet() );
|
||||
|
||||
|
||||
return results;
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, "applying resource get", e);
|
||||
|
|
|
@ -38,9 +38,9 @@ import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNo
|
|||
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasPersistentMemory;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasVolatileMemory;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.google.gwt.thirdparty.json.JSONArray;
|
||||
import com.google.gwt.thirdparty.json.JSONObject;
|
||||
|
||||
|
||||
|
||||
|
@ -135,19 +135,25 @@ public class UtilityResource {
|
|||
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
String query="SELECT DISTINCT("+field+") AS "+field+" "
|
||||
+ "FROM (TRAVERSE outE('IsIdentifiedBy'),inV('"+identifiedFacet+"') FROM "+entity+")";
|
||||
|
||||
System.out.println("------------query----------->"+query);
|
||||
|
||||
String result=resourceRegistryClient.rawQuery(query, 1000, null);
|
||||
|
||||
if (!result.isEmpty()) {
|
||||
JSONObject jsonObj = new JSONObject(result);
|
||||
JSONArray jsonArray=jsonObj.getJSONArray("result");
|
||||
|
||||
for(int i=0;i < jsonArray.length();i++){
|
||||
list.add(jsonArray.getJSONObject(i).getString(field));
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue