Updated save of resources
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@114498 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
bb27dd3754
commit
dfd2fb86e5
|
@ -294,6 +294,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnViewD
|
|||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.PeriodDataType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.RelationshipData;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ValueDataFormat;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.uriresolver.ApplicationType;
|
||||
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
|
@ -9041,15 +9042,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
resolver = new UriResolverManager(uriResolverSession
|
||||
.getApplicationType().toString());
|
||||
params.put("smp-uri", uriResolverSession.getUuid());
|
||||
if(uriResolverSession.getFileName()==null){
|
||||
if (uriResolverSession.getFileName() == null) {
|
||||
params.put("fileName", "");
|
||||
} else {
|
||||
params.put("fileName", uriResolverSession.getFileName());
|
||||
}
|
||||
if(uriResolverSession.getMimeType()==null){
|
||||
if (uriResolverSession.getMimeType() == null) {
|
||||
params.put("contentType", "");
|
||||
} else {
|
||||
params.put("contentType", uriResolverSession.getMimeType());
|
||||
params.put("contentType", uriResolverSession.getMimeType());
|
||||
}
|
||||
logger.debug("Uri Resolver params: " + params);
|
||||
link = resolver.getLink(params, true); // true, link is shorted
|
||||
|
@ -9059,22 +9060,21 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
resolver = new UriResolverManager(uriResolverSession
|
||||
.getApplicationType().toString());
|
||||
params.put("smp-id", uriResolverSession.getUuid());
|
||||
if(uriResolverSession.getFileName()==null){
|
||||
if (uriResolverSession.getFileName() == null) {
|
||||
params.put("fileName", "");
|
||||
} else {
|
||||
params.put("fileName", uriResolverSession.getFileName());
|
||||
}
|
||||
if(uriResolverSession.getMimeType()==null){
|
||||
if (uriResolverSession.getMimeType() == null) {
|
||||
params.put("contentType", "");
|
||||
} else {
|
||||
params.put("contentType", uriResolverSession.getMimeType());
|
||||
params.put("contentType", uriResolverSession.getMimeType());
|
||||
}
|
||||
logger.debug("Uri Resolver params: " + params);
|
||||
link = resolver.getLink(params, true); // true, link is shorted
|
||||
// otherwise none
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
logger.debug("No resolver enable on this application type");
|
||||
throw new TDGWTServiceException(
|
||||
|
@ -9186,16 +9186,67 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
mimeType = mimeTypeSupport.getMimeName();
|
||||
}
|
||||
|
||||
ResourceTD resource = saveResourceSession.getResourceTDDescriptor()
|
||||
.getResourceTD();
|
||||
String uri = null;
|
||||
ResourceTDDescriptor resourceTDDescriptor = saveResourceSession
|
||||
.getResourceTDDescriptor();
|
||||
|
||||
ResourceTDType resourceTDType = resourceTDDescriptor
|
||||
.getResourceType();
|
||||
|
||||
if (resourceTDType == null) {
|
||||
logger.error("Unknow resource type: null");
|
||||
throw new TDGWTServiceException("Resource has type null!");
|
||||
}
|
||||
|
||||
ApplicationType applicationType = null;
|
||||
|
||||
switch (resourceTDType) {
|
||||
case CHART:
|
||||
applicationType = ApplicationType.SMP_ID;
|
||||
break;
|
||||
case CODELIST:
|
||||
applicationType = ApplicationType.SMP_ID;
|
||||
break;
|
||||
case CSV:
|
||||
applicationType = ApplicationType.SMP_ID;
|
||||
break;
|
||||
case GENERIC_FILE:
|
||||
applicationType = ApplicationType.SMP_ID;
|
||||
break;
|
||||
case GENERIC_TABLE:
|
||||
applicationType = ApplicationType.SMP_ID;
|
||||
break;
|
||||
case GUESSER:
|
||||
applicationType = ApplicationType.SMP_ID;
|
||||
break;
|
||||
case JSON:
|
||||
applicationType = ApplicationType.SMP_ID;
|
||||
break;
|
||||
case MAP:
|
||||
applicationType = ApplicationType.GIS;
|
||||
break;
|
||||
case SDMX:
|
||||
applicationType = ApplicationType.SMP_ID;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
ResourceTD resource = resourceTDDescriptor.getResourceTD();
|
||||
UriResolverSession uriResolverSession;
|
||||
if (resource instanceof StringResourceTD) {
|
||||
StringResourceTD stringResourceTD = (StringResourceTD) resource;
|
||||
uri = stringResourceTD.getStringValue();
|
||||
String uri = stringResourceTD.getStringValue();
|
||||
uriResolverSession = new UriResolverSession(uri,
|
||||
applicationType);
|
||||
} else {
|
||||
if (resource instanceof InternalURITD) {
|
||||
InternalURITD internalURITD = (InternalURITD) resource;
|
||||
uri = internalURITD.getUrl();
|
||||
uriResolverSession = new UriResolverSession(
|
||||
internalURITD.getUrl(), applicationType,
|
||||
resourceTDDescriptor.getName(),
|
||||
internalURITD.getMimeType());
|
||||
mimeType=internalURITD.getMimeType();
|
||||
} else {
|
||||
if (resource instanceof TableResourceTD) {
|
||||
throw new TDGWTServiceException(
|
||||
|
@ -9208,18 +9259,20 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
}
|
||||
|
||||
if (uri == null || uri.isEmpty()) {
|
||||
String link = getUriFromResolver(uriResolverSession);
|
||||
|
||||
if (link == null || link.isEmpty()) {
|
||||
throw new TDGWTServiceException(
|
||||
"This resource does not have valid uri: " + uri);
|
||||
"This resource does not have valid link: " + link);
|
||||
}
|
||||
logger.debug("Create Item On Workspace: [uri=" + uri + " ,user: "
|
||||
logger.debug("Create Item On Workspace: [uri=" + link + " ,user: "
|
||||
+ aslSession.getUsername() + " ,fileName: "
|
||||
+ saveResourceSession.getFileName() + " ,fileDescription: "
|
||||
+ saveResourceSession.getFileDescription() + " ,mimetype:"
|
||||
+ mimeType + " ,folder: " + saveResourceSession.getItemId()
|
||||
+ "]");
|
||||
|
||||
storage.createItemOnWorkspace(uri, aslSession.getUsername(),
|
||||
storage.createItemOnWorkspace(link, aslSession.getUsername(),
|
||||
saveResourceSession.getFileName(),
|
||||
saveResourceSession.getFileDescription(), mimeType,
|
||||
saveResourceSession.getItemId());
|
||||
|
|
Loading…
Reference in New Issue