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:
Giancarlo Panichi 2015-06-03 16:57:16 +00:00
parent df78e9c846
commit 696f36b83e
3 changed files with 24 additions and 11 deletions

View File

@ -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.CodelistMappingFileUploadSession;
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.codelisthelper.CodelistMappingSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
@ -91,9 +92,9 @@ public class SessionUtil {
ASLSession session;
if (username == null) {
logger.warn("no user found in session, use test user");
throw new TDGWTSessionExpiredException("Session Expired!");
/*throw new TDGWTSessionExpiredException("Session Expired!");*/
/*
// Remove comment for Test
username = Constants.DEFAULT_USER;
String scope = Constants.DEFAULT_SCOPE;
@ -102,7 +103,7 @@ public class SessionUtil {
session = SessionManager.getInstance().getASLSession(
httpSession.getId(), username);
session.setScope(scope);
*/
} else {
session = SessionManager.getInstance().getASLSession(
httpSession.getId(), username);

View File

@ -8735,7 +8735,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
List<ResourceDescriptor> resources = service
.getResources(tabularResourceId);
ResourceTDCreator resourceTDCreator = new ResourceTDCreator();
ResourceTDCreator resourceTDCreator = new ResourceTDCreator(aslSession);
ArrayList<ResourceTDDescriptor> resourcesTD = resourceTDCreator
.createResourcesDescriptorTD(resources);
@ -8749,6 +8749,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} catch (Throwable e) {
logger.error(
"Error retrieving resources: " + e.getLocalizedMessage(), e);
e.printStackTrace();
throw new TDGWTServiceException("Error retrieving resources: "
+ e.getLocalizedMessage());
}
@ -8783,8 +8784,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
List<ResourceDescriptor> resources = service.getResourcesByType(
tabularResourceId, resourceType);
ResourceTDCreator resourceTDCreator = new ResourceTDCreator();
ResourceTDCreator resourceTDCreator = new ResourceTDCreator(aslSession);
ArrayList<ResourceTDDescriptor> resourcesTD = resourceTDCreator
.createResourcesDescriptorTD(resources);

View File

@ -4,6 +4,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
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.model.resources.InternalURI;
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.TableResource;
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.tr.resources.InternalURITD;
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.StringResourceTD;
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.uriresolver.ApplicationType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -35,6 +39,13 @@ public class ResourceTDCreator {
protected static SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd HH:mm");
private ASLSession aslSession;
public ResourceTDCreator(ASLSession aslSession){
this.aslSession=aslSession;
}
/**
*
* @param resources
@ -93,7 +104,7 @@ public class ResourceTDCreator {
* @param resource
* @return
*/
protected ResourceTD createResourceTD(Resource resource) {
protected ResourceTD createResourceTD(Resource resource) throws TDGWTServiceException {
ResourceTD resourceTD = null;
Class<? extends Resource> resourceClass = resource.getResourceType();
@ -105,11 +116,12 @@ public class ResourceTDCreator {
ThumbnailTD thumbnailTD=null;
if(thumbnail!=null&& thumbnail.getUri()!=null){
thumbnailTD = new ThumbnailTD(thumbnail.getUri()
.toString(),thumbnail.getMimeType());
UriResolverTDClient uriResolverTDClient = new UriResolverTDClient();
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,
internalURI.getMimeType(), thumbnailTD);
} else {