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 80e6173..7fdf89b 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 @@ -75,6 +75,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState; import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence; 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.task.State; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.TRId; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; @@ -602,6 +603,26 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException("OperationDescriptor not found"); } + + 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 FALLBACK: + return State.FAILED; + default: + return State.FAILED; + } + } + /** * {@inheritDoc} @@ -634,7 +655,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } else { logger.debug("Service Task.getStatus(): " + task.getStatus()); - importMonitor.setStatus(task.getStatus().ordinal()); + + importMonitor.setStatus(matchTaskState(task.getStatus())); + switch (importMonitor.getStatus()) { case SUCCEDED: importMonitor.setProgress(task.getProgress()); @@ -990,7 +1013,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error in importCSV Status null"); } else { logger.debug("Status: " + task.getStatus()); - importMonitor.setStatus(task.getStatus().ordinal()); + + importMonitor.setStatus(matchTaskState(task.getStatus())); switch (importMonitor.getStatus()) { case FAILED: if (task.getResult() != null) {