Fixed facet type used how identity

This commit is contained in:
Giancarlo Panichi 2022-12-21 14:03:22 +01:00
parent 4e27d2fc0b
commit ff5d706554
3 changed files with 53 additions and 52 deletions

View File

@ -195,7 +195,6 @@ public class RegistryClientRequester {
for (String k : list) {
sortedretval.put(k, retval.get(k));
}
return sortedretval;
}
@ -203,12 +202,12 @@ public class RegistryClientRequester {
// list string (xml formatted) for table
public static final List<String> getResourcesByTypeSubType(String scope, String type, String subType)
throws Exception {
// CacheList.resourceid.clear();
ScopeProvider.instance.set(scope);
AccessTokenProvider.instance.set(getTokenForContext(scope));
try {
logger.info("GetResourcesByTypeSubType: [Scope:{}, Type:{}]", scope, type);
logger.info("GetResourcesByTypeSubType: [Scope: {}, Type: {}, SubType: {}]",new String[]{ scope, type, subType });
resourceRegistryClient = ResourceRegistryClientFactory.create();
List<String> resources = new ArrayList<String>();

View File

@ -22,12 +22,10 @@ import java.io.File;
import java.io.StringReader;
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import java.util.stream.Collectors;
import javax.servlet.http.HttpSession;
import javax.xml.parsers.DocumentBuilder;
@ -39,7 +37,6 @@ import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.portlets.admin.resourcemanagement.client.remote.ServiceProxy;
import org.gcube.portlets.admin.resourcemanagement.server.gcube.services.StatusHandler;
import org.gcube.portlets.admin.resourcemanagement.server.gcube.services.configuration.ConfigurationLoader;
import org.gcube.portlets.admin.resourcemanagement.shared.resource.UtilityResource;
import org.gcube.portlets.admin.resourcemanagement.shared.utils.BCrypt;
import org.gcube.resourcemanagement.support.client.utils.CurrentStatus;
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
@ -65,6 +62,8 @@ import org.gcube.resourcemanagement.support.shared.util.Configuration;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.impl.QueryTemplate;
import org.gcube.vremanagement.resourcemanager.client.RMReportingLibrary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
@ -78,6 +77,9 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
*/
@SuppressWarnings("serial")
public class ServiceProxyImpl extends RemoteServiceServlet implements ServiceProxy {
private static Logger logger = LoggerFactory.getLogger(ServiceProxyImpl.class);
private static final String LOG_PREFIX = "[SERVICE-IMPL]";
public final void emptyCache() {
@ -287,7 +289,7 @@ 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"
logger.info("get result type tree: ("+results.size()+") /n"
+ results.keySet() );
@ -303,7 +305,7 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
public final List<String> getResourcesByType(final String scope, final String type)
{
try {
System.out.println("---------------->getResourcesByType");
logger.info("---------------->getResourcesByType: [Scope: {}, type: {}]",scope,type);
List<String> request=RegistryClientRequester.getResourcesByTypeSubType(scope, type,null);
return request;
@ -319,7 +321,7 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
private ResourceDescriptor getDescriptor(final ScopeBean scope, final String resID) throws Exception {
System.out.println("---------------->getDescriptor");
logger.info("---------------->getDescriptor");
//set the scope
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope.toString());
@ -403,7 +405,7 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
public final List<String> getResourcesBySubType(final String scope, final String type, final String subType) {
try {
System.out.println("---------------->getResourcesBySubType type:"+type+ "- subtype:"+subType);
logger.info("---------------->getResourcesBySubType: [type: {}, subtype: {}]",type,subType);
//Old code
//List<String> request=ISClientRequester.getResourcesByType(getCacheManager(this.getCurrentStatus()), new ScopeBean(scope), type, subType);
@ -422,18 +424,18 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
try {
ScopeBean gscope = new ScopeBean(scope);
System.out.println("---------------->getResourceByID scope:"+scope+" type:"+type+" resID:"+resID);
System.out.println("---------------->getResourceByID this.getXML2HTMLMapping():"+this.getXML2HTMLMapping());
logger.info("---------------->getResourceByID scope:"+scope+" type:"+type+" resID:"+resID);
logger.info("---------------->getResourceByID this.getXML2HTMLMapping():"+this.getXML2HTMLMapping());
//OLD CODE
//CompleteResourceProfile profile = ISClientRequester.getResourceByID(this.getXML2HTMLMapping(), new ScopeBean(scope), type, resID);
//NEW CODE
CompleteResourceProfile profile = RegistryClientRequester.getResourceByID(this.getXML2HTMLMapping(), scope, type, resID);
System.out.println("****\n\n\n CompleteResourceProfile getResourceByID(final String scope, final String type, final String resID) *****");
System.out.println("****CompleteResourceProfile getResourceByID("+scope+","+type+","+resID+") *****\n\n");
logger.info("****\n\n\n CompleteResourceProfile getResourceByID(final String scope, final String type, final String resID) *****");
logger.info("****CompleteResourceProfile getResourceByID("+scope+","+type+","+resID+") *****\n\n");
System.out.println("---------------->getResourceByID profile:"+profile.toString());
logger.info("---------------->getResourceByID profile:"+profile.toString());
return profile;
} catch (Exception e) {

View File

@ -123,20 +123,20 @@ public class UtilityResource {
break;
case "Dataset":
if (f instanceof SoftwareFacet) {
logger.info("------------Dataset--SoftwareFacet");
SoftwareFacet sf = (SoftwareFacet) f;
if (!list.contains(sf.getGroup())) {
list.add(sf.getGroup());
if (f instanceof IdentifierFacet) {
logger.info("------------Dataset--IdentifierFacet");
IdentifierFacet sf = (IdentifierFacet) f;
if (!list.contains(sf.getType().toString())) {
list.add(sf.getType().toString());
}
}
break;
case "ConcreteDataset":
if (f instanceof SoftwareFacet) {
logger.info("------------ConcreteDataset--SoftwareFacet");
SoftwareFacet sf = (SoftwareFacet) f;
if (!list.contains(sf.getGroup())) {
list.add(sf.getGroup());
if (f instanceof IdentifierFacet) {
logger.info("------------ConcreteDataset--IdentifierFacet");
IdentifierFacet sf = (IdentifierFacet) f;
if (!list.contains(sf.getType().toString())) {
list.add(sf.getType().toString());
}
}
break;
@ -188,11 +188,11 @@ public class UtilityResource {
}
break;
case "Site":
if (f instanceof SoftwareFacet) {
logger.info("------------Site--SoftwareFacet");
SoftwareFacet sf = (SoftwareFacet) f;
if (!list.contains(sf.getGroup()))
list.add(sf.getGroup());
if (f instanceof IdentifierFacet) {
logger.info("------------Site--IdentifierFacet");
IdentifierFacet sf = (IdentifierFacet) f;
if (!list.contains(sf.getType().toString()))
list.add(sf.getType().toString());
}
break;
@ -253,12 +253,12 @@ public class UtilityResource {
identifiedFacet = "IdentifierFacet";
break;
case "Dataset":
field = "group";
identifiedFacet = "SoftwareFacet";
field = "type";
identifiedFacet = "IdentifierFacet";
break;
case "ConcreteDataset":
field = "group";
identifiedFacet = "SoftwareFacet";
field = "type";
identifiedFacet = "IdentifierFacet";
break;
case "Schema":
field = "name";
@ -281,8 +281,8 @@ public class UtilityResource {
identifiedFacet = "SoftwareFacet";
break;
case "Site":
field = "group";
identifiedFacet = "SoftwareFacet";
field = "type";
identifiedFacet = "IdentifierFacet";
break;
case "Software":
field = "group";
@ -521,7 +521,7 @@ public class UtilityResource {
String name = "";
String description = "";
List<ConfigurationTemplate> configurationTemplates = (List<ConfigurationTemplate>) resourceRegistryClient
.getInstances(ConfigurationTemplate.class, false);
.getInstances(ConfigurationTemplate.class, true);
if (configurationTemplates != null) {
logger.info("ConfigurationTemplate found: {}", configurationTemplates.size());
} else {
@ -654,13 +654,13 @@ public class UtilityResource {
List<? extends Facet> facets = dataset.getIdentificationFacets();
for (Facet f : facets) {
if (f instanceof SoftwareFacet) {
SoftwareFacet sf = (SoftwareFacet) f;
if (f instanceof IdentifierFacet) {
IdentifierFacet sf = (IdentifierFacet) f;
// version = sf.getVersion();
serviceName = sf.getName();
serviceClass = sf.getGroup();
subType = sf.getGroup();
serviceName = sf.getValue();
serviceClass = sf.getType().toString();
subType = sf.getType().toString();
}
}
CacheList.resourceid.put(id, new ResourceObject(serviceName, dataset.toString()));
@ -711,13 +711,13 @@ public class UtilityResource {
List<? extends Facet> facets = concreteDataset.getIdentificationFacets();
for (Facet f : facets) {
if (f instanceof SoftwareFacet) {
SoftwareFacet sf = (SoftwareFacet) f;
if (f instanceof IdentifierFacet) {
IdentifierFacet sf = (IdentifierFacet) f;
// version = sf.getVersion();
serviceName = sf.getName();
serviceClass = sf.getGroup();
subType = sf.getGroup();
serviceName = sf.getValue();
serviceClass = sf.getType().toString();
subType = sf.getType().toString();
}
}
CacheList.resourceid.put(id, new ResourceObject(serviceName, concreteDataset.toString()));
@ -1142,13 +1142,13 @@ public class UtilityResource {
List<? extends Facet> facets = site.getIdentificationFacets();
for (Facet f : facets) {
if (f instanceof SoftwareFacet) {
SoftwareFacet sf = (SoftwareFacet) f;
if (f instanceof IdentifierFacet) {
IdentifierFacet sf = (IdentifierFacet) f;
// version = sf.getVersion();
serviceName = sf.getName();
serviceClass = sf.getGroup();
subType = sf.getGroup();
serviceName = sf.getValue();
serviceClass = sf.getType().toString();
subType = sf.getType().toString();
}
}
CacheList.resourceid.put(id, new ResourceObject(serviceName, site.toString()));