Added resources management
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@100486 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a054e18059
commit
1d9129f98e
|
@ -21,6 +21,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.BackgroundOperationMonitorSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTDDescriptor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTDType;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareInfo;
|
||||
|
@ -905,4 +907,26 @@ public interface TDGWTService extends RemoteService {
|
|||
public FileUploadMonitor getFileUploadMonitor()
|
||||
throws TDGWTServiceException;
|
||||
|
||||
// Resources TD
|
||||
/**
|
||||
* Retrieves the resources of a specific tabular resource
|
||||
*
|
||||
* @param trId
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public ArrayList<ResourceTDDescriptor> getResourcesTD(TRId trId)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
* Retrieves the resources of a specific tabular resource by type
|
||||
*
|
||||
* @param trId
|
||||
* @param resourceTDType
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public ArrayList<ResourceTDDescriptor> getResourcesTDByType(TRId trId,
|
||||
ResourceTDType resourceTDType) throws TDGWTServiceException;
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.BackgroundOperationMonitorSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTDDescriptor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTDType;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareInfo;
|
||||
|
@ -331,5 +333,10 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
// File Upload Monitor
|
||||
void getFileUploadMonitor(AsyncCallback<FileUploadMonitor> callback);
|
||||
|
||||
|
||||
|
||||
//ResourceTD
|
||||
void getResourcesTD(TRId trId,AsyncCallback<ArrayList<ResourceTDDescriptor>> callback);
|
||||
void getResourcesTDByType(TRId trId, ResourceTDType reourceTDType,AsyncCallback<ArrayList<ResourceTDDescriptor>> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.gcube.data.analysis.tabulardata.commons.utils.Licence;
|
|||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.TemplateDescription;
|
||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationDefinition;
|
||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution;
|
||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.resources.ResourceDescriptor;
|
||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.tasks.ValidationDescriptor;
|
||||
import org.gcube.data.analysis.tabulardata.expression.Expression;
|
||||
import org.gcube.data.analysis.tabulardata.metadata.NoSuchMetadataException;
|
||||
|
@ -76,6 +77,7 @@ import org.gcube.data.analysis.tabulardata.model.metadata.table.ImportMetadata;
|
|||
import org.gcube.data.analysis.tabulardata.model.metadata.table.TableMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.table.VersionMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.model.relationship.ColumnRelationship;
|
||||
import org.gcube.data.analysis.tabulardata.model.resources.ResourceType;
|
||||
import org.gcube.data.analysis.tabulardata.model.table.Table;
|
||||
import org.gcube.data.analysis.tabulardata.model.table.TableId;
|
||||
import org.gcube.data.analysis.tabulardata.model.table.type.CodelistTableType;
|
||||
|
@ -129,6 +131,8 @@ import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Repl
|
|||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4SplitColumn;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Union;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecutionDirector;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.resource.ResourceTDCreator;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.resource.ResourceTDTypeMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExtractReferences;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.LicenceMap;
|
||||
|
@ -162,6 +166,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.monitor.BackgroundOperationM
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorCreator;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTDDescriptor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTDType;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
|
||||
|
@ -345,7 +351,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
@ -356,7 +362,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
SessionUtil.getAslSession(session);
|
||||
|
||||
SessionUtil.setTabResource(session,null);
|
||||
SessionUtil.setTabResource(session, null);
|
||||
SessionUtil.setTRId(session, null);
|
||||
return;
|
||||
|
||||
|
@ -371,9 +377,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
throw new TDGWTServiceException("Error retrieving TR id: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -3652,8 +3657,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
@ -3666,7 +3669,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
logger.debug("Start CSV Export");
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
|
||||
TRId trId = SessionUtil.getTRId(session);
|
||||
if (trId == null) {
|
||||
throw new TDGWTServiceException(
|
||||
|
@ -3685,8 +3688,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service, trId);
|
||||
|
||||
OpExecution4CSVExport opEx = new OpExecution4CSVExport(
|
||||
session, service, exportSession);
|
||||
OpExecution4CSVExport opEx = new OpExecution4CSVExport(session,
|
||||
service, exportSession);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
|
@ -3721,9 +3724,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
@ -3736,7 +3737,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
logger.debug("Start JSON Export");
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
|
||||
TRId trId = SessionUtil.getTRId(session);
|
||||
if (trId == null) {
|
||||
throw new TDGWTServiceException(
|
||||
|
@ -3755,8 +3756,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service, trId);
|
||||
|
||||
OpExecution4JSONExport opEx = new OpExecution4JSONExport(
|
||||
session, service, exportSession);
|
||||
OpExecution4JSONExport opEx = new OpExecution4JSONExport(session,
|
||||
service, exportSession);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
|
@ -3791,8 +3792,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO UpThis Monitor not updated
|
||||
|
||||
|
@ -3806,10 +3805,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
|
||||
SessionUtil.setChangeColumnTypeSession(session,
|
||||
changeColumnTypeSession);
|
||||
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
@ -6699,6 +6698,75 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ResourceTDDescriptor> getResourcesTD(TRId trId)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service, trId);
|
||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.parseLong(trId.getId()));
|
||||
|
||||
List<ResourceDescriptor> resources=service.getResources(tabularResourceId);
|
||||
ResourceTDCreator resourceTDCreator=new ResourceTDCreator();
|
||||
|
||||
ArrayList<ResourceTDDescriptor> resourcesTD=resourceTDCreator.createResourcesDescriptorTD(resources);
|
||||
|
||||
|
||||
|
||||
return resourcesTD;
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Security exception, you haven't rights!");
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error retrieving resources: " + e.getLocalizedMessage(),
|
||||
e);
|
||||
throw new TDGWTServiceException("Error retrieving resources: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ResourceTDDescriptor> getResourcesTDByType(TRId trId, ResourceTDType resourceTDType)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service, trId);
|
||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.parseLong(trId.getId()));
|
||||
ResourceType resourceType=ResourceTDTypeMap.getResourceType(resourceTDType);
|
||||
|
||||
List<ResourceDescriptor> resources=service.getResourcesByType(tabularResourceId,resourceType);
|
||||
ResourceTDCreator resourceTDCreator=new ResourceTDCreator();
|
||||
|
||||
ArrayList<ResourceTDDescriptor> resourcesTD=resourceTDCreator.createResourcesDescriptorTD(resources);
|
||||
|
||||
return resourcesTD;
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Security exception, you haven't rights!");
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error retrieving resources by type: " + e.getLocalizedMessage(),
|
||||
e);
|
||||
throw new TDGWTServiceException("Error retrieving resources by type: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.server.resource;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.resources.ResourceDescriptor;
|
||||
import org.gcube.data.analysis.tabulardata.model.resources.InternalURI;
|
||||
import org.gcube.data.analysis.tabulardata.model.resources.Resource;
|
||||
import org.gcube.data.analysis.tabulardata.model.resources.ResourceType;
|
||||
import org.gcube.data.analysis.tabulardata.model.resources.StringResource;
|
||||
import org.gcube.data.analysis.tabulardata.model.resources.TableResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.InternalURITD;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTD;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTDDescriptor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTDType;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.StringResourceTD;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.TableResourceTD;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ResourceTDCreator {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(ResourceTDCreator.class);
|
||||
|
||||
|
||||
protected static SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm");
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resources
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public ArrayList<ResourceTDDescriptor> createResourcesDescriptorTD(
|
||||
List<ResourceDescriptor> resources) throws TDGWTServiceException {
|
||||
ArrayList<ResourceTDDescriptor> resourcesTD = new ArrayList<ResourceTDDescriptor>();
|
||||
|
||||
for (ResourceDescriptor resourceDescriptor : resources) {
|
||||
ResourceTDDescriptor resourceTDDescriptor = null;
|
||||
long id=resourceDescriptor.getId();
|
||||
String name=resourceDescriptor.getName();
|
||||
String description=resourceDescriptor.getDescription();
|
||||
long creatorId=resourceDescriptor.getCreatorId();
|
||||
|
||||
Resource resource = resourceDescriptor.getResource();
|
||||
if (resource != null) {
|
||||
ResourceTD resourceTD = createResourceTD(resource);
|
||||
ResourceType resourceType = resourceDescriptor
|
||||
.getResourceType();
|
||||
ResourceTDType resourceTDType = ResourceTDTypeMap
|
||||
.getResourceTDType(resourceType);
|
||||
String creationDate=null;
|
||||
|
||||
try{
|
||||
creationDate=sdf.format(resourceDescriptor.getCreationDate().getTime());
|
||||
} catch(Throwable e){
|
||||
logger.error("ResourceDescription[id="+id+", name="+name+", description="+description+", creatorId="+creatorId+"] has invalid creation date!");
|
||||
|
||||
}
|
||||
resourceTDDescriptor = new ResourceTDDescriptor(id, name,
|
||||
description, creationDate, creatorId, resourceTDType,
|
||||
resourceTD);
|
||||
resourcesTD.add(resourceTDDescriptor);
|
||||
|
||||
} else {
|
||||
logger.error("ResourceDescription[id="+id+", name="+name+", description="+description+", creatorId="+creatorId+"] has resource null!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return resourcesTD;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resource
|
||||
* @return
|
||||
*/
|
||||
public ResourceTD createResourceTD(Resource resource) {
|
||||
ResourceTD resourceTD = null;
|
||||
|
||||
Class<? extends Resource> resourceClass = resource.getResourceType();
|
||||
if (resourceClass == InternalURI.class) {
|
||||
InternalURI internalURI = (InternalURI) resource;
|
||||
String uri=null;
|
||||
if(internalURI.getUri()!=null){
|
||||
uri=internalURI
|
||||
.getUri().toString();
|
||||
}
|
||||
return new InternalURITD(internalURI.getFileId(),uri);
|
||||
} else {
|
||||
if (resourceClass == StringResource.class) {
|
||||
StringResource stringResource = (StringResource) resource;
|
||||
return new StringResourceTD(stringResource.getStringValue());
|
||||
} else {
|
||||
if (resourceClass == TableResource.class) {
|
||||
TableResource tableResource = (TableResource) resource;
|
||||
return new TableResourceTD(tableResource.getTableId()
|
||||
.getValue(), tableResource.getStringValue());
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resourceTD;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.server.resource;
|
||||
|
||||
import org.gcube.data.analysis.tabulardata.model.resources.ResourceType;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTDType;
|
||||
|
||||
public class ResourceTDTypeMap {
|
||||
|
||||
public static ResourceTDType getResourceTDType(ResourceType resourceType) {
|
||||
|
||||
switch (resourceType) {
|
||||
case CHART:
|
||||
return ResourceTDType.CHART;
|
||||
case CODELIST:
|
||||
return ResourceTDType.CODELIST;
|
||||
case CSV:
|
||||
return ResourceTDType.CSV;
|
||||
case GUESSER:
|
||||
return ResourceTDType.GUESSER;
|
||||
case JSON:
|
||||
return ResourceTDType.JSON;
|
||||
case MAP:
|
||||
return ResourceTDType.MAP;
|
||||
case SDMX:
|
||||
return ResourceTDType.SDMX;
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ResourceType getResourceType(ResourceTDType resourceTDType) {
|
||||
|
||||
switch (resourceTDType) {
|
||||
case CHART:
|
||||
return ResourceType.CHART;
|
||||
case CODELIST:
|
||||
return ResourceType.CODELIST;
|
||||
case CSV:
|
||||
return ResourceType.CSV;
|
||||
case GUESSER:
|
||||
return ResourceType.GUESSER;
|
||||
case JSON:
|
||||
return ResourceType.JSON;
|
||||
case MAP:
|
||||
return ResourceType.MAP;
|
||||
case SDMX:
|
||||
return ResourceType.SDMX;
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,7 +2,7 @@ package org.gcube.portlets.user.td.gwtservice.shared.codelisthelper;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTD;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.resource.ResourceTDDescriptor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.source.Source;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
|
@ -14,7 +14,7 @@ public class CodelistMappingSession implements Serializable {
|
|||
|
||||
protected TRId trId;
|
||||
protected Source source;
|
||||
protected ResourceTD resourceTD;
|
||||
protected ResourceTDDescriptor resourceTD;
|
||||
protected String url;
|
||||
protected String localFileName;
|
||||
protected String itemId;
|
||||
|
@ -61,11 +61,11 @@ public class CodelistMappingSession implements Serializable {
|
|||
this.url = url;
|
||||
}
|
||||
|
||||
public ResourceTD getResourceTD() {
|
||||
public ResourceTDDescriptor getResourceTD() {
|
||||
return resourceTD;
|
||||
}
|
||||
|
||||
public void setResourceTD(ResourceTD resourceTD) {
|
||||
public void setResourceTD(ResourceTDDescriptor resourceTD) {
|
||||
this.resourceTD = resourceTD;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.resource;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class InternalURITD extends ResourceTD {
|
||||
private static final long serialVersionUID = -3230438212164027113L;
|
||||
|
||||
private String fileId;
|
||||
|
||||
private String uri;
|
||||
|
||||
public InternalURITD() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fileId
|
||||
* @param uri
|
||||
*/
|
||||
public InternalURITD(String fileId, String uri) {
|
||||
super(uri);
|
||||
this.fileId = fileId;
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStringValue() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public String getFileId() {
|
||||
return fileId;
|
||||
}
|
||||
|
||||
public void setFileId(String fileId) {
|
||||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InternalURITD [fileId=" + fileId + ", uri=" + uri + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -4,44 +4,39 @@ import java.io.Serializable;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ResourceTD implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6324769323093791963L;
|
||||
protected String name;
|
||||
protected String description;
|
||||
|
||||
private String stringValue;
|
||||
|
||||
public ResourceTD() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param stringValue
|
||||
*/
|
||||
public ResourceTD(String stringValue) {
|
||||
super();
|
||||
this.stringValue = stringValue;
|
||||
}
|
||||
|
||||
public ResourceTD(String name, String description) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
|
||||
|
||||
public String getStringValue() {
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResourceTD [name=" + name + ", description=" + description
|
||||
+ "]";
|
||||
return "ResourceTD [stringValue=" + stringValue + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.resource;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ResourceTDDescriptor implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6324769323093791963L;
|
||||
private long id;
|
||||
private String name;
|
||||
private String description;
|
||||
private String creationDate;
|
||||
private long creatorId;
|
||||
private ResourceTDType resourceType;
|
||||
private ResourceTD resourceTD;
|
||||
|
||||
public ResourceTDDescriptor() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param name
|
||||
* @param description
|
||||
* @param creationDate
|
||||
* @param creatorId
|
||||
* @param resourceType
|
||||
* @param resourceTD
|
||||
*/
|
||||
public ResourceTDDescriptor(long id, String name, String description,
|
||||
String creationDate, long creatorId, ResourceTDType resourceType,
|
||||
ResourceTD resourceTD) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.creationDate = creationDate;
|
||||
this.creatorId = creatorId;
|
||||
this.resourceType = resourceType;
|
||||
this.resourceTD = resourceTD;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCreationDate() {
|
||||
return creationDate;
|
||||
}
|
||||
|
||||
public void setCreationDate(String creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
}
|
||||
|
||||
public long getCreatorId() {
|
||||
return creatorId;
|
||||
}
|
||||
|
||||
public void setCreatorId(long creatorId) {
|
||||
this.creatorId = creatorId;
|
||||
}
|
||||
|
||||
public ResourceTDType getResourceType() {
|
||||
return resourceType;
|
||||
}
|
||||
|
||||
public void setResourceType(ResourceTDType resourceType) {
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
|
||||
public ResourceTD getResourceTD() {
|
||||
return resourceTD;
|
||||
}
|
||||
|
||||
public void setResourceTD(ResourceTD resourceTD) {
|
||||
this.resourceTD = resourceTD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResourceDescriptorTD [id=" + id + ", name=" + name
|
||||
+ ", description=" + description + ", creationDate="
|
||||
+ creationDate + ", creatorId=" + creatorId + ", resourceType="
|
||||
+ resourceType + ", resourceTD=" + resourceTD + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.resource;
|
||||
|
||||
public enum ResourceTDType {
|
||||
|
||||
CHART("Chart"), GUESSER("Guesser"), MAP("Map"), CODELIST("Codelist"), CSV(
|
||||
"CSV"), SDMX("SDMX"), JSON("JSON");
|
||||
|
||||
/**
|
||||
* @param text
|
||||
*/
|
||||
private ResourceTDType(final String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
private final String id;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.resource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class StringResourceTD extends ResourceTD {
|
||||
|
||||
private static final long serialVersionUID = 7172340185053019104L;
|
||||
|
||||
private String value;
|
||||
|
||||
public StringResourceTD() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
public StringResourceTD(String value) {
|
||||
super(value);
|
||||
this.value = value;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStringValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StringResourceTD [value=" + value + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.resource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TableResourceTD extends ResourceTD {
|
||||
private static final long serialVersionUID = -3230438212164027113L;
|
||||
|
||||
private long tableId;
|
||||
private String tableStringValue;
|
||||
|
||||
public TableResourceTD() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fileId
|
||||
* @param uri
|
||||
*/
|
||||
public TableResourceTD(long tableId, String tableStringValue) {
|
||||
super(tableStringValue);
|
||||
this.tableId = tableId;
|
||||
this.tableStringValue = tableStringValue;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStringValue() {
|
||||
return tableStringValue;
|
||||
}
|
||||
|
||||
public long getTableId() {
|
||||
return tableId;
|
||||
}
|
||||
|
||||
public void setTableId(long tableId) {
|
||||
this.tableId = tableId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TableResourceTD [tableId=" + tableId + ", tableStringValue="
|
||||
+ tableStringValue + "]";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue