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 2288dbc..f1921d3 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 @@ -466,7 +466,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements t.setTrId(null); } else { trId = new TRId(String.valueOf(tr.getId().getValue()), - String.valueOf(tableId.getValue())); + String.valueOf(tableId.getValue()),table.getTableType().getName()); t=getTabResourceInformation(trId); } @@ -475,6 +475,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements return t; } + + + + /** * * {@inheritDoc} @@ -569,7 +573,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements Table table = service.getLastTable(serviceTR.getId()); syncTRMetaData(serviceTR, tabResource); TRId trId = new TRId(String.valueOf(serviceTR.getId().getValue()), - String.valueOf(table.getId().getValue())); + String.valueOf(table.getId().getValue()), + table.getTableType().getName()); tabResource.setTrId(trId); return tabResource; } catch (Exception e) { @@ -643,14 +648,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements Codelist codelist = sdmxImportSession.getSelectedCodelist(); - map.put("agency", codelist.getAgencyId()); - map.put("id", codelist.getId()); - map.put("version", codelist.getVersion()); + map.put(Constants.PARAMETER_AGENCY, codelist.getAgencyId()); + map.put(Constants.PARAMETER_ID, codelist.getId()); + map.put(Constants.PARAMETER_VERSION, codelist.getVersion()); // TODO-GP: Get registry url from client SDMXRegistryDescriptor descriptor = new GCubeSDMXRegistryDescriptor(); - map.put("registryBaseUrl", + map.put(Constants.PARAMETER_REGISTRYBASEURL, descriptor.getUrl(SDMXRegistryInterfaceType.RESTV2_1)); return map; @@ -789,8 +794,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements case SUCCEDED: importMonitor.setProgress(task.getProgress()); logger.debug("Task Result: " + task.getResult()); - trId.setTableId(String.valueOf(task.getResult() - .getPrimaryTable().getId().getValue())); + Table table=task.getResult().getPrimaryTable(); + trId.setTableId(String.valueOf(table.getId().getValue())); + trId.setTableType(table.getTableType().getName()); sdmxImportTabResource.setTrId(trId); SessionUtil.setSDMXImportTabResource(session, sdmxImportTabResource); @@ -1159,13 +1165,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements importMonitor.setProgress(task.getProgress()); break; case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); + logger.debug("Task Result: " + task.getResult()); importMonitor.setProgress(task.getProgress()); Table table = task.getResult().getPrimaryTable(); - logger.debug("Table retrived: " + table.toString()); trId.setTableId(String.valueOf(table.getId() .getValue())); + trId.setTableType(table.getTableType().getName()); csvImportTabResource.setTrId(trId); SessionUtil.setCSVImportTabResource(session, csvImportTabResource); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/TRId.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/TRId.java index f60ac70..e450602 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/TRId.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/TRId.java @@ -12,16 +12,23 @@ public class TRId implements Serializable { private static final long serialVersionUID = 192846115142001630L; + + /** + * Tabular resource id + */ + String id; + /** * Last table id of tabular resource */ String tableId; /** - * Tabular resource id + * Type of last table */ - String id; - + String tableType; + + public TRId() { } @@ -29,13 +36,24 @@ public class TRId implements Serializable { public TRId(String id) { this.id = id; this.tableId = null; + this.tableType = null; } + + public TRId(String id, String tableId) { this.id = id; this.tableId = tableId; + this.tableType = null; } + public TRId(String id, String tableId, String tableType) { + this.id = id; + this.tableId = tableId; + this.tableType = null; + } + + public String getTableId() { return tableId; } @@ -52,9 +70,20 @@ public class TRId implements Serializable { this.id = id; } - @Override - public String toString() { - return "TRId [tableId=" + tableId + ", id=" + id + "]"; + public String getTableType() { + return tableType; } + public void setTableType(String tableType) { + this.tableType = tableType; + } + + @Override + public String toString() { + return "TRId [id=" + id + ", tableId=" + tableId + ", tableType=" + + tableType + "]"; + } + + + }