ref 9056:TabMan - Improve resource management in TabMan

https://support.d4science.org/issues/9056

Improve resources management

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@150915 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-07-07 13:45:35 +00:00
parent 840e07ee3a
commit a4f31ec3e6
5 changed files with 34 additions and 63 deletions

View File

@ -12,7 +12,6 @@ import org.gcube.data.analysis.tabulardata.model.resources.SDMXResource;
import org.gcube.data.analysis.tabulardata.model.resources.StringResource;
import org.gcube.data.analysis.tabulardata.model.resources.TableResource;
import org.gcube.data.analysis.tabulardata.model.resources.Thumbnail;
import org.gcube.data.analysis.tabulardata.model.resources.WebResource;
import org.gcube.portlets.user.td.gwtservice.server.uriresolver.UriResolverTDClient;
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
@ -23,7 +22,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.SDMXResourceTD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.StringResourceTD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.TableResourceTD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.WebResourceTD;
import org.gcube.portlets.user.td.gwtservice.shared.uriresolver.UriResolverSession;
import org.gcube.portlets.user.td.widgetcommonevent.shared.thumbnail.ThumbnailTD;
import org.gcube.portlets.user.td.widgetcommonevent.shared.uriresolver.ApplicationType;
@ -120,17 +118,11 @@ public class ResourceTDCreator {
SDMXResource sdmxResource = (SDMXResource) resource;
SDMXResourceTD sdmxResourceTD = new SDMXResourceTD(sdmxResource.getName(),
sdmxResource.getAgency(), sdmxResource.getPrimaryMeasure(),
sdmxResource.getStringValue(), sdmxResource.getType().name(),
sdmxResource.getVersion());
sdmxResource.getResourceURL().toString(),sdmxResource.getRegistryURL().toString(), sdmxResource.getStringValue(),
sdmxResource.getType().name(), sdmxResource.getVersion());
return sdmxResourceTD;
} else {
if (resourceClass == WebResource.class) {
WebResource webResource = (WebResource) resource;
WebResourceTD webResourceTD = new WebResourceTD(webResource.getStringValue());
return webResourceTD;
} else {
}
}
}
}

View File

@ -29,8 +29,6 @@ public class ResourceTypeMap {
return ResourceType.MAP;
case SDMX:
return ResourceType.SDMX;
case WEB:
return ResourceType.WEB;
case GENERIC_FILE:
return ResourceType.GENERIC_FILE;
case GENERIC_TABLE:
@ -56,8 +54,6 @@ public class ResourceTypeMap {
return ResourceTDType.MAP;
case SDMX:
return ResourceTDType.SDMX;
case WEB:
return ResourceTDType.WEB;
case GENERIC_FILE:
return ResourceTDType.GENERIC_FILE;
case GENERIC_TABLE:

View File

@ -8,7 +8,7 @@ package org.gcube.portlets.user.td.gwtservice.shared.tr.resources;
*/
public enum ResourceTDType {
CHART("Chart"), GUESSER("Guesser"), MAP("Map"), CODELIST("Codelist"), CSV("CSV"), SDMX("SDMX"), WEB("WEB"), JSON(
CHART("Chart"), GUESSER("Guesser"), MAP("Map"), CODELIST("Codelist"), CSV("CSV"), SDMX("SDMX"), JSON(
"JSON"), GENERIC_FILE("Generic File"), GENERIC_TABLE("Generic Table");
private ResourceTDType(final String id) {

View File

@ -7,26 +7,31 @@ package org.gcube.portlets.user.td.gwtservice.shared.tr.resources;
*
*/
public class SDMXResourceTD extends ResourceTD {
private static final long serialVersionUID = -3075957767979840537L;
private String name;
private String agency;
private String primaryMeasure;
private String resourceUrl;
private String registryUrl;
private String type;
private String version;
public SDMXResourceTD() {
super();
}
public SDMXResourceTD(String name, String agency, String primaryMeasure, String stringValue, String type, String version) {
public SDMXResourceTD(String name, String agency, String primaryMeasure, String resourceUrl, String registryUrl,
String stringValue, String type, String version) {
super(stringValue);
this.name =name;
this.name = name;
this.agency = agency;
this.primaryMeasure = primaryMeasure;
this.type=type;
this.version=version;
this.resourceUrl = resourceUrl;
this.registryUrl = registryUrl;
this.type = type;
this.version = version;
}
public String getName() {
@ -53,6 +58,22 @@ public class SDMXResourceTD extends ResourceTD {
this.primaryMeasure = primaryMeasure;
}
public String getResourceUrl() {
return resourceUrl;
}
public void setResourceUrl(String resourceUrl) {
this.resourceUrl = resourceUrl;
}
public String getRegistryUrl() {
return registryUrl;
}
public void setRegistryUrl(String registryUrl) {
this.registryUrl = registryUrl;
}
public String getType() {
return type;
}
@ -71,10 +92,9 @@ public class SDMXResourceTD extends ResourceTD {
@Override
public String toString() {
return "SDMXResourceTD [name=" + name + ", agency=" + agency + ", primaryMeasure=" + primaryMeasure + ", type="
+ type + ", version=" + version + ", getStringValue()=" + getStringValue() + "]";
return "SDMXResourceTD [name=" + name + ", agency=" + agency + ", primaryMeasure=" + primaryMeasure
+ ", resourceUrl=" + resourceUrl + ", registryUrl=" + registryUrl + ", type=" + type + ", version="
+ version + "]";
}
}

View File

@ -1,37 +0,0 @@
package org.gcube.portlets.user.td.gwtservice.shared.tr.resources;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class WebResourceTD extends ResourceTD {
private static final long serialVersionUID = 8895032679636897620L;
private String value;
public WebResourceTD() {
super();
}
public WebResourceTD(String value) {
super(value);
this.value = value;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
@Override
public String toString() {
return "WebResourceTD [value=" + value + ", getStringValue()=" + getStringValue() + "]";
}
}