fixing code
This commit is contained in:
parent
acc9108ffb
commit
6d970281a4
|
@ -5,8 +5,10 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
|
||||
import org.gcube.informationsystem.types.reference.Type;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.resource.CacheList;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.resource.UtilityResource;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
|
@ -36,15 +38,15 @@ public class RegistryClientRequester {
|
|||
|
||||
ScopeProvider.instance.set(scope);
|
||||
try {
|
||||
List<TypeDefinition> typeDefinitions = resourceRegistryClient.getSchema(Resource.class, true);
|
||||
for (TypeDefinition td : typeDefinitions) {
|
||||
List<Type> types = resourceRegistryClient.getType(Resource.class, true);
|
||||
for (Type t : types) {
|
||||
|
||||
if (td.getName().equals("EService"))
|
||||
retval.put("RunningInstance", UtilityResource.getSubResourcesTreeQuery(td.getName(),scope));
|
||||
if (td.getName().equals("Configuration"))
|
||||
retval.put("GenericResource", UtilityResource.getSubResourcesTreeQuery(td.getName(),scope));
|
||||
if (td.getName().equals("HostingNode"))
|
||||
retval.put("GHN", UtilityResource.getSubResourcesTreeQuery(td.getName(),scope));
|
||||
if (t.getName().equals("EService"))
|
||||
retval.put("RunningInstance", UtilityResource.getSubResourcesTreeQuery(t.getName(),scope));
|
||||
if (t.getName().equals("Configuration"))
|
||||
retval.put("GenericResource", UtilityResource.getSubResourcesTreeQuery(t.getName(),scope));
|
||||
if (t.getName().equals("HostingNode"))
|
||||
retval.put("GHN", UtilityResource.getSubResourcesTreeQuery(t.getName(),scope));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.gcube.informationsystem.model.reference.entities.Resource;
|
|||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
|
||||
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.AccessPointFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.NetworkingFacet;
|
||||
|
@ -25,6 +26,7 @@ import org.gcube.resourcemanagement.model.reference.entities.resources.EService;
|
|||
import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNode;
|
||||
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 com.google.gwt.thirdparty.json.JSONArray;
|
||||
import com.google.gwt.thirdparty.json.JSONObject;
|
||||
|
@ -42,11 +44,15 @@ public class UtilityResource {
|
|||
|
||||
public static ArrayList<String> getSubResourcesTree(String entity, String scope) throws Exception{
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
List<Resource> resources = (List<Resource>) resourceRegistryClient.getInstances(entity, true);
|
||||
String s = resourceRegistryClient.getInstances(entity, true);
|
||||
|
||||
for (Resource et : resources) {
|
||||
List<? extends Facet> facets = et.getIdentificationFacets();
|
||||
for (Facet f : facets) {
|
||||
List<Resource> resources = ElementMapper.unmarshalList(Resource.class, s);
|
||||
|
||||
for (Resource r : resources) {
|
||||
List<? extends IsIdentifiedBy> iibs = r.getConsistsOf(IsIdentifiedBy.class);
|
||||
for (IsIdentifiedBy iib : iibs) {
|
||||
|
||||
Facet f = (Facet) iib.getTarget();
|
||||
|
||||
switch (entity) {
|
||||
/*
|
||||
|
@ -352,7 +358,7 @@ public class UtilityResource {
|
|||
String status="";
|
||||
String ghnName="";
|
||||
|
||||
List<EService> eservices = (List<EService>) resourceRegistryClient.getInstances(EService.NAME,false);
|
||||
List<EService> eservices = (List<EService>) resourceRegistryClient.getInstances(EService.class,false);
|
||||
for (EService et : eservices) {
|
||||
id=et.getHeader().getUUID().toString();
|
||||
List<? extends Facet> facets = et.getIdentificationFacets();
|
||||
|
@ -382,8 +388,8 @@ public class UtilityResource {
|
|||
ghnName="";
|
||||
}
|
||||
}
|
||||
if (c.getTarget() instanceof ServiceStateFacet){
|
||||
ServiceStateFacet stf = (ServiceStateFacet) c.getTarget();
|
||||
if (c.getTarget() instanceof StateFacet){
|
||||
StateFacet stf = (StateFacet) c.getTarget();
|
||||
try {
|
||||
status=stf.getValue().toLowerCase();
|
||||
}
|
||||
|
@ -436,7 +442,7 @@ public class UtilityResource {
|
|||
String subType="";
|
||||
String name="";
|
||||
String description="";
|
||||
List<Configuration> econfiguration = (List<Configuration>) resourceRegistryClient.getInstances(Configuration.NAME,false);
|
||||
List<Configuration> econfiguration = (List<Configuration>) resourceRegistryClient.getInstances(Configuration.class,false);
|
||||
for (Configuration et : econfiguration) {
|
||||
id=et.getHeader().getUUID().toString();
|
||||
List<? extends Facet> facets = et.getIdentificationFacets();
|
||||
|
@ -505,7 +511,7 @@ public class UtilityResource {
|
|||
String gcfVersion="";
|
||||
String ghnVersion="";
|
||||
|
||||
List<HostingNode> ehosting = (List<HostingNode>) resourceRegistryClient.getInstances(HostingNode.NAME,false);
|
||||
List<HostingNode> ehosting = (List<HostingNode>) resourceRegistryClient.getInstances(HostingNode.class,false);
|
||||
for (HostingNode eh : ehosting) {
|
||||
id=eh.getHeader().getUUID().toString();
|
||||
lastUpdate=eh.getHeader().getLastUpdateTime().toString();
|
||||
|
|
Loading…
Reference in New Issue