From ea14059285631f75ed2940e0abc78f844792be99 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 24 Oct 2014 15:51:58 +0000 Subject: [PATCH] Updated Flows git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@100978 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 6 +++--- .../user/td/gwtservice/server/TDGWTServiceImpl.java | 10 ++++++++-- .../server/trservice/TabularResourceTypeMap.java | 12 +++++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.classpath b/.classpath index a3624c7..1cb1398 100644 --- a/.classpath +++ b/.classpath @@ -1,12 +1,12 @@ - + - + @@ -33,5 +33,5 @@ - + diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java index 55e43c9..2fb9afc 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java @@ -1515,6 +1515,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements if (viewTable == null) { logger.debug("ViewTable is null"); newTRId = new TRId(trId.getId()); + newTRId.setTabResourceType(trId.getTabResourceType()); newTRId.setTableTypeName(trId.getTableTypeName()); newTRId.setTableId(String.valueOf(table.getId().getValue())); newTRId.setTableType(table.getTableType().getName()); @@ -1576,6 +1577,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } else { logger.debug("ViewTable is not null"); newTRId = new TRId(trId.getId()); + newTRId.setTabResourceType(trId.getTabResourceType()); newTRId.setTableTypeName(trId.getTableTypeName()); newTRId.setTableId(String.valueOf(viewTable.getId().getValue())); newTRId.setTableType(viewTable.getTableType().getName()); @@ -1689,6 +1691,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements if (viewTable == null) { logger.debug("ViewTable is null"); TRId newTRId = new TRId(trId.getId()); + newTRId.setTabResourceType(trId.getTabResourceType()); newTRId.setTableTypeName(trId.getTableTypeName()); newTRId.setTableId(String.valueOf(table.getId().getValue())); newTRId.setTableType(table.getTableType().getName()); @@ -1750,6 +1753,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } else { logger.debug("ViewTable is not null"); TRId newTRId = new TRId(trId.getId()); + newTRId.setTabResourceType(trId.getTabResourceType()); newTRId.setTableTypeName(trId.getTableTypeName()); newTRId.setTableId(String.valueOf(viewTable.getId().getValue())); newTRId.setTableType(viewTable.getTableType().getName()); @@ -1937,6 +1941,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements /** * Retrieves the informations for a specific Tabular Resource from service + * without table id (fast) * * @param tr * TabularResource on service @@ -1951,8 +1956,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements try { TabResource t = new TabResource(); TRId trId = new TRId(String.valueOf(tr.getId().getValue())); + trId.setTabResourceType(TabularResourceTypeMap.map(tr.getTabularResourceType())); trId.setTableTypeName(tr.getTableType()); - t.setId(String.valueOf(i)); t.setTrId(trId); t.setValid(tr.isValid()); @@ -2111,6 +2116,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } /** + * Retrieves codelists without table id (fast) * * {@inheritDoc} */ @@ -2544,7 +2550,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } /** - * + * Retrieves tabular resource without table id (fast) * * {@inheritDoc} */ diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/TabularResourceTypeMap.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/TabularResourceTypeMap.java index 79a15b1..d0c55bf 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/TabularResourceTypeMap.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/TabularResourceTypeMap.java @@ -2,6 +2,8 @@ package org.gcube.portlets.user.td.gwtservice.server.trservice; import org.gcube.data.analysis.tabulardata.commons.webservice.types.TabularResourceType; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TabResourceType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -10,7 +12,15 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TabResourceType; * */ public class TabularResourceTypeMap { - public static TabResourceType map(TabularResourceType tabularResourceType) { + private static Logger logger = LoggerFactory + .getLogger(TabularResourceTypeMap.class); + + public static TabResourceType map(TabularResourceType tabularResourceType) { + if(tabularResourceType==null){ + logger.error("Tabular Resource Type is null"); + return TabResourceType.UNKNOWN; + } + switch (tabularResourceType) { case FLOW: return TabResourceType.FLOW;