209: TDM - Show the resources through a ListView widget
Task-Url: https://support.d4science.org/issues/209 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@115200 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
df78e9c846
commit
696f36b83e
|
@ -17,6 +17,7 @@ import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession;
|
import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession;
|
import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager;
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.chart.ChartTopRatingSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.chart.ChartTopRatingSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
||||||
|
@ -91,9 +92,9 @@ public class SessionUtil {
|
||||||
ASLSession session;
|
ASLSession session;
|
||||||
if (username == null) {
|
if (username == null) {
|
||||||
logger.warn("no user found in session, use test user");
|
logger.warn("no user found in session, use test user");
|
||||||
throw new TDGWTSessionExpiredException("Session Expired!");
|
/*throw new TDGWTSessionExpiredException("Session Expired!");*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
// Remove comment for Test
|
// Remove comment for Test
|
||||||
username = Constants.DEFAULT_USER;
|
username = Constants.DEFAULT_USER;
|
||||||
String scope = Constants.DEFAULT_SCOPE;
|
String scope = Constants.DEFAULT_SCOPE;
|
||||||
|
@ -102,7 +103,7 @@ public class SessionUtil {
|
||||||
session = SessionManager.getInstance().getASLSession(
|
session = SessionManager.getInstance().getASLSession(
|
||||||
httpSession.getId(), username);
|
httpSession.getId(), username);
|
||||||
session.setScope(scope);
|
session.setScope(scope);
|
||||||
*/
|
|
||||||
} else {
|
} else {
|
||||||
session = SessionManager.getInstance().getASLSession(
|
session = SessionManager.getInstance().getASLSession(
|
||||||
httpSession.getId(), username);
|
httpSession.getId(), username);
|
||||||
|
|
|
@ -8735,7 +8735,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
List<ResourceDescriptor> resources = service
|
List<ResourceDescriptor> resources = service
|
||||||
.getResources(tabularResourceId);
|
.getResources(tabularResourceId);
|
||||||
ResourceTDCreator resourceTDCreator = new ResourceTDCreator();
|
ResourceTDCreator resourceTDCreator = new ResourceTDCreator(aslSession);
|
||||||
|
|
||||||
ArrayList<ResourceTDDescriptor> resourcesTD = resourceTDCreator
|
ArrayList<ResourceTDDescriptor> resourcesTD = resourceTDCreator
|
||||||
.createResourcesDescriptorTD(resources);
|
.createResourcesDescriptorTD(resources);
|
||||||
|
@ -8749,6 +8749,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error(
|
logger.error(
|
||||||
"Error retrieving resources: " + e.getLocalizedMessage(), e);
|
"Error retrieving resources: " + e.getLocalizedMessage(), e);
|
||||||
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException("Error retrieving resources: "
|
throw new TDGWTServiceException("Error retrieving resources: "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
@ -8783,8 +8784,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
List<ResourceDescriptor> resources = service.getResourcesByType(
|
List<ResourceDescriptor> resources = service.getResourcesByType(
|
||||||
tabularResourceId, resourceType);
|
tabularResourceId, resourceType);
|
||||||
ResourceTDCreator resourceTDCreator = new ResourceTDCreator();
|
ResourceTDCreator resourceTDCreator = new ResourceTDCreator(aslSession);
|
||||||
|
|
||||||
ArrayList<ResourceTDDescriptor> resourcesTD = resourceTDCreator
|
ArrayList<ResourceTDDescriptor> resourcesTD = resourceTDCreator
|
||||||
.createResourcesDescriptorTD(resources);
|
.createResourcesDescriptorTD(resources);
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
import org.gcube.data.analysis.tabulardata.commons.webservice.types.resources.ResourceDescriptor;
|
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.InternalURI;
|
||||||
import org.gcube.data.analysis.tabulardata.model.resources.Resource;
|
import org.gcube.data.analysis.tabulardata.model.resources.Resource;
|
||||||
|
@ -11,6 +12,7 @@ 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.StringResource;
|
||||||
import org.gcube.data.analysis.tabulardata.model.resources.TableResource;
|
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.Thumbnail;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.server.uriresolver.UriResolverTDClient;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.InternalURITD;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.InternalURITD;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTD;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTD;
|
||||||
|
@ -18,7 +20,9 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescr
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.StringResourceTD;
|
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.TableResourceTD;
|
||||||
|
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.thumbnail.ThumbnailTD;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.uriresolver.ApplicationType;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -35,6 +39,13 @@ public class ResourceTDCreator {
|
||||||
protected static SimpleDateFormat sdf = new SimpleDateFormat(
|
protected static SimpleDateFormat sdf = new SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm");
|
"yyyy-MM-dd HH:mm");
|
||||||
|
|
||||||
|
private ASLSession aslSession;
|
||||||
|
|
||||||
|
|
||||||
|
public ResourceTDCreator(ASLSession aslSession){
|
||||||
|
this.aslSession=aslSession;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param resources
|
* @param resources
|
||||||
|
@ -93,7 +104,7 @@ public class ResourceTDCreator {
|
||||||
* @param resource
|
* @param resource
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected ResourceTD createResourceTD(Resource resource) {
|
protected ResourceTD createResourceTD(Resource resource) throws TDGWTServiceException {
|
||||||
ResourceTD resourceTD = null;
|
ResourceTD resourceTD = null;
|
||||||
|
|
||||||
Class<? extends Resource> resourceClass = resource.getResourceType();
|
Class<? extends Resource> resourceClass = resource.getResourceType();
|
||||||
|
@ -105,11 +116,12 @@ public class ResourceTDCreator {
|
||||||
|
|
||||||
ThumbnailTD thumbnailTD=null;
|
ThumbnailTD thumbnailTD=null;
|
||||||
if(thumbnail!=null&& thumbnail.getUri()!=null){
|
if(thumbnail!=null&& thumbnail.getUri()!=null){
|
||||||
thumbnailTD = new ThumbnailTD(thumbnail.getUri()
|
UriResolverTDClient uriResolverTDClient = new UriResolverTDClient();
|
||||||
.toString(),thumbnail.getMimeType());
|
UriResolverSession uriResolverSession=new UriResolverSession(thumbnail.getUri().toString(), ApplicationType.SMP_ID, null, thumbnail.getMimeType());
|
||||||
|
String link = uriResolverTDClient.resolve(uriResolverSession, aslSession);
|
||||||
|
thumbnailTD = new ThumbnailTD(link,thumbnail.getMimeType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new InternalURITD(id,
|
return new InternalURITD(id,
|
||||||
internalURI.getMimeType(), thumbnailTD);
|
internalURI.getMimeType(), thumbnailTD);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue