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 ca65b88..1b1caab 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 @@ -230,9 +230,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } logger.debug("GetTabResourceInformation():" + currentTR.toString()); - TRId trId = retrieveTabularResourceType(currentTR.getTrId()); - currentTR.setTrId(trId); - ArrayList trMetadatas = getTRMetadata(currentTR .getTrId()); updateTabResourceInformation(currentTR, trMetadatas); @@ -265,8 +262,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements // ASLSession aslSession = SessionUtil.getAslSession(session); logger.debug("GetTabResourceInformation(TRId):" + trId.toString()); TabResource currentTR = new TabResource(); - trId = retrieveTabularResourceType(trId); - currentTR.setTrId(trId); + ArrayList trMetadatas = getTRMetadata(currentTR .getTrId()); updateTabResourceInformation(currentTR, trMetadatas); @@ -1397,7 +1393,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * @return * @throws TDGWTServiceException */ - protected TRId retrieveTabularResourceType(TRId trId) + protected TRId retrieveTabularResourceBasicData(TRId trId) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -1409,7 +1405,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements TabularResourceId tabularResourceId = new TabularResourceId( new Long(trId.getId())); TabularResource tr = service.getTabularResource(tabularResourceId); - trId.setTableType(tr.getTableType()); + Table table=service.getLastTable(tabularResourceId); + + trId.setTabularResourceType(tr.getTableType()); + trId.setTableId(String.valueOf(table.getId().getValue())); + trId.setTableType(table.getTableType().getName()); + logger.debug("Retrieved TRId type:" + trId.toString()); return trId; @@ -1458,11 +1459,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements case SUCCEDED: importMonitor.setProgress(task.getProgress()); logger.debug("Task Result: " + task.getResult()); - table = task.getResult().getPrimaryTable(); + /*table = task.getResult().getPrimaryTable(); trId.setTableId(String.valueOf(table.getId() .getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); sdmxImportTabResource.setTrId(trId); SessionUtil.setSDMXImportTabResource(session, @@ -1487,11 +1488,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements case STOPPED: importMonitor.setProgress(task.getProgress()); logger.debug("Task Result: " + task.getResult()); - table = task.getResult().getPrimaryTable(); + /*table = task.getResult().getPrimaryTable(); trId.setTableId(String.valueOf(table.getId() .getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); sdmxImportTabResource.setTrId(trId); SessionUtil.setSDMXImportTabResource(session, @@ -1874,12 +1875,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements case SUCCEDED: logger.debug("Task Result: " + task.getResult()); importMonitor.setProgress(task.getProgress()); - table = task.getResult().getPrimaryTable(); + /*table = task.getResult().getPrimaryTable(); logger.debug("Table retrived: " + table.toString()); trId.setTableId(String.valueOf(table.getId() .getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); csvImportTabResource.setTrId(trId); SessionUtil.setCSVImportTabResource(session, @@ -3123,10 +3124,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements trId = new TRId(); trId.setId(changeColumnTypeSession.getColumnData() .getTrId().getId()); - trId.setTableId(String + /*trId.setTableId(String .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); changeColumnTypeMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -3148,10 +3149,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements trId = new TRId(); trId.setId(changeColumnTypeSession.getColumnData() .getTrId().getId()); - trId.setTableId(String + /*trId.setTableId(String .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); changeColumnTypeMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -3271,10 +3272,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements trId = new TRId(); trId.setId(deleteColumnSession.getColumnData() .getTrId().getId()); - trId.setTableId(String + /*trId.setTableId(String .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); deleteColumnMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -3298,10 +3299,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements trId = new TRId(); trId.setId(deleteColumnSession.getColumnData() .getTrId().getId()); - trId.setTableId(String + /*trId.setTableId(String .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); deleteColumnMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -3422,10 +3423,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements trId = new TRId(); trId.setId(labelColumnSession.getColumnData().getTrId() .getId()); - trId.setTableId(String + /*trId.setTableId(String .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); labelColumnMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -3449,10 +3450,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements trId = new TRId(); trId.setId(labelColumnSession.getColumnData().getTrId() .getId()); - trId.setTableId(String + /*trId.setTableId(String .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); labelColumnMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -3574,10 +3575,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Table retrived: " + table.toString()); trId = new TRId(); trId.setId(changeTableTypeSession.getTrId().getId()); - trId.setTableId(String + /*trId.setTableId(String .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); changeTableTypeMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -3600,10 +3601,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Table retrived: " + table.toString()); trId = new TRId(); trId.setId(changeTableTypeSession.getTrId().getId()); - trId.setTableId(String + /*trId.setTableId(String .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); changeTableTypeMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -3899,10 +3900,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Table retrived: " + table.toString()); trId = new TRId(); trId.setId(deleteRowsSession.getTrId().getId()); - trId.setTableId(String - .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + + retrieveTabularResourceBasicData(trId); deleteRowsMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -3925,10 +3924,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Table retrived: " + table.toString()); trId = new TRId(); trId.setId(deleteRowsSession.getTrId().getId()); - trId.setTableId(String + /*trId.setTableId(String .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); deleteRowsMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -4092,10 +4091,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Table retrived: " + table.toString()); trId = new TRId(); trId.setId(duplicatesSession.getTrId().getId()); - trId.setTableId(String + /*trId.setTableId(String .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); duplicatesMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); @@ -4118,10 +4117,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Table retrived: " + table.toString()); trId = new TRId(); trId.setId(duplicatesSession.getTrId().getId()); - trId.setTableId(String + /*trId.setTableId(String .valueOf(table.getId().getValue())); - trId.setTableType(table.getTableType().getName()); - retrieveTabularResourceType(trId); + trId.setTableType(table.getTableType().getName());*/ + retrieveTabularResourceBasicData(trId); duplicatesMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session);