From d2f778559e437b9310e3832e88fdab1c2e330c56 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 7 Aug 2014 16:26:33 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@99231 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../shared/monitor/CSVExportMonitor.java | 94 +++++ .../shared/monitor/CSVImportMonitor.java | 81 +++++ .../shared/monitor/OperationMonitor.java | 27 +- .../monitor/OperationMonitorCreator.java | 341 ++++++++---------- .../monitor/OperationMonitorSession.java | 36 +- .../shared/monitor/SDMXExportMonitor.java | 100 +++++ .../shared/monitor/SDMXImportMonitor.java | 78 ++++ 7 files changed, 522 insertions(+), 235 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CSVExportMonitor.java create mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CSVImportMonitor.java create mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SDMXExportMonitor.java create mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SDMXImportMonitor.java diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CSVExportMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CSVExportMonitor.java new file mode 100644 index 0000000..5b09ea3 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CSVExportMonitor.java @@ -0,0 +1,94 @@ +/** + * + */ +package org.gcube.portlets.user.td.gwtservice.shared.monitor; + +import java.io.Serializable; + +import org.gcube.portlets.user.td.gwtservice.shared.task.State; +import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabExportMetadata; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class CSVExportMonitor implements Serializable { + +private static final long serialVersionUID = -5998841163159590481L; + + protected float progress; + protected State status; + protected String statusDescription; + protected Throwable error; + protected TRId trId; + protected TabExportMetadata trExportMetadata; + + + public float getProgress(){ + return progress; + }; + + public State getStatus(){ + return status; + } + + public String getStatusDescription(){ + return statusDescription; + } + + public void setProgress(float progress) { + this.progress = progress; + } + + public void setStatus(State status) { + this.status = status; + } + + public void setStatus(int status) { + this.status = State.values()[status]; + } + + public TabExportMetadata getTrExportMetadata() { + return trExportMetadata; + } + + public void setTrExportMetadata(TabExportMetadata trExportMetadata) { + this.trExportMetadata = trExportMetadata; + } + + public void setStatusDescription(String statusDescription) { + this.statusDescription = statusDescription; + } + + public Throwable getError() { + return error; + } + + public void setError(Throwable error) { + this.error = error; + } + + public TRId getTrId() { + return trId; + } + + public void setTrId(TRId trId) { + this.trId = trId; + } + + @Override + public String toString() { + return "CSVExportMonitor [progress=" + progress + ", status=" + status + + ", statusDescription=" + statusDescription + ", error=" + + error + ", trId=" + trId + ", trExportMetadata=" + + trExportMetadata + "]"; + } + + + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CSVImportMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CSVImportMonitor.java new file mode 100644 index 0000000..2e3fd2d --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CSVImportMonitor.java @@ -0,0 +1,81 @@ +/** + * + */ +package org.gcube.portlets.user.td.gwtservice.shared.monitor; + +import java.io.Serializable; + +import org.gcube.portlets.user.td.gwtservice.shared.task.State; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class CSVImportMonitor implements Serializable { + +private static final long serialVersionUID = -5998841163159590481L; + + protected float progress; + protected State status; + protected String statusDescription; + protected Throwable error; + protected TRId trId; + + public float getProgress(){ + return progress; + }; + + public State getStatus(){ + return status; + } + + public String getStatusDescription(){ + return statusDescription; + } + + public void setProgress(float progress) { + this.progress = progress; + } + + public void setStatus(State status) { + this.status = status; + } + + public void setStatus(int status) { + this.status = State.values()[status]; + } + + public void setStatusDescription(String statusDescription) { + this.statusDescription = statusDescription; + } + + public Throwable getError() { + return error; + } + + public void setError(Throwable error) { + this.error = error; + } + + public TRId getTrId() { + return trId; + } + + public void setTrId(TRId trId) { + this.trId = trId; + } + + + @Override + public String toString() { + return "CSVImportMonitor [progress=" + progress + ", status=" + status + + ", statusDescription=" + statusDescription + ", error=" + + error + ", trId=" + trId + "]"; + } + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitor.java index cfcac94..8199edf 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitor.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitor.java @@ -19,23 +19,19 @@ public class OperationMonitor implements Serializable { private static final long serialVersionUID = 5378053063599667767L; - protected UIOperationsId operationId; - protected String taskId; - // protected float progress; - // protected State status; - // protected String statusDescription; - protected TaskS task; - protected boolean inBackground; - protected boolean abort; - protected TRId trId; - - // protected String columnName; + private String taskId; + private UIOperationsId operationId; + private TaskS task; + private boolean inBackground; + private boolean abort; + private TRId trId; + public OperationMonitor() { } - public OperationMonitor(UIOperationsId operationId, String taskId) { + public OperationMonitor(String taskId, UIOperationsId operationId) { this.operationId = operationId; this.taskId = taskId; } @@ -90,9 +86,10 @@ public class OperationMonitor implements Serializable { @Override public String toString() { - return "OperationMonitor [operationId=" + operationId + ", taskId=" - + taskId + ", task=" + task + ", inBackground=" + inBackground - + ", abort=" + abort + ", trId=" + trId + "]"; + return "OperationMonitor [taskId=" + taskId + ", operationId=" + + operationId + ", task=" + task + ", inBackground=" + + inBackground + ", abort=" + abort + ", trId=" + trId + "]"; } + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java index 52b0c0d..f03eaee 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java @@ -1,5 +1,6 @@ package org.gcube.portlets.user.td.gwtservice.shared.monitor; +import java.text.SimpleDateFormat; import java.util.ArrayList; import javax.servlet.http.HttpSession; @@ -9,32 +10,31 @@ import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider; import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken; import org.gcube.data.analysis.tabulardata.commons.webservice.types.TaskStatus; import org.gcube.data.analysis.tabulardata.model.metadata.table.DatasetViewTableMetadata; +import org.gcube.data.analysis.tabulardata.model.metadata.table.ExportMetadata; import org.gcube.data.analysis.tabulardata.model.table.Table; import org.gcube.data.analysis.tabulardata.service.TabularDataService; import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory; import org.gcube.data.analysis.tabulardata.service.operation.Job; -import org.gcube.data.analysis.tabulardata.service.operation.Task; import org.gcube.data.analysis.tabulardata.service.operation.ValidationJob; import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource; import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId; import org.gcube.portlets.user.td.gwtservice.server.SessionUtil; +import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage; import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap; import org.gcube.portlets.user.td.gwtservice.server.trservice.WorkerStateMap; -import org.gcube.portlets.user.td.gwtservice.shared.UIOperationsId; +import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.task.JobS; import org.gcube.portlets.user.td.gwtservice.shared.task.TaskS; +import org.gcube.portlets.user.td.gwtservice.shared.task.TaskWrapper; import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsJobS; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; -import org.gcube.portlets.user.td.gwtservice.shared.tr.clone.CloneTabularResourceSession; -import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionSession; +import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabExportMetadata; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** * * @author "Giancarlo Panichi" email: jobSList = new ArrayList(); int i = 1; - for (Job job : task.getTaskJobs()) { + for (Job job : taskWrapper.getTask().getTaskJobs()) { ArrayList validationsJobS = new ArrayList(); int j = 1; @@ -124,44 +137,36 @@ public class OperationMonitorCreator { j++; } - - - taskS = new TaskS(task.getId().getValue(), task.getProgress(), - TaskStateMap.map(task.getStatus()), task.getErrorCause(), task.getSubmitter(), - task.getStartTime(), task.getEndTime(), jobSList); - + + taskS = new TaskS(taskWrapper.getTask().getId().getValue(), taskWrapper + .getTask().getProgress(), TaskStateMap.map(taskWrapper + .getTask().getStatus()), taskWrapper.getTask().getErrorCause(), + taskWrapper.getTask().getSubmitter(), taskWrapper.getTask() + .getStartTime(), taskWrapper.getTask().getEndTime(), + jobSList); + logger.debug("Retrieved task information"); return taskS; } - - - protected void postOperation(OperationMonitor operationMonitor) throws TDGWTServiceException { - TRId startTRId=retrieveTabularResourceIdFromOperation(); - - // Table table; - TRId trId; - TabResource tabResource; + + protected void postOperation(OperationMonitor operationMonitor) + throws TDGWTServiceException { + switch (operationMonitor.getTask().getState()) { case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception: " + task.getErrorCause()); - task.getErrorCause().printStackTrace(); + Throwable errorCause = taskWrapper.getTask().getErrorCause(); + if (errorCause == null) { + logger.error("Task Exception: task is failed"); + } else { - logger.debug("Task exception: Error In Operation no Error Cause present"); - + logger.error("Task exception: " + + errorCause.getLocalizedMessage()); + errorCause.printStackTrace(); } break; case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - trId = new TRId(); - trId.setId(startTRId.getId()); - trId = retrieveTabularResourceBasicData(trId); - - operationMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); + logger.debug("Task Result:" + taskWrapper.getTask().getResult()); + updateInformations(operationMonitor); break; case IN_PROGRESS: break; @@ -172,16 +177,8 @@ public class OperationMonitorCreator { case ABORTED: break; case STOPPED: - logger.debug("Task Result:" + task.getResult()); - trId = new TRId(); - trId.setId(startTRId.getId()); - trId = retrieveTabularResourceBasicData(trId); - - operationMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); + logger.debug("Task Result:" + taskWrapper.getTask().getResult()); + updateInformations(operationMonitor); break; case INITIALIZING: break; @@ -190,9 +187,57 @@ public class OperationMonitorCreator { } } + protected void updateInformations(OperationMonitor operationMonitor) + throws TDGWTServiceException { + TRId trId; + TabResource tabResource; + Table table; + ExportMetadata exportMetadata; + + switch(taskWrapper.getOperationId()){ + case CSVExport: + table = taskWrapper.getTask().getResult().getPrimaryTable(); + logger.debug("Table retrived: " + table.toString()); + exportMetadata = table + .getMetadata(ExportMetadata.class); + logger.debug("ExportMetadata: " + exportMetadata); + + operationMonitor.setTrId(SessionUtil.getTRId(session)); + + TabExportMetadata trExportMetadata; + trExportMetadata = new TabExportMetadata(); + trExportMetadata.setUrl(exportMetadata.getUri()); + trExportMetadata.setDestinationType(exportMetadata + .getDestinationType()); + trExportMetadata.setExportDate(sdf.format(exportMetadata + .getExportDate())); + + saveCSVExportInDestination(exportMetadata); + break; + case SDMXExport: + table = taskWrapper.getTask().getResult().getPrimaryTable(); + logger.debug("Table retrived: " + table.toString()); + exportMetadata = table + .getMetadata(ExportMetadata.class); + logger.debug("ExportMetadata: " + exportMetadata); + operationMonitor.setTrId(SessionUtil.getTRId(session)); + break; + default: + trId = new TRId(); + trId.setId(taskWrapper.getTrId().getId()); + trId = retrieveTabularResourceBasicData(trId); + + operationMonitor.setTrId(trId); + tabResource = SessionUtil.getTabResource(session); + tabResource.setTrId(trId); + SessionUtil.setTabResource(session, tabResource); + SessionUtil.setTRId(session, trId); + break; + + } - - + } + protected TRId retrieveTabularResourceBasicData(TRId trId) throws TDGWTServiceException { try { @@ -250,141 +295,51 @@ public class OperationMonitorCreator { + e.getLocalizedMessage()); } } - - - protected TRId retrieveTabularResourceIdFromOperation() { - TRId trId = null; - - UIOperationsId operationId = operationMonitorSession.getOperationId(); - switch (operationId) { - case AddColumn: - break; - case AddRow: - break; - case AmbiguousExternalReferenceCheck: - break; - case CLONE: - CloneTabularResourceSession cloneTabularResourceSession = SessionUtil - .getCloneTabularResourceSession(session); - trId = cloneTabularResourceSession.getTrId(); - break; - case CSVExport: - break; - case CSVImport: - break; - case ChangeTableType: - break; - case ChangeToAnnotationColumn: - break; - case ChangeToAttributeColumn: - break; - case ChangeToCodeColumn: - break; - case ChangeToCodeDescription: - break; - case ChangeToCodeName: - break; - case ChangeToDimensionColumn: - break; - case ChangeToMeasureColumn: - break; - case ChangeToTimeDimensionColumn: - break; - case CodelistMappingImport: - break; - case CodelistValidation: - break; - case ColumnNameAdd: - break; - case ColumnNameRemove: - break; - case ColumnTypeCastCheck: - break; - case CreateDatasetView: - break; - case Denormalize: - break; - case DimensionColumnValidator: - break; - case DuplicateTupleValidation: - break; - case DuplicateValuesInColumnValidator: - break; - case ExportToStatisticalOperation: - break; - case ExpressionValidation: - break; - case ExtractCodelist: - break; - case FilterByExpression: - break; - case GroupBy: - break; - case GuessCodelist: - break; - case ImportFromStatistical: - break; - case JSONExport: - break; - case JSONImport: - break; - case ModifyTuplesValuesByExpression: - break; - case ModifyTuplesValuesById: - break; - case ModifyTuplesValuesByValidation: - break; - case Normalize: - break; - case PeriodFormatCheck: - break; - case RemoveColumn: - break; - case RemoveDuplicateTuples: - break; - case RemoveRowById: - break; - case ReplaceById: - break; - case ReplaceColumnByExpression: - break; - case SDMXCodelistExport: - break; - case SDMXCodelistImport: - break; - case SDMXDatasetExport: - break; - case SDMXDatasetImport: - break; - case StatisticalOperation: - break; - case TableNameAdd: - break; - case TableNameRemove: - break; - case Union: - UnionSession unionSession = SessionUtil.getUnionSession(session); - trId = unionSession.getTrId(); - break; - case ValidateCodelist: - break; - case ValidateDataSet: - break; - case ValidateDataset: - break; - case ValidateGeneric: - break; - case ValidateTable: - break; - default: - break; + /** + * Save export data on Workspace + * + * @param session + * @param user + * @param exportMetadata + * @param exportSession + * @throws TDGWTServiceException + */ + protected void saveCSVExportInDestination(ExportMetadata exportMetadata) + throws TDGWTServiceException { + CSVExportSession exportSession = SessionUtil + .getCSVExportSession(session); + String user = aslSession.getUsername(); + + logger.debug("Save Export In Destination"); + logger.debug("Destination: " + exportSession.getDestination().getId()); + + if (exportSession.getDestination().getId().compareTo("Workspace") == 0) { + logger.debug("Save on Workspace"); + boolean end = SessionUtil.getCSVExportEnd(session); + if (end == false) { + SessionUtil.setCSVExportEnd(session, true); + FilesStorage storage = new FilesStorage(); + logger.debug("Create Item On Workspace: [ uri: " + + exportMetadata.getUri() + " ,user: " + user + + " ,fileName: " + exportSession.getFileName() + + " ,fileDescription: " + + exportSession.getFileDescription() + + " ,mimetype: text/csv" + " ,folder: " + + exportSession.getItemId() + "]"); + storage.createItemOnWorkspace(exportMetadata.getUri(), user, + exportSession.getFileName(), + exportSession.getFileDescription(), "text/csv", + exportSession.getItemId()); + + } else { + logger.debug("getCSVExportEnd(): true"); + } + } else { + logger.error("Destination No Present"); + throw new TDGWTServiceException( + "Error in exportCSV CSVExportMonitor: no destination present"); } - - return trId; - } - - - + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorSession.java index cbd291c..d2de715 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorSession.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorSession.java @@ -2,8 +2,6 @@ package org.gcube.portlets.user.td.gwtservice.shared.monitor; import java.io.Serializable; -import org.gcube.portlets.user.td.gwtservice.shared.UIOperationsId; - /** * * @author "Giancarlo Panichi" @@ -15,37 +13,21 @@ public class OperationMonitorSession implements Serializable { private static final long serialVersionUID = 7998971732364151219L; - protected UIOperationsId operationId; - protected String taskId; - protected boolean inBackground; - protected boolean abort; + private String taskId; + private boolean inBackground; + private boolean abort; public OperationMonitorSession(){ } - public OperationMonitorSession(UIOperationsId operationId){ - this.operationId=operationId; - taskId=null; - inBackground=false; - abort=false; - } - - public OperationMonitorSession(UIOperationsId operationId,String taskId){ - this.operationId=operationId; + public OperationMonitorSession(String taskId){ this.taskId=taskId; inBackground=false; abort=false; } - - public UIOperationsId getOperationId() { - return operationId; - } - - public void setOperationId(UIOperationsId operationId) { - this.operationId = operationId; - } - + + public String getTaskId() { return taskId; } @@ -76,13 +58,13 @@ public class OperationMonitorSession implements Serializable { @Override public String toString() { - return "MonitorSession [operationId=" + operationId + ", taskId=" - + taskId + ", inBackground=" + inBackground + ", abort=" - + abort + "]"; + return "OperationMonitorSession [taskId=" + taskId + ", inBackground=" + + inBackground + ", abort=" + abort + "]"; } + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SDMXExportMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SDMXExportMonitor.java new file mode 100644 index 0000000..d33d363 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SDMXExportMonitor.java @@ -0,0 +1,100 @@ +package org.gcube.portlets.user.td.gwtservice.shared.monitor; + +import java.io.Serializable; + +import org.gcube.portlets.user.td.gwtservice.shared.task.State; +import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabExportMetadata; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class SDMXExportMonitor implements Serializable { + + private static final long serialVersionUID = -5998841163159590481L; + + protected float progress; + protected State status; + protected String statusDescription; + protected Throwable error; + protected String url; + protected TabExportMetadata tabExportMetadata; + protected TRId trId; + + public TRId getTrId() { + return trId; + } + + public void setTrId(TRId trId) { + this.trId = trId; + } + + public float getProgress(){ + return progress; + }; + + public State getStatus(){ + return status; + } + + public String getStatusDescription(){ + return statusDescription; + } + + public void setProgress(float progress) { + this.progress = progress; + } + + public void setStatus(State status) { + this.status = status; + } + + public void setStatus(int status) { + this.status = State.values()[status]; + } + + public void setStatusDescription(String statusDescription) { + this.statusDescription = statusDescription; + } + + public Throwable getError() { + return error; + } + + public void setError(Throwable error) { + this.error = error; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public TabExportMetadata getTabExportMetadata() { + return tabExportMetadata; + } + + public void setTabExportMetadata(TabExportMetadata tabExportMetadata) { + this.tabExportMetadata = tabExportMetadata; + } + + @Override + public String toString() { + return "SDMXExportMonitor [progress=" + progress + ", status=" + status + + ", statusDescription=" + statusDescription + ", error=" + + error + ", url=" + url + ", tabExportMetadata=" + + tabExportMetadata + ", trId=" + trId + "]"; + } + + + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SDMXImportMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SDMXImportMonitor.java new file mode 100644 index 0000000..d20e09b --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SDMXImportMonitor.java @@ -0,0 +1,78 @@ +package org.gcube.portlets.user.td.gwtservice.shared.monitor; + +import java.io.Serializable; + +import org.gcube.portlets.user.td.gwtservice.shared.task.State; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class SDMXImportMonitor implements Serializable { + + private static final long serialVersionUID = -5998841163159590481L; + + protected float progress; + protected State status; + protected String statusDescription; + protected Throwable error; + protected TRId trId; + + public float getProgress(){ + return progress; + }; + + public State getStatus(){ + return status; + } + + public String getStatusDescription(){ + return statusDescription; + } + + public void setProgress(float progress) { + this.progress = progress; + } + + public void setStatus(State status) { + this.status = status; + } + + public void setStatus(int status) { + this.status = State.values()[status]; + } + + public void setStatusDescription(String statusDescription) { + this.statusDescription = statusDescription; + } + + public Throwable getError() { + return error; + } + + public void setError(Throwable error) { + this.error = error; + } + + public TRId getTrId() { + return trId; + } + + public void setTrId(TRId trId) { + this.trId = trId; + } + + + @Override + public String toString() { + return "SDMXImportMonitor [progress=" + progress + ", status=" + status + + ", statusDescription=" + statusDescription + ", error=" + + error + ", trId=" + trId + "]"; + } + + +}