From 0827cd34d3e82c48653c3dd17dbd242d20db99fb Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 18 Feb 2014 11:54:55 +0000 Subject: [PATCH] Minor Updated git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@91830 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../gwtservice/server/TDGWTServiceImpl.java | 37 +++++-------------- .../server/trservice/TaskStateMap.java | 27 ++++++++++++++ 2 files changed, 36 insertions(+), 28 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/TaskStateMap.java 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 08efa2c..f4df819 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 @@ -73,6 +73,7 @@ import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage; import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap; import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap; import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationsId; +import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap; import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor; @@ -91,7 +92,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession; import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession; import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource; -import org.gcube.portlets.user.td.gwtservice.shared.task.State; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData; @@ -1018,26 +1018,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements - protected State matchTaskState(TaskStatus status) { - switch (status) { - case INITIALIZING: - return State.INITIALIZING; - case FAILED: - return State.FAILED; - case ABORTED: - return State.ABORTED; - case IN_PROGRESS: - return State.IN_PROGRESS; - case SUCCEDED: - return State.SUCCEDED; - case STOPPED: - return State.STOPPED; - case VALIDATING_RULES: - return State.VALIDATING_RULES; - default: - return State.FAILED; - } - } + /** * {@inheritDoc} @@ -1071,7 +1052,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements + task.getStatus()); importMonitor - .setStatus(matchTaskState(task.getStatus())); + .setStatus(TaskStateMap.map(task.getStatus())); switch (importMonitor.getStatus()) { case SUCCEDED: @@ -1458,7 +1439,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Status: " + task.getStatus()); importMonitor - .setStatus(matchTaskState(task.getStatus())); + .setStatus(TaskStateMap.map(task.getStatus())); switch (importMonitor.getStatus()) { case FAILED: if (task.getResult() != null) { @@ -2007,7 +1988,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } else { logger.debug("Status: " + task.getStatus()); - exportMonitor.setStatus(matchTaskState(task.getStatus())); + exportMonitor.setStatus(TaskStateMap.map(task.getStatus())); switch (exportMonitor.getStatus()) { case FAILED: if (task.getResult() != null) { @@ -2166,7 +2147,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } else { logger.debug("Services TaskStatus: " + task.getStatus()); - exportMonitor.setStatus(matchTaskState(task.getStatus())); + exportMonitor.setStatus(TaskStateMap.map(task.getStatus())); switch (exportMonitor.getStatus()) { case FAILED: if (task.getResult() != null) { @@ -2486,7 +2467,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } else { logger.debug("Services TaskStatus: " + task.getStatus()); - changeColumnTypeMonitor.setStatus(matchTaskState(task + changeColumnTypeMonitor.setStatus(TaskStateMap.map(task .getStatus())); switch (changeColumnTypeMonitor.getStatus()) { case FAILED: @@ -2617,7 +2598,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } else { logger.debug("Services TaskStatus: " + task.getStatus()); - deleteColumnMonitor.setStatus(matchTaskState(task + deleteColumnMonitor.setStatus(TaskStateMap.map(task .getStatus())); switch (deleteColumnMonitor.getStatus()) { case FAILED: @@ -2749,7 +2730,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } else { logger.debug("Services TaskStatus: " + task.getStatus()); - labelColumnMonitor.setStatus(matchTaskState(task + labelColumnMonitor.setStatus(TaskStateMap.map(task .getStatus())); switch (labelColumnMonitor.getStatus()) { case FAILED: diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/TaskStateMap.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/TaskStateMap.java new file mode 100644 index 0000000..83bd098 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/TaskStateMap.java @@ -0,0 +1,27 @@ +package org.gcube.portlets.user.td.gwtservice.server.trservice; + +import org.gcube.data.analysis.tabulardata.commons.webservice.types.TaskStatus; +import org.gcube.portlets.user.td.gwtservice.shared.task.State; + +public class TaskStateMap { + public static State map(TaskStatus status) { + switch (status) { + case INITIALIZING: + return State.INITIALIZING; + case FAILED: + return State.FAILED; + case ABORTED: + return State.ABORTED; + case IN_PROGRESS: + return State.IN_PROGRESS; + case SUCCEDED: + return State.SUCCEDED; + case STOPPED: + return State.STOPPED; + case VALIDATING_RULES: + return State.VALIDATING_RULES; + default: + return State.FAILED; + } + } +}