updated
This commit is contained in:
parent
5e85a182ac
commit
771e5dda9c
13
pom.xml
13
pom.xml
|
@ -24,7 +24,7 @@
|
|||
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</developerConnection>
|
||||
<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
|
||||
</scm>
|
||||
<properties>
|
||||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.7.0</gwtVersion>
|
||||
<liferay.version>6.2.5</liferay.version>
|
||||
|
@ -39,7 +39,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>localRun</id>
|
||||
|
@ -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);
|
||||
|
||||
if (val!=null) {
|
||||
ArrayList<String> subtrees = new ArrayList<String>();
|
||||
try {
|
||||
subtrees = UtilityResource.getSubResourcesTreeQuery(resourceRegistryClient, t.getName());
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}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;
|
||||
|
||||
|
||||
|
||||
|
@ -50,8 +50,8 @@ import com.google.gwt.thirdparty.json.JSONObject;
|
|||
*
|
||||
*/
|
||||
public class UtilityResource {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static ArrayList<String> getSubResourcesTree(ResourceRegistryClient resourceRegistryClient, String entity, String scope) throws Exception{
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
@ -132,21 +132,27 @@ public class UtilityResource {
|
|||
|
||||
default:
|
||||
return new ArrayList<>(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
String query="SELECT DISTINCT("+field+") AS "+field+" "
|
||||
+ "FROM (TRAVERSE outE('IsIdentifiedBy'),inV('"+identifiedFacet+"') FROM "+entity+")";
|
||||
|
||||
System.out.println("------------query----------->"+query);
|
||||
try {
|
||||
String query="SELECT DISTINCT("+field+") AS "+field+" "
|
||||
+ "FROM (TRAVERSE outE('IsIdentifiedBy'),inV('"+identifiedFacet+"') FROM "+entity+")";
|
||||
|
||||
String result=resourceRegistryClient.rawQuery(query, 1000, null);
|
||||
JSONObject jsonObj = new JSONObject(result);
|
||||
JSONArray jsonArray=jsonObj.getJSONArray("result");
|
||||
System.out.println("------------query----------->"+query);
|
||||
|
||||
for(int i=0;i < jsonArray.length();i++){
|
||||
list.add(jsonArray.getJSONObject(i).getString(field));
|
||||
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