Updated on stop of the tasks

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@92502 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-02-28 15:07:47 +00:00
parent a1bf10b12c
commit 1b11d3301d
1 changed files with 172 additions and 42 deletions

View File

@ -1119,12 +1119,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
importMonitor.setStatus(TaskStateMap.map(task
.getStatus()));
Table table;
switch (importMonitor.getStatus()) {
case SUCCEDED:
importMonitor.setProgress(task.getProgress());
logger.debug("Task Result: " + task.getResult());
Table table = task.getResult().getPrimaryTable();
table = task.getResult().getPrimaryTable();
trId.setTableId(String.valueOf(table.getId()
.getValue()));
trId.setTableType(table.getTableType().getName());
@ -1149,8 +1149,20 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
importMonitor.setProgress(task.getProgress());
break;
case STOPPED:
importMonitor.setError(new Throwable(
"Not passed validation task stopped"));
importMonitor.setProgress(task.getProgress());
logger.debug("Task Result: " + task.getResult());
table = task.getResult().getPrimaryTable();
trId.setTableId(String.valueOf(table.getId()
.getValue()));
trId.setTableType(table.getTableType().getName());
sdmxImportTabResource.setTrId(trId);
SessionUtil.setSDMXImportTabResource(session,
sdmxImportTabResource);
SessionUtil.setTabResource(session,
sdmxImportTabResource);
SessionUtil.setTRId(session, trId);
break;
case ABORTED:
break;
@ -1506,6 +1518,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
importMonitor.setStatus(TaskStateMap.map(task
.getStatus()));
Table table;
switch (importMonitor.getStatus()) {
case FAILED:
if (task.getResult() != null) {
@ -1522,7 +1535,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case SUCCEDED:
logger.debug("Task Result: " + task.getResult());
importMonitor.setProgress(task.getProgress());
Table table = task.getResult().getPrimaryTable();
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
trId.setTableId(String.valueOf(table.getId()
.getValue()));
@ -1537,8 +1550,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
SessionUtil.setTRId(session, trId);
break;
case STOPPED:
importMonitor.setError(new Throwable(
"Not passed validation task stopped"));
logger.debug("Task Result: " + task.getResult());
importMonitor.setProgress(task.getProgress());
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);
logger.debug("Import CSV Succeded TabResource Set:"
+ csvImportTabResource);
SessionUtil.setTabResource(session,
csvImportTabResource);
SessionUtil.setTRId(session, trId);
break;
case IN_PROGRESS:
importMonitor.setProgress(task.getProgress());
@ -2055,6 +2082,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Status: " + task.getStatus());
exportMonitor.setStatus(TaskStateMap.map(task.getStatus()));
Table table;
ExportMetadata exportMetadata;
TabExportMetadata tabExportMetadata;
switch (exportMonitor.getStatus()) {
case FAILED:
if (task.getResult() != null) {
@ -2071,14 +2101,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case SUCCEDED:
logger.debug("Task Result:" + task.getResult());
exportMonitor.setProgress(task.getProgress());
Table table = task.getResult().getPrimaryTable();
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
ExportMetadata exportMetadata = table
exportMetadata = table
.getMetadata(ExportMetadata.class);
logger.debug("ExportMetadata: " + exportMetadata);
exportMonitor.setTrId(SessionUtil.getTRId(session));
TabExportMetadata tabExportMetadata = new TabExportMetadata();
tabExportMetadata = new TabExportMetadata();
tabExportMetadata.setUrl(exportMetadata.getUri());
tabExportMetadata.setDestinationType(exportMetadata
.getDestinationType());
@ -2087,8 +2117,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
exportMonitor.setTabExportMetadata(tabExportMetadata);
break;
case STOPPED:
exportMonitor.setError(new Throwable(
"Not passed validation task stopped"));
logger.debug("Task Result:" + task.getResult());
exportMonitor.setProgress(task.getProgress());
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
exportMetadata = table
.getMetadata(ExportMetadata.class);
logger.debug("ExportMetadata: " + exportMetadata);
exportMonitor.setTrId(SessionUtil.getTRId(session));
tabExportMetadata = new TabExportMetadata();
tabExportMetadata.setUrl(exportMetadata.getUri());
tabExportMetadata.setDestinationType(exportMetadata
.getDestinationType());
tabExportMetadata.setExportDate(sdf
.format(exportMetadata.getExportDate()));
exportMonitor.setTabExportMetadata(tabExportMetadata);
break;
case IN_PROGRESS:
exportMonitor.setProgress(task.getProgress());
@ -2214,6 +2258,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Services TaskStatus: " + task.getStatus());
exportMonitor.setStatus(TaskStateMap.map(task.getStatus()));
Table table;
ExportMetadata exportMetadata;
TabExportMetadata trExportMetadata;
switch (exportMonitor.getStatus()) {
case FAILED:
if (task.getResult() != null) {
@ -2231,14 +2278,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case SUCCEDED:
logger.debug("Task Result:" + task.getResult());
exportMonitor.setProgress(task.getProgress());
Table table = task.getResult().getPrimaryTable();
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
ExportMetadata exportMetadata = table
exportMetadata = table
.getMetadata(ExportMetadata.class);
logger.debug("ExportMetadata: " + exportMetadata);
exportMonitor.setTrId(SessionUtil.getTRId(session));
TabExportMetadata trExportMetadata = new TabExportMetadata();
trExportMetadata = new TabExportMetadata();
trExportMetadata.setUrl(exportMetadata.getUri());
trExportMetadata.setDestinationType(exportMetadata
.getDestinationType());
@ -2258,8 +2305,24 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case ABORTED:
break;
case STOPPED:
exportMonitor.setError(new Throwable(
"Not passed validation task stopped"));
logger.debug("Task Result:" + task.getResult());
exportMonitor.setProgress(task.getProgress());
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
exportMetadata = table
.getMetadata(ExportMetadata.class);
logger.debug("ExportMetadata: " + exportMetadata);
exportMonitor.setTrId(SessionUtil.getTRId(session));
trExportMetadata = new TabExportMetadata();
trExportMetadata.setUrl(exportMetadata.getUri());
trExportMetadata.setDestinationType(exportMetadata
.getDestinationType());
trExportMetadata.setExportDate(sdf
.format(exportMetadata.getExportDate()));
exportMonitor.setTrExportMetadata(trExportMetadata);
saveInDestination(session, aslSession.getUsername(),
exportMetadata, exportSession);
break;
case INITIALIZING:
break;
@ -2381,12 +2444,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
operationDefinition = OperationDefinitionMap.map(
OperationsId.ChangeToDimensionColumn.toString(),
capabilities);
ColumnData columnData = changeColumnTypeSession
ColumnData col = changeColumnTypeSession
.getCodelistColumnReference();
logger.debug("ReferenceColumn To Set: " + columnData);
ColumnLocalId cId = new ColumnLocalId(columnData.getColumnId());
TableId tId = new TableId(Long.getLong(columnData.getTrId()
.getTableId()));
logger.debug("ReferenceColumn To Set: " + col);
ColumnLocalId cId = new ColumnLocalId(col.getColumnId());
TRId trId=col.getTrId();
logger.debug("trID: "+trId);
long tabId=new Long(trId.getTableId());
TableId tId = new TableId(tabId);
ColumnReference columnReference = new ColumnReference(tId, cId);
map.put(Constants.PARAMETER_REFERENCE_COLUMN, columnReference);
@ -2546,6 +2611,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
changeColumnTypeMonitor.setStatus(TaskStateMap.map(task
.getStatus()));
Table table;
TRId trId;
TabResource tabResource;
switch (changeColumnTypeMonitor.getStatus()) {
case FAILED:
if (task.getResult() != null) {
@ -2563,16 +2631,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case SUCCEDED:
logger.debug("Task Result:" + task.getResult());
changeColumnTypeMonitor.setProgress(task.getProgress());
Table table = task.getResult().getPrimaryTable();
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
TRId trId = new TRId();
trId = new TRId();
trId.setId(changeColumnTypeSession.getColumnData()
.getTrId().getId());
trId.setTableId(String
.valueOf(table.getId().getValue()));
trId.setTableType(table.getTableType().getName());
changeColumnTypeMonitor.setTrId(trId);
TabResource tabResource = SessionUtil
tabResource = SessionUtil
.getTabResource(session);
tabResource.setTrId(trId);
SessionUtil.setTabResource(session, tabResource);
@ -2587,8 +2655,20 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case ABORTED:
break;
case STOPPED:
changeColumnTypeMonitor.setError(new Throwable(
"Not passed validation task stopped"));
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
trId = new TRId();
trId.setId(changeColumnTypeSession.getColumnData()
.getTrId().getId());
trId.setTableId(String
.valueOf(table.getId().getValue()));
trId.setTableType(table.getTableType().getName());
changeColumnTypeMonitor.setTrId(trId);
tabResource = SessionUtil
.getTabResource(session);
tabResource.setTrId(trId);
SessionUtil.setTabResource(session, tabResource);
SessionUtil.setTRId(session, trId);
break;
case INITIALIZING:
break;
@ -2677,6 +2757,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
deleteColumnMonitor.setStatus(TaskStateMap.map(task
.getStatus()));
Table table;
TRId trId;
TabResource tabResource;
switch (deleteColumnMonitor.getStatus()) {
case FAILED:
if (task.getResult() != null) {
@ -2694,16 +2777,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case SUCCEDED:
logger.debug("Task Result:" + task.getResult());
deleteColumnMonitor.setProgress(task.getProgress());
Table table = task.getResult().getPrimaryTable();
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
TRId trId = new TRId();
trId = new TRId();
trId.setId(deleteColumnSession.getColumnData()
.getTrId().getId());
trId.setTableId(String
.valueOf(table.getId().getValue()));
trId.setTableType(table.getTableType().getName());
deleteColumnMonitor.setTrId(trId);
TabResource tabResource = SessionUtil
tabResource = SessionUtil
.getTabResource(session);
tabResource.setTrId(trId);
SessionUtil.setTabResource(session, tabResource);
@ -2718,8 +2801,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case ABORTED:
break;
case STOPPED:
deleteColumnMonitor.setError(new Throwable(
"Not passed validation task stopped"));
logger.debug("Task Result:" + task.getResult());
deleteColumnMonitor.setProgress(task.getProgress());
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
trId = new TRId();
trId.setId(deleteColumnSession.getColumnData()
.getTrId().getId());
trId.setTableId(String
.valueOf(table.getId().getValue()));
trId.setTableType(table.getTableType().getName());
deleteColumnMonitor.setTrId(trId);
tabResource = SessionUtil
.getTabResource(session);
tabResource.setTrId(trId);
SessionUtil.setTabResource(session, tabResource);
SessionUtil.setTRId(session, trId);
break;
case INITIALIZING:
break;
@ -2808,6 +2905,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
labelColumnMonitor.setStatus(TaskStateMap.map(task
.getStatus()));
Table table;
TRId trId;
TabResource tabResource;
switch (labelColumnMonitor.getStatus()) {
case FAILED:
if (task.getResult() != null) {
@ -2825,16 +2925,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case SUCCEDED:
logger.debug("Task Result:" + task.getResult());
labelColumnMonitor.setProgress(task.getProgress());
Table table = task.getResult().getPrimaryTable();
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
TRId trId = new TRId();
trId = new TRId();
trId.setId(labelColumnSession.getColumnData().getTrId()
.getId());
trId.setTableId(String
.valueOf(table.getId().getValue()));
trId.setTableType(table.getTableType().getName());
labelColumnMonitor.setTrId(trId);
TabResource tabResource = SessionUtil
tabResource = SessionUtil
.getTabResource(session);
tabResource.setTrId(trId);
SessionUtil.setTabResource(session, tabResource);
@ -2849,8 +2949,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case ABORTED:
break;
case STOPPED:
labelColumnMonitor.setError(new Throwable(
"Not passed validation task stopped"));
logger.debug("Task Result:" + task.getResult());
labelColumnMonitor.setProgress(task.getProgress());
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
trId = new TRId();
trId.setId(labelColumnSession.getColumnData().getTrId()
.getId());
trId.setTableId(String
.valueOf(table.getId().getValue()));
trId.setTableType(table.getTableType().getName());
labelColumnMonitor.setTrId(trId);
tabResource = SessionUtil
.getTabResource(session);
tabResource.setTrId(trId);
SessionUtil.setTabResource(session, tabResource);
SessionUtil.setTRId(session, trId);
break;
case INITIALIZING:
break;
@ -2942,6 +3056,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
changeTableTypeMonitor.setStatus(TaskStateMap.map(task
.getStatus()));
Table table;
TRId trId;
TabResource tabResource;
switch (changeTableTypeMonitor.getStatus()) {
case FAILED:
if (task.getResult() != null) {
@ -2959,15 +3076,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case SUCCEDED:
logger.debug("Task Result:" + task.getResult());
changeTableTypeMonitor.setProgress(task.getProgress());
Table table = task.getResult().getPrimaryTable();
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
TRId trId = new TRId();
trId = new TRId();
trId.setId(changeTableTypeSession.getTrId().getId());
trId.setTableId(String
.valueOf(table.getId().getValue()));
trId.setTableType(table.getTableType().getName());
changeTableTypeMonitor.setTrId(trId);
TabResource tabResource = SessionUtil
tabResource = SessionUtil
.getTabResource(session);
tabResource.setTrId(trId);
SessionUtil.setTabResource(session, tabResource);
@ -2982,8 +3099,21 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
case ABORTED:
break;
case STOPPED:
changeTableTypeMonitor.setError(new Throwable(
"Not passed validation task stopped"));
logger.debug("Task Result:" + task.getResult());
changeTableTypeMonitor.setProgress(task.getProgress());
table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
trId = new TRId();
trId.setId(changeTableTypeSession.getTrId().getId());
trId.setTableId(String
.valueOf(table.getId().getValue()));
trId.setTableType(table.getTableType().getName());
changeTableTypeMonitor.setTrId(trId);
tabResource = SessionUtil
.getTabResource(session);
tabResource.setTrId(trId);
SessionUtil.setTabResource(session, tabResource);
SessionUtil.setTRId(session, trId);
break;
case INITIALIZING:
break;