From b1460ad4e892cb1dd8ad36fdc098c37af678f402 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 8 Aug 2014 13:18:49 +0000 Subject: [PATCH] Updated OperationMonitor git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@99240 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../gwtservice/client/rpc/TDGWTService.java | 434 +- .../client/rpc/TDGWTServiceAsync.java | 119 +- .../server/CSVImportFileServlet.java | 1 + .../server/CodelistMappingUploadServlet.java | 5 +- .../gwtservice/server/LocalUploadServlet.java | 7 +- .../gwtservice/server/SessionConstants.java | 86 +- .../td/gwtservice/server/SessionUtil.java | 1441 ++----- .../gwtservice/server/TDGWTServiceImpl.java | 3589 ++--------------- .../server/file/CSVFileUploadSession.java | 15 +- .../CodelistMappingFileUploadSession.java | 18 +- .../shared/monitor/AddColumnMonitor.java | 20 - .../monitor/ChangeTableTypeMonitor.java | 13 - .../shared/monitor/CloneMonitor.java | 14 - .../monitor/CodelistMappingMonitor.java | 16 - .../shared/monitor/DeleteColumnMonitor.java | 20 - .../shared/monitor/DeleteRowsMonitor.java | 12 - .../monitor/DenormalizationMonitor.java | 20 - .../shared/monitor/DuplicatesMonitor.java | 11 - .../shared/monitor/EditRowMonitor.java | 12 - .../monitor/ExtractCodelistMonitor.java | 19 - .../shared/monitor/GroupByMonitor.java | 20 - .../shared/monitor/LabelColumnMonitor.java | 20 - .../shared/monitor/MergeColumnMonitor.java | 20 - .../shared/monitor/NormalizationMonitor.java | 17 - .../monitor/ReplaceBatchColumnMonitor.java | 20 - .../shared/monitor/ReplaceColumnMonitor.java | 20 - .../monitor/RollBackSessionMonitor.java | 19 - .../shared/monitor/SplitColumnMonitor.java | 20 - .../shared/monitor/TaskResubmitMonitor.java | 17 - .../shared/monitor/TaskResumeMonitor.java | 17 - .../shared/monitor/TemplateApplyMonitor.java | 19 - .../shared/monitor/UnionMonitor.java | 20 - .../column/type/ChangeColumnTypeMonitor.java | 92 - 33 files changed, 826 insertions(+), 5367 deletions(-) delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/AddColumnMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ChangeTableTypeMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CloneMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CodelistMappingMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DeleteColumnMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DeleteRowsMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DenormalizationMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DuplicatesMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/EditRowMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ExtractCodelistMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/GroupByMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/LabelColumnMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/MergeColumnMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/NormalizationMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ReplaceBatchColumnMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ReplaceColumnMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/RollBackSessionMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SplitColumnMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TaskResubmitMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TaskResumeMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TemplateApplyMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/UnionMonitor.java delete mode 100644 src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/type/ChangeColumnTypeMonitor.java diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java index 3e28164..e5ea414 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java @@ -7,9 +7,7 @@ import java.util.ArrayList; import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList; -import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; -import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CheckCSVSession; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException; @@ -18,33 +16,9 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor; import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence; import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.AddColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ChangeTableTypeMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.CloneMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.CodelistMappingMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DeleteColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DeleteRowsMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DenormalizationMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DuplicatesMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.EditRowMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ExtractCodelistMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.GroupByMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.LabelColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.MergeColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.NormalizationMonitor; import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor; import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ReplaceBatchColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ReplaceColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.RollBackSessionMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.SplitColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TaskResubmitMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TaskResumeMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TemplateApplyMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.UnionMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor; 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.share.ShareInfo; import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource; @@ -66,7 +40,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.LabelColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnSession; -import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRMetadata; import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.DenormalizationSession; @@ -238,40 +211,24 @@ public interface TDGWTService extends RemoteService { throws TDGWTServiceException; // Task - /** - * Get Operation Monitor during the resubmit task - * - * @return - * @throws TDGWTServiceException - */ - public TaskResubmitMonitor getTaskResubmitMonitor() - throws TDGWTServiceException; - /** * Resubmit task * * @param taskResubmitSession - * @throws TDGWTServiceException - */ - public void startTaskResubmit(TaskResubmitSession taskResubmitSession) - throws TDGWTServiceException; - - /** - * Get Operation Monitor during the resume task - * * @return * @throws TDGWTServiceException */ - public TaskResumeMonitor getTaskResumeMonitor() + public String startTaskResubmit(TaskResubmitSession taskResubmitSession) throws TDGWTServiceException; /** * Resume task * * @param taskResumeSession + * @return * @throws TDGWTServiceException */ - public void startTaskResume(TaskResumeSession taskResumeSession) + public String startTaskResume(TaskResumeSession taskResumeSession) throws TDGWTServiceException; // Validations @@ -314,16 +271,7 @@ public interface TDGWTService extends RemoteService { * @param rollBackSession * @throws TDGWTServiceException */ - public void rollBack(RollBackSession rollBackSession) - throws TDGWTServiceException; - - /** - * Get Operation Monitor during the rollback - * - * @return - * @throws TDGWTServiceException - */ - public RollBackSessionMonitor getRollBackMonitor() + public String startRollBack(RollBackSession rollBackSession) throws TDGWTServiceException; /** @@ -377,22 +325,14 @@ public interface TDGWTService extends RemoteService { /** * Start clone tabular resource * - * @param labelColumnSession - * @throws TDGWTServiceException - */ - public void startCloneTabularResource( - CloneTabularResourceSession cloneTabularResourceSession) - throws TDGWTServiceException; - - /** - * Get Operation Monitor during the Clone operation - * + * @param cloneTabularResourceSession * @return * @throws TDGWTServiceException */ - public CloneMonitor getCloneMonitor() throws TDGWTServiceException; - - + public String startCloneTabularResource( + CloneTabularResourceSession cloneTabularResourceSession) + throws TDGWTServiceException; + // /** * Initialize Codelists Paging Loader @@ -418,7 +358,7 @@ public interface TDGWTService extends RemoteService { * @param s * @throws TDGWTServiceException */ - public void startTDOpen(TDOpenSession tdOpenSession) + public void tdOpen(TDOpenSession tdOpenSession) throws TDGWTServiceException; /** @@ -513,31 +453,14 @@ public interface TDGWTService extends RemoteService { /** * Start SDMX Import and invokes the client library * - * @param s - * @throws TDGWTServiceException - */ - public void startSDMXImport(SDMXImportSession sdmxImportSession) - throws TDGWTServiceException; - - /** - * Get Operation Monitor during the SDMX Import operation - * + * @param sdmxImportSession * @return * @throws TDGWTServiceException */ - public SDMXImportMonitor getSDMXImportMonitor() - throws TDGWTServiceException; - - // Import CSV - /** - * Get File Upload Monitor during the file upload operation in Import CSV - * - * @return - * @throws TDGWTServiceException - */ - public FileUploadMonitor getFileUploadMonitor() + public String startSDMXImport(SDMXImportSession sdmxImportSession) throws TDGWTServiceException; + // CSV Import /** * * @param s @@ -590,238 +513,140 @@ public interface TDGWTService extends RemoteService { * @param s * @throws TDGWTServiceException */ - public void startCSVImport(CSVImportSession csvImportSession) + public String startCSVImport(CSVImportSession csvImportSession) throws TDGWTServiceException; - /** - * Get Operation Monitor during the CSV Import operation - * - * @return - * @throws TDGWTServiceException - */ - public CSVImportMonitor getCSVImportMonitor() throws TDGWTServiceException; - + // Export CSV - /** - * Get Operation Monitor during the CSV Export operation - * - * @return - * @throws TDGWTServiceException - */ - public CSVExportMonitor getCSVExportMonitor() throws TDGWTServiceException; - /** * Start CSV Export and invokes the client library * * @param csvExportSession + * @return * @throws TDGWTServiceException */ - public void startCSVExport(CSVExportSession csvExportSession) + public String startCSVExport(CSVExportSession csvExportSession) throws TDGWTServiceException; // Export SDMX /** - * Get Operation Monitor during the SDMX Export operation + * Start SDMX Export and invokes the client library * + * @param exportSession * @return * @throws TDGWTServiceException */ - public SDMXExportMonitor getSDMXExportMonitor() - throws TDGWTServiceException; - - /** - * Start SDMX Export and invokes the client library - * - * @param sdmxExportSession - * @throws TDGWTServiceException - */ - public void startSDMXExport(SDMXExportSession exportSession) + public String startSDMXExport(SDMXExportSession exportSession) throws TDGWTServiceException; // Table Operations - /** - * Get Operation Monitor during the Change Table Type operation - * - * - * @return - * @throws TDGWTServiceException - */ - public ChangeTableTypeMonitor getChangeTableTypeMonitor() - throws TDGWTServiceException; - + /** * Start change table type * - * @param labelColumnSession - * @throws TDGWTServiceException - */ - public void startChangeTableType( - ChangeTableTypeSession changeTableTypeSession) - throws TDGWTServiceException; - - /** - * Get Operation Monitor during the union operation - * + * @param changeTableTypeSession * @return * @throws TDGWTServiceException */ - public UnionMonitor getUnionMonitor() throws TDGWTServiceException; + public String startChangeTableType( + ChangeTableTypeSession changeTableTypeSession) + throws TDGWTServiceException; + /** * Start Union and invokes the client library * * @param unionSession + * @return * @throws TDGWTServiceException */ - public void startUnion(UnionSession unionSession) + public String startUnion(UnionSession unionSession) throws TDGWTServiceException; // Rows Operations - /** - * Get Operation Monitor during the Edit Row operation - * - * - * @return - * @throws TDGWTServiceException - */ - public EditRowMonitor getEditRowMonitor() throws TDGWTServiceException; - /** * Start edit row or add row * - * @param labelColumnSession - * @throws TDGWTServiceException - */ - public void startEditRow(EditRowSession editRowSession) - throws TDGWTServiceException; - - /** - * Get Operation Monitor during the Delete Rows operation - * - * + * @param editRowSession * @return * @throws TDGWTServiceException */ - public DeleteRowsMonitor getDeleteRowsMonitor() + public String startEditRow(EditRowSession editRowSession) throws TDGWTServiceException; + /** * Start delete rows * - * @param labelColumnSession - * @throws TDGWTServiceException - */ - public void startDeleteRows(DeleteRowsSession deleteRowsSession) - throws TDGWTServiceException; - - /** - * Get Operation Monitor during the operation on duplicates - * - * + * @param deleteRowsSession * @return * @throws TDGWTServiceException */ - public DuplicatesMonitor getDuplicatesMonitor() + public String startDeleteRows(DeleteRowsSession deleteRowsSession) throws TDGWTServiceException; + + /** * Start operation on duplicates * - * @param labelColumnSession + * @param duplicatesSession + * @return * @throws TDGWTServiceException */ - public void startDuplicates(DuplicatesSession duplicatesSession) + public String startDuplicates(DuplicatesSession duplicatesSession) throws TDGWTServiceException; // Column Operation - /** - * Get Operation Monitor during the Change Column Type operation - * - * @return - * @throws TDGWTServiceException - */ - public ChangeColumnTypeMonitor getChangeColumnTypeMonitor() - throws TDGWTServiceException; + /** * Start change column type * + * * @param changeColumnTypeSession + * @return * @throws TDGWTServiceException */ - public void startChangeColumnType( + public String startChangeColumnType( ChangeColumnTypeSession changeColumnTypeSession) throws TDGWTServiceException; - /** - * Get Operation Monitor during the Add Column operation - * - * - * @return - * @throws TDGWTServiceException - */ - public AddColumnMonitor getAddColumnMonitor() throws TDGWTServiceException; - + /** * Start add column - * - * + * * @param addColumnSession - * @throws TDGWTServiceException - */ - public void startAddColumn(AddColumnSession addColumnSession) - throws TDGWTServiceException; - - /** - * Get Operation Monitor during the Delete Column operation - * - * * @return * @throws TDGWTServiceException */ - public DeleteColumnMonitor getDeleteColumnMonitor() + public String startAddColumn(AddColumnSession addColumnSession) throws TDGWTServiceException; + /** * Start delete column * - * * @param deleteColumnSession - * @throws TDGWTServiceException - */ - public void startDeleteColumn(DeleteColumnSession deleteColumnSession) - throws TDGWTServiceException; - - /** - * Get Operation Monitor during the Change the Column Label operation - * - * * @return * @throws TDGWTServiceException */ - public LabelColumnMonitor getLabelColumnMonitor() + public String startDeleteColumn(DeleteColumnSession deleteColumnSession) throws TDGWTServiceException; /** * Start change the column label * * @param labelColumnSession - * @throws TDGWTServiceException - */ - public void startLabelColumn(LabelColumnSession labelColumnSession) - throws TDGWTServiceException; - - /** - * Get Operation Monitor during the Split Column operation - * - * * @return * @throws TDGWTServiceException */ - public SplitColumnMonitor getSplitColumnMonitor() + public String startLabelColumn(LabelColumnSession labelColumnSession) throws TDGWTServiceException; + + /** * Start split column * @@ -832,16 +657,8 @@ public interface TDGWTService extends RemoteService { * splitColumnSession) throws TDGWTServiceException; */ - /** - * Get Operation Monitor during the Merge Column operation - * - * - * @return - * @throws TDGWTServiceException - */ - public MergeColumnMonitor getMergeColumnMonitor() - throws TDGWTServiceException; - + + /** * Start merge column * @@ -852,14 +669,7 @@ public interface TDGWTService extends RemoteService { * mergeColumnSession) throws TDGWTServiceException; */ - /** - * Get Operation Monitor during the Group By operation - * - * - * @return - * @throws TDGWTServiceException - */ - public GroupByMonitor getGroupByMonitor() throws TDGWTServiceException; + /** * Start group by @@ -884,44 +694,27 @@ public interface TDGWTService extends RemoteService { OccurrencesForReplaceBatchColumnSession occurrencesForReplaceBatchColumnSession) throws TDGWTServiceException; - /** - * Get Operation Monitor during the batch replace on column - * - * - * @return - * @throws TDGWTServiceException - */ - public ReplaceBatchColumnMonitor getReplaceBatchColumnMonitor() - throws TDGWTServiceException; - + /** * Start batch replace on column * * @param replaceBatchColumnSession + * @return * @throws TDGWTServiceException */ - public void startReplaceBatchColumn( + public String startReplaceBatchColumn( ReplaceBatchColumnSession replaceBatchColumnSession) throws TDGWTServiceException; // Replace Operation /** - * Get Operation Monitor during the replace the Column Value operation - * + * Start replace the column value * + * @param replaceColumnSession * @return * @throws TDGWTServiceException */ - public ReplaceColumnMonitor getReplaceColumnMonitor() - throws TDGWTServiceException; - - /** - * Start replace the column value - * - * @param labelColumnSession - * @throws TDGWTServiceException - */ - public void startReplaceColumn(ReplaceColumnSession replaceColumnSession) + public String startReplaceColumn(ReplaceColumnSession replaceColumnSession) throws TDGWTServiceException; // Templates @@ -934,22 +727,16 @@ public interface TDGWTService extends RemoteService { */ public ArrayList getTemplates() throws TDGWTServiceException; - /** - * Get Operation Monitor during Apply Template operation - * - * @return - * @throws TDGWTServiceException - */ - public TemplateApplyMonitor getTemplateApplyMonitor() - throws TDGWTServiceException; + /** * Start Apply Template * * @param templateApplySession + * @return * @throws TDGWTServiceException */ - void startTemplateApply(TemplateApplySession templateApplySession) + public String startTemplateApply(TemplateApplySession templateApplySession) throws TDGWTServiceException; /** @@ -958,7 +745,7 @@ public interface TDGWTService extends RemoteService { * @param templateDeleteSession * @throws TDGWTServiceException */ - void startTemplateDelete(TemplateDeleteSession templateDeleteSession) + public void templateDelete(TemplateDeleteSession templateDeleteSession) throws TDGWTServiceException; // Locales @@ -968,7 +755,7 @@ public interface TDGWTService extends RemoteService { * @return * @throws TDGWTServiceException */ - ArrayList getLocales() throws TDGWTServiceException; + public ArrayList getLocales() throws TDGWTServiceException; // History /** @@ -977,7 +764,7 @@ public interface TDGWTService extends RemoteService { * @return * @throws TDGWTServiceException */ - ArrayList getHistory() throws TDGWTServiceException; + public ArrayList getHistory() throws TDGWTServiceException; /** * Retrieve History for specific tabular resource @@ -986,14 +773,15 @@ public interface TDGWTService extends RemoteService { * @return * @throws TDGWTServiceException */ - ArrayList getHistory(TRId trId) throws TDGWTServiceException; + public ArrayList getHistory(TRId trId) + throws TDGWTServiceException; /** * * @return * @throws TDGWTServiceException */ - OpHistory getLastOperationInfo() throws TDGWTServiceException; + public OpHistory getLastOperationInfo() throws TDGWTServiceException; /** * @@ -1001,92 +789,96 @@ public interface TDGWTService extends RemoteService { * @return * @throws TDGWTServiceException */ - OpHistory getLastOperationInfo(TRId trId) throws TDGWTServiceException; + public OpHistory getLastOperationInfo(TRId trId) + throws TDGWTServiceException; // Helper Extract Codelist /** - * Get Operation Monitor during the Extract Codelist operation + * Start Extract Codelist and invokes the client library * + * + * @param extractCodelistSession * @return * @throws TDGWTServiceException */ - public ExtractCodelistMonitor getExtractCodelistMonitor() - throws TDGWTServiceException; - - /** - * Start Extract Codelist and invokes the client library - * - * @param extractCodelistSession - * @throws TDGWTServiceException - */ - public void startExtractCodelist( + public String startExtractCodelist( ExtractCodelistSession extractCodelistSession) throws TDGWTServiceException; // Helper Codelist Mapping Import - public CodelistMappingMonitor getCodelistMappingMonitor() - throws TDGWTServiceException; - + /** + * + * @param codelistMappingSession + * @throws TDGWTServiceException + */ public void setCodelistMappingSession( CodelistMappingSession codelistMappingSession) throws TDGWTServiceException; - + + /** + * + * @param codelistMappingSession + * @throws TDGWTServiceException + */ public void getFileFromWorkspace( CodelistMappingSession codelistMappingSession) throws TDGWTServiceException; - public void startCodelistMappingImport( + + /** + * Start Codelist Mapping Import + * + * @param codelistMappingSession + * @return + * @throws TDGWTServiceException + */ + public String startCodelistMappingImport( CodelistMappingSession codelistMappingSession) throws TDGWTServiceException; // Normalization - /** - * Get Operation Monitor during the Normalization operation - * - * @return - * @throws TDGWTServiceException - */ - public NormalizationMonitor getNormalizationMonitor() - throws TDGWTServiceException; - /** * Start Normalization and invokes the client library * * @param normalizationSession + * @return * @throws TDGWTServiceException */ - public void startNormalization(NormalizationSession normalizationSession) + public String startNormalization(NormalizationSession normalizationSession) throws TDGWTServiceException; // Denormalization - /** - * Get Operation Monitor during the denormalization operation - * - * @return - * @throws TDGWTServiceException - */ - public DenormalizationMonitor getDenormalizationMonitor() - throws TDGWTServiceException; - /** * Start Denormalization and invokes the client library * + * * @param denormalizationSession + * @return * @throws TDGWTServiceException */ - public void startDenormalization( + public String startDenormalization( DenormalizationSession denormalizationSession) throws TDGWTServiceException; - - + // Operation Monitor /** - * Get Operation Monitor + * Get Operation Monitor * * @return * @throws TDGWTServiceException */ - public OperationMonitor getOperationMonitor(OperationMonitorSession operationMonitorSession) + public OperationMonitor getOperationMonitor( + OperationMonitorSession operationMonitorSession) + throws TDGWTServiceException; + + // File Upload Monitor + /** + * Get File Upload Monitor during the file upload operation in Import CSV + * + * @return + * @throws TDGWTServiceException + */ + public FileUploadMonitor getFileUploadMonitor() throws TDGWTServiceException; } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java index 8889d5a..d612293 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java @@ -7,9 +7,7 @@ import java.util.ArrayList; import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList; -import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; -import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CheckCSVSession; import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession; @@ -17,33 +15,9 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor; import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence; import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.AddColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ChangeTableTypeMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.CloneMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.CodelistMappingMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DeleteColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DeleteRowsMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DenormalizationMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DuplicatesMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.EditRowMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ExtractCodelistMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.GroupByMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.LabelColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.MergeColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.NormalizationMonitor; import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ReplaceBatchColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ReplaceColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.RollBackSessionMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.SplitColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TaskResubmitMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TaskResumeMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TemplateApplyMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.UnionMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession; 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.share.ShareInfo; import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource; @@ -65,7 +39,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.DeleteColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.LabelColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnSession; -import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRMetadata; import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.DenormalizationSession; @@ -126,10 +99,8 @@ public interface TDGWTServiceAsync { void getConnection(RefColumn refColumn, AsyncCallback callback); //Task - void getTaskResubmitMonitor(AsyncCallback callback); - void startTaskResubmit(TaskResubmitSession taskResubmitSession,AsyncCallback callback); - void getTaskResumeMonitor(AsyncCallback callback); - void startTaskResume(TaskResumeSession taskResumeSession,AsyncCallback callback); + void startTaskResubmit(TaskResubmitSession taskResubmitSession,AsyncCallback callback); + void startTaskResume(TaskResumeSession taskResumeSession,AsyncCallback callback); //Validations @@ -139,8 +110,7 @@ public interface TDGWTServiceAsync { //RollBack - void rollBack(RollBackSession rollBackSession,AsyncCallback callback); - void getRollBackMonitor(AsyncCallback callback); + void startRollBack(RollBackSession rollBackSession,AsyncCallback callback); void discard(TRId trId,AsyncCallback callback); //Share @@ -156,11 +126,10 @@ public interface TDGWTServiceAsync { AsyncCallback callback); //Open - void startTDOpen(TDOpenSession tdOpenSession, AsyncCallback callback); + void tdOpen(TDOpenSession tdOpenSession, AsyncCallback callback); //Clone - void getCloneMonitor(AsyncCallback callback); - void startCloneTabularResource(CloneTabularResourceSession cloneTabularResourceSession, AsyncCallback callback); + String startCloneTabularResource(CloneTabularResourceSession cloneTabularResourceSession, AsyncCallback callback); //SDMX @@ -173,15 +142,10 @@ public interface TDGWTServiceAsync { void setSDMXRegistrySource(SDMXRegistrySource sdmxRegistrySource, AsyncCallback callback); //Import SDMX - void getSDMXImportMonitor(AsyncCallback callback); - - void startSDMXImport(SDMXImportSession sdmxImportSession,AsyncCallback callback); + void startSDMXImport(SDMXImportSession sdmxImportSession,AsyncCallback callback); - //File Upload Monitor - void getFileUploadMonitor(AsyncCallback callback); //Import CSV - void getCSVImportMonitor(AsyncCallback callback); void setCSVSession(CSVImportSession csvImportSession, AsyncCallback callback); @@ -193,70 +157,48 @@ public interface TDGWTServiceAsync { void checkCSV(long errorsLimit, AsyncCallback callback); - void startCSVImport(CSVImportSession csvImportSession, AsyncCallback callback); + void startCSVImport(CSVImportSession csvImportSession, AsyncCallback callback); //Export CSV - void getCSVExportMonitor(AsyncCallback callback); - - void startCSVExport(CSVExportSession csvExportSession, AsyncCallback callback); + void startCSVExport(CSVExportSession csvExportSession, AsyncCallback callback); //Export SDMX - void getSDMXExportMonitor(AsyncCallback callback); - void startSDMXExport(SDMXExportSession exportSession, AsyncCallback callback); + void startSDMXExport(SDMXExportSession exportSession, AsyncCallback callback); //Table Operation - void getChangeTableTypeMonitor(AsyncCallback callback); - void startChangeTableType(ChangeTableTypeSession changeTableTypeSession,AsyncCallback callback); - void getUnionMonitor(AsyncCallback callback); - void startUnion(UnionSession unionSession, AsyncCallback callback); + void startChangeTableType(ChangeTableTypeSession changeTableTypeSession,AsyncCallback callback); + void startUnion(UnionSession unionSession, AsyncCallback callback); - //Rows Operation - void getEditRowMonitor(AsyncCallback callback); - void startEditRow(EditRowSession editRowSession,AsyncCallback callback); - - void getDeleteRowsMonitor(AsyncCallback callback); - void startDeleteRows(DeleteRowsSession deleteRowsSession,AsyncCallback callback); - - void getDuplicatesMonitor(AsyncCallback callback); - void startDuplicates(DuplicatesSession duplicatesSession,AsyncCallback callback); - + void startEditRow(EditRowSession editRowSession,AsyncCallback callback); + void startDeleteRows(DeleteRowsSession deleteRowsSession,AsyncCallback callback); + void startDuplicates(DuplicatesSession duplicatesSession,AsyncCallback callback); //Column Operation - void getChangeColumnTypeMonitor(AsyncCallback callback); - void startChangeColumnType(ChangeColumnTypeSession changeColumnTypeSession,AsyncCallback callback); - void getAddColumnMonitor(AsyncCallback callback); - void startAddColumn(AddColumnSession addColumnSession,AsyncCallback callback); - void getDeleteColumnMonitor(AsyncCallback callback); - void startDeleteColumn(DeleteColumnSession deleteColumnSession,AsyncCallback callback); - void getLabelColumnMonitor(AsyncCallback callback); - void startLabelColumn(LabelColumnSession labelColumnSession,AsyncCallback callback); + void startChangeColumnType(ChangeColumnTypeSession changeColumnTypeSession,AsyncCallback callback); + void startAddColumn(AddColumnSession addColumnSession,AsyncCallback callback); + void startDeleteColumn(DeleteColumnSession deleteColumnSession,AsyncCallback callback); + void startLabelColumn(LabelColumnSession labelColumnSession,AsyncCallback callback); - void getSplitColumnMonitor(AsyncCallback callback); /*void startSplitColumn(SplitColumnSession splitColumnSession,AsyncCallback callback);*/ - void getMergeColumnMonitor(AsyncCallback callback); /*void startSplitColumn(MergeColumnSession mergeColumnSession,AsyncCallback callback); */ - void getGroupByMonitor(AsyncCallback callback); /*void startGroupBy(GroupBySession groupBySession,AsyncCallback callback);*/ //BatchReplace Operation void getOccurrencesForBatchReplace(OccurrencesForReplaceBatchColumnSession occurrencesForReplaceBatchColumnSession, AsyncCallback> callback); - void getReplaceBatchColumnMonitor(AsyncCallback callback); - void startReplaceBatchColumn(ReplaceBatchColumnSession replaceBatchColumnSession,AsyncCallback callback); + void startReplaceBatchColumn(ReplaceBatchColumnSession replaceBatchColumnSession,AsyncCallback callback); //Replace Operation - void getReplaceColumnMonitor(AsyncCallback callback); - void startReplaceColumn(ReplaceColumnSession replaceColumnSession,AsyncCallback callback); + void startReplaceColumn(ReplaceColumnSession replaceColumnSession,AsyncCallback callback); //Templates void getTemplates(AsyncCallback> callback); - void getTemplateApplyMonitor(AsyncCallback callback); - void startTemplateApply(TemplateApplySession templateDeleteSession,AsyncCallback callback); - void startTemplateDelete(TemplateDeleteSession templateDeleteSession,AsyncCallback callback); + void startTemplateApply(TemplateApplySession templateDeleteSession,AsyncCallback callback); + void templateDelete(TemplateDeleteSession templateDeleteSession,AsyncCallback callback); //Locales void getLocales(AsyncCallback> callback); @@ -268,25 +210,24 @@ public interface TDGWTServiceAsync { void getLastOperationInfo(TRId trId, AsyncCallback callback); //Helper Extract Codelist - void getExtractCodelistMonitor(AsyncCallback callback); - void startExtractCodelist(ExtractCodelistSession extractCodelistSession, AsyncCallback callback); + void startExtractCodelist(ExtractCodelistSession extractCodelistSession, AsyncCallback callback); //Helper Codelist Mapping Import - void getCodelistMappingMonitor(AsyncCallback callback); void setCodelistMappingSession(CodelistMappingSession codelistMappingSession, AsyncCallback callback); void getFileFromWorkspace(CodelistMappingSession codelistMappingSession, AsyncCallback callback); - void startCodelistMappingImport(CodelistMappingSession codelistMappingSession, AsyncCallback callback); + void startCodelistMappingImport(CodelistMappingSession codelistMappingSession, AsyncCallback callback); //Normalization - void getNormalizationMonitor(AsyncCallback callback); - void startNormalization(NormalizationSession normalizationSession, AsyncCallback callback); + void startNormalization(NormalizationSession normalizationSession, AsyncCallback callback); //Denormalization - void getDenormalizationMonitor(AsyncCallback callback); - void startDenormalization(DenormalizationSession denormalizationSession, AsyncCallback callback); + void startDenormalization(DenormalizationSession denormalizationSession, AsyncCallback callback); //Operation Monitor void getOperationMonitor(OperationMonitorSession operationMonitorSession, AsyncCallback callback); + //File Upload Monitor + void getFileUploadMonitor(AsyncCallback callback); + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java index 64610cf..35fa157 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CSVImportFileServlet.java @@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory; /** + * Returns a representation of the csv file in JSON * * @author "Giancarlo Panichi" * g.panichi@isti.cnr.it diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CodelistMappingUploadServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CodelistMappingUploadServlet.java index 23636ca..65b5c7f 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CodelistMappingUploadServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/CodelistMappingUploadServlet.java @@ -24,7 +24,6 @@ import org.gcube.portlets.user.td.gwtservice.server.file.FileUtil; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor; import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.CodelistMappingMonitor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,12 +61,12 @@ public class CodelistMappingUploadServlet extends HttpServlet { logger.info("Codelist Mapping session id: "+session.getId()); CodelistMappingFileUploadSession codelistMappingFileUploadSession=new CodelistMappingFileUploadSession(); - CodelistMappingMonitor codelistMappingMonitor=new CodelistMappingMonitor(); + //CodelistMappingMonitor codelistMappingMonitor=new CodelistMappingMonitor(); FileUploadMonitor fileUploadMonitor=new FileUploadMonitor(); codelistMappingFileUploadSession.setId(session.getId()); codelistMappingFileUploadSession.setFileUploadState(FileUploadState.STARTED); - codelistMappingFileUploadSession.setCodelistMappingMonitor(codelistMappingMonitor); + //codelistMappingFileUploadSession.setCodelistMappingMonitor(codelistMappingMonitor); SessionUtil.setFileUploadMonitor(session,fileUploadMonitor); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java index ecce3f5..ac9aa08 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/LocalUploadServlet.java @@ -18,10 +18,9 @@ import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; -import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadListener; import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession; +import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadListener; import org.gcube.portlets.user.td.gwtservice.server.file.FileUtil; -import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor; import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState; @@ -62,12 +61,12 @@ public class LocalUploadServlet extends HttpServlet { logger.info("CSV Import session id: "+session.getId()); CSVFileUploadSession fileUploadSession=new CSVFileUploadSession(); - CSVImportMonitor csvImportMonitor=new CSVImportMonitor(); + //CSVImportMonitor csvImportMonitor=new CSVImportMonitor(); FileUploadMonitor fileUploadMonitor=new FileUploadMonitor(); fileUploadSession.setId(session.getId()); fileUploadSession.setFileUploadState(FileUploadState.STARTED); - fileUploadSession.setCsvImportMonitor(csvImportMonitor); + //fileUploadSession.setCsvImportMonitor(csvImportMonitor); SessionUtil.setFileUploadMonitor(session, fileUploadMonitor); diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java index c4844be..2528573 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java @@ -1,137 +1,89 @@ package org.gcube.portlets.user.td.gwtservice.server; +/** + * + * @author "Giancarlo Panichi" + * email: g.panichi@isti.cnr.it + * + */ public class SessionConstants { protected static final String CURRENT_TABULAR_RESOURCE = "CURRENT_TABULAR_RESOURCE"; protected static final String CURRENT_TR_ID = "CURRENT_TR_ID"; protected static final String TDOPEN_SESSION = "TDOPEN_SESSION"; protected static final String TABULAR_RESOURCE_LIST = "TABULAR_RESOURCE_LIST"; - protected static final String OPERATIONS_TASKS="OPERATION_TASKS"; - + protected static final String OPERATIONS_TASKS_STARTED="OPERATION_TASKS_STARTED"; + protected static final String FILE_UPLOAD_MONITOR = "FILE_UPLOAD_MONITOR"; + protected static final String TR_TASK_MANAGER = "TR_TASK_MANAGER"; protected static final String SDMX_REGISTRY_SOURCE = "SDMX_REGISTRY_SOURCE"; - - protected static final String SDMX_CLIENT_ATTRIBUTE = "SDMX_CLIENT"; protected static final String SDMX_IMPORT_SESSION = "SDMX_IMPORT"; protected static final String SDMX_IMPORT_TABULAR_RESOURCE = "SDMX_IMPORT_TABULAR_RESOURCE"; - protected static final String SDMX_IMPORT_TASK = "SDMX_IMPORT_TASK"; - + protected static final String SDMX_EXPORT_SESSION = "SDMX_EXPORT_SESSION"; - protected static final String SDMX_EXPORT_TASK = "SDMX_EXPORT_TASK"; - + protected static final String CSV_IMPORT_SESSION = "CSV_IMPORT"; protected static final String CSV_IMPORT_FILE_UPLOAD_SESSION = "CSV_IMPORT_FILE_UPLOAD"; - protected static final String CSV_IMPORT_TASK = "CSV_IMPORT_TASK"; protected static final String CSV_IMPORT_TABULAR_RESOURCE = "CSV_IMPORT_TABULAR_RESOURCE"; protected static final String CSV_EXPORT_SESSION = "CSV_EXPORT_SESSION"; - protected static final String CSV_EXPORT_TASK = "CSV_EXPORT_TASK"; protected static final String CSV_EXPORT_END = "CSV_EXPORT_END"; - protected static final String CSV_EXPORT_MONITOR = "CSV_EXPORT_MONITOR"; protected static final String CLONE_TABULAR_RESOURCE_SESSION = "CLONE_TABULAR_RESOURCE_SESSION"; - protected static final String CLONE_TABULAR_RESOURCE_MONITOR = "CLONE_TABULAR_RESOURCE_MONITOR"; - protected static final String CLONE_TABULAR_RESOURCE_TASK = "CLONE_TABULAR_RESOURCE_TASK"; - protected static final String CHANGE_COLUMN_TYPE_SESSION = "CHANGE_COLUMN_TYPE_SESSION"; - protected static final String CHANGE_COLUMN_TYPE_MONITOR = "CHANGE_COLUMN_TYPE_MONITOR"; - protected static final String CHANGE_COLUMN_TYPE_TASK = "CHANGE_COLUMN_TYPE_TASK"; - + protected static final String ADD_COLUMN_SESSION = "ADD_COLUMN_SESSION"; - protected static final String ADD_COLUMN_MONITOR = "ADD_COLUMN_MONITOR"; - protected static final String ADD_COLUMN_TASK = "ADD_COLUMN_TASK"; protected static final String DELETE_COLUMN_SESSION = "DELETE_COLUMN_SESSION"; - protected static final String DELETE_COLUMN_MONITOR = "DELETE_COLUMN_MONITOR"; - protected static final String DELETE_COLUMN_TASK = "DELETE_COLUMN_TASK"; protected static final String EDIT_ROW_SESSION = "EDIT_ROW_SESSION"; - protected static final String EDIT_ROW_MONITOR = "EDIT_ROW_MONITOR"; - protected static final String EDIT_ROW_TASK = "EDIT_ROW_TASK"; protected static final String TASK_RESUBMIT_SESSION = "TASK_RESUBMIT_SESSION"; - protected static final String TASK_RESUBMIT_MONITOR = "TASK_RESUBMIT_MONITOR"; - protected static final String TASK_RESUBMIT_TASK = "TASK_RESUBMIT_TASK"; protected static final String TASK_RESUME_SESSION = "TASK_RESUME_SESSION"; - protected static final String TASK_RESUME_MONITOR = "TASK_RESUME_MONITOR"; - protected static final String TASK_RESUME_TASK = "TASK_RESUME_TASK"; protected static final String REPLACE_COLUMN_SESSION = "REPLACE_COLUMN_SESSION"; - protected static final String REPLACE_COLUMN_MONITOR = "REPLACE_COLUMN_MONITOR"; - protected static final String REPLACE_COLUMN_TASK = "REPLACE_COLUMN_TASK"; protected static final String GROUPBY_SESSION = "GROUPBY_SESSION"; - protected static final String GROUPBY_MONITOR = "GROUPBY_MONITOR"; - protected static final String GROUPBY_TASK = "GROUPBY_TASK"; protected static final String UNION_SESSION = "UNION_SESSION"; - protected static final String UNION_MONITOR = "UNION_MONITOR"; - protected static final String UNION_TASK = "UNION_TASK"; protected static final String NORMALIZATION_SESSION = "NORMALIZATION_SESSION"; - protected static final String NORMALIZATION_MONITOR = "NORMALIZATION_MONITOR"; - protected static final String NORMALIZATION_TASK = "NORMALIZATION_TASK"; protected static final String DENORMALIZATION_SESSION = "DENORMALIZATION_SESSION"; - protected static final String DENORMALIZATION_MONITOR = "DENORMALIZATION_MONITOR"; - protected static final String DENORMALIZATION_TASK = "DENORMALIZATION_TASK"; protected static final String REPLACE_BATCH_COLUMN_SESSION = "REPLACE_BATCH_COLUMN_SESSION"; - protected static final String REPLACE_BATCH_COLUMN_MONITOR = "REPLACE_BATCH_COLUMN_MONITOR"; - protected static final String REPLACE_BATCH_COLUMN_TASK = "REPLACE_BATCH_COLUMN_TASK"; protected static final String CHANGE_THE_COLUMN_LABEL_SESSION = "CHANGE_THE_COLUMN_LABEL_SESSION"; - protected static final String CHANGE_THE_COLUMN_LABEL_MONITOR = "CHANGE_THE_COLUMN_LABEL_MONITOR"; - protected static final String CHANGE_THE_COLUMN_LABEL_TASK = "CHANGE_THE_COLUMN_LABEL_TASK"; - + protected static final String CHANGE_TABLE_TYPE_SESSION = "CHANGE_TABLE_TYPE_SESSION"; - protected static final String CHANGE_TABLE_TYPE_MONITOR = "CHANGE_TABLE_TYPE_MONITOR"; - protected static final String CHANGE_TABLE_TYPE_TASK = "CHANGE_TABLE_TYPE_TASK"; - + protected static final String DELETE_ROWS_SESSION = "DELETE_ROWS_SESSION"; - protected static final String DELETE_ROWS_MONITOR = "DELETE_ROWS_MONITOR"; - protected static final String DELETE_ROWS_TASK = "DELETE_ROWS_TASK"; - + protected static final String DUPLICATES_ROWS_SESSION = "DUPLICATES_ROWS_SESSION"; - protected static final String DUPLICATES_ROWS_MONITOR = "DUPLICATES_ROWS_MONITOR"; - protected static final String DUPLICATES_ROWS_TASK = "DUPLICATES_ROWS_TASK"; - + protected static final String TEMPLATE_APPLY_SESSION = "TEMPLATE_APPLY_SESSION"; - protected static final String TEMPLATE_APPLY_MONITOR = "TEMPLATE_APPLY_MONITOR"; - protected static final String TEMPLATE_APPLY_TASK = "TEMPLATE_APPLY_TASK"; - + protected static final String CODELISTS_PAGING_LOADED = "CODELISTS_PAGING_LOADED"; protected static final String CODELISTS_PAGING_LOADED_FILTERED_COPY = "CODELISTS_PAGING_LOADED_FILTERED_COPY"; protected static final String CODELISTS_PAGING_LOADED_FILTER = "CODELISTS_PAGING_LOADED_FILTER"; protected static final String ROLLBACK_SESSION = "ROLLBACK_SESSION"; - protected static final String ROLLBACK_MONITOR = "ROLLBACK_MONITOR"; - protected static final String ROLLBACK_TASK = "ROLLBACK_TASK"; protected static final String EXTRACT_CODELIST_SESSION = "EXTRACT_CODELIST_SESSION"; - protected static final String EXTRACT_CODELIST_MONITOR = "EXTRACT_CODELIST_MONITOR"; - protected static final String EXTRACT_CODELIST_TASK = "EXTRACT_CODELIST_TASK"; - + protected static final String SPLIT_COLUMN_SESSION = "SPLIT_COLUMN_SESSION"; - protected static final String SPLIT_COLUMN_MONITOR = "SPLIT_COLUMN_MONITOR"; - protected static final String SPLIT_COLUMN_TASK = "SPLIT_COLUMN_TASK"; protected static final String MERGE_COLUMN_SESSION = "MERGE_COLUMN_SESSION"; - protected static final String MERGE_COLUMN_MONITOR = "MERGE_COLUMN_MONITOR"; - protected static final String MERGE_COLUMN_TASK = "MERGE_COLUMN_TASK"; protected static final String CODELIST_MAPPING_SESSION = "CODELIST_MAPPING_SESSION"; protected static final String CODELIST_MAPPING_FILE_UPLOAD_SESSION = "CODELIST_MAPPING_FILE_UPLOAD_SESSION"; - protected static final String CODELIST_MAPPING_TASK = "CODELIST_MAPPING_TASK"; - protected static final String CODELIST_MAPPING_MONITOR = "CODELIST_MAPPING_MONITOR"; - protected static final String FILE_UPLOAD_MONITOR = "FILE_UPLOAD_MONITOR"; - + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java index 4c75840..d243cf8 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionUtil.java @@ -12,7 +12,6 @@ import javax.servlet.http.HttpSession; import org.gcube.application.framework.core.session.ASLSession; import org.gcube.application.framework.core.session.SessionManager; import org.gcube.common.scope.api.ScopeProvider; -import org.gcube.data.analysis.tabulardata.service.operation.Task; import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource; import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession; @@ -25,33 +24,12 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpire import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession; import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.AddColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ChangeTableTypeMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.CloneMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.CodelistMappingMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DeleteColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DeleteRowsMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DenormalizationMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DuplicatesMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.EditRowMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ExtractCodelistMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.GroupByMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.LabelColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.MergeColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.NormalizationMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ReplaceBatchColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ReplaceColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.RollBackSessionMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.SplitColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TaskResubmitMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TaskResumeMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TemplateApplyMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.UnionMonitor; import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession; 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.TaskResubmitSession; import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession; +import org.gcube.portlets.user.td.gwtservice.shared.task.TaskWrapper; import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceBatchColumnSession; @@ -62,7 +40,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.column.LabelColumnSession import org.gcube.portlets.user.td.gwtservice.shared.tr.column.MergeColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.SplitColumnSession; -import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.groupby.GroupBySession; import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.DenormalizationSession; @@ -87,27 +64,27 @@ import org.slf4j.LoggerFactory; * */ public class SessionUtil { - + protected static Logger logger = LoggerFactory.getLogger(SessionUtil.class); - public static ASLSession getAslSession(HttpSession httpSession) throws TDGWTSessionExpiredException { + public static ASLSession getAslSession(HttpSession httpSession) + throws TDGWTSessionExpiredException { String username = (String) httpSession .getAttribute(ScopeHelper.USERNAME_ATTRIBUTE); ASLSession session; if (username == null) { logger.warn("no user found in session, using test one"); throw new TDGWTSessionExpiredException("Session Expired!"); - - //Remove comment for Test - /* - username = Constants.DEFAULT_USER; - String scope = Constants.DEFAULT_SCOPE; - httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, username); - session = SessionManager.getInstance().getASLSession( - httpSession.getId(), username); - session.setScope(scope); - */ + // Remove comment for Test + /* + * username = Constants.DEFAULT_USER; String scope = + * Constants.DEFAULT_SCOPE; + * + * httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, + * username); session = SessionManager.getInstance().getASLSession( + * httpSession.getId(), username); session.setScope(scope); + */ } else { session = SessionManager.getInstance().getASLSession( httpSession.getId(), username); @@ -121,7 +98,8 @@ public class SessionUtil { } - public static void setTDOpenSession(HttpSession httpSession, TDOpenSession s) throws TDGWTSessionExpiredException { + public static void setTDOpenSession(HttpSession httpSession, TDOpenSession s) + throws TDGWTSessionExpiredException { TDOpenSession session = (TDOpenSession) httpSession .getAttribute(SessionConstants.TDOPEN_SESSION); @@ -155,15 +133,18 @@ public class SessionUtil { } public static TRId getTRId(HttpSession httpSession) { - TRId id = (TRId) httpSession.getAttribute(SessionConstants.CURRENT_TR_ID); + TRId id = (TRId) httpSession + .getAttribute(SessionConstants.CURRENT_TR_ID); if (id == null) { logger.error("TR_ID was not acquired"); } return id; } - public static void setTRId(HttpSession httpSession, TRId trId) throws TDGWTSessionExpiredException { - TRId id = (TRId) httpSession.getAttribute(SessionConstants.CURRENT_TR_ID); + public static void setTRId(HttpSession httpSession, TRId trId) + throws TDGWTSessionExpiredException { + TRId id = (TRId) httpSession + .getAttribute(SessionConstants.CURRENT_TR_ID); if (id != null) httpSession.removeAttribute(SessionConstants.CURRENT_TR_ID); httpSession.setAttribute(SessionConstants.CURRENT_TR_ID, trId); @@ -185,8 +166,10 @@ public class SessionUtil { TabResource t = (TabResource) httpSession .getAttribute(SessionConstants.CURRENT_TABULAR_RESOURCE); if (t != null) - httpSession.removeAttribute(SessionConstants.CURRENT_TABULAR_RESOURCE); - httpSession.setAttribute(SessionConstants.CURRENT_TABULAR_RESOURCE, tabResource); + httpSession + .removeAttribute(SessionConstants.CURRENT_TABULAR_RESOURCE); + httpSession.setAttribute(SessionConstants.CURRENT_TABULAR_RESOURCE, + tabResource); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } @@ -205,8 +188,10 @@ public class SessionUtil { TabResource t = (TabResource) httpSession .getAttribute(SessionConstants.SDMX_IMPORT_TABULAR_RESOURCE); if (t != null) - httpSession.removeAttribute(SessionConstants.SDMX_IMPORT_TABULAR_RESOURCE); - httpSession.setAttribute(SessionConstants.SDMX_IMPORT_TABULAR_RESOURCE, tabResource); + httpSession + .removeAttribute(SessionConstants.SDMX_IMPORT_TABULAR_RESOURCE); + httpSession.setAttribute(SessionConstants.SDMX_IMPORT_TABULAR_RESOURCE, + tabResource); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } @@ -226,8 +211,10 @@ public class SessionUtil { TabResource t = (TabResource) httpSession .getAttribute(SessionConstants.CSV_IMPORT_TABULAR_RESOURCE); if (t != null) - httpSession.removeAttribute(SessionConstants.CSV_IMPORT_TABULAR_RESOURCE); - httpSession.setAttribute(SessionConstants.CSV_IMPORT_TABULAR_RESOURCE, tabResource); + httpSession + .removeAttribute(SessionConstants.CSV_IMPORT_TABULAR_RESOURCE); + httpSession.setAttribute(SessionConstants.CSV_IMPORT_TABULAR_RESOURCE, + tabResource); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } @@ -324,13 +311,16 @@ public class SessionUtil { CSVFileUploadSession session = (CSVFileUploadSession) httpSession .getAttribute(SessionConstants.CSV_IMPORT_FILE_UPLOAD_SESSION); if (session != null) - httpSession.removeAttribute(SessionConstants.CSV_IMPORT_FILE_UPLOAD_SESSION); - httpSession.setAttribute(SessionConstants.CSV_IMPORT_FILE_UPLOAD_SESSION, s); + httpSession + .removeAttribute(SessionConstants.CSV_IMPORT_FILE_UPLOAD_SESSION); + httpSession.setAttribute( + SessionConstants.CSV_IMPORT_FILE_UPLOAD_SESSION, s); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } - public static CSVFileUploadSession getCSVFileUploadSession(HttpSession httpSession) { + public static CSVFileUploadSession getCSVFileUploadSession( + HttpSession httpSession) { CSVFileUploadSession fileUploadSession = (CSVFileUploadSession) httpSession .getAttribute(SessionConstants.CSV_IMPORT_FILE_UPLOAD_SESSION); if (fileUploadSession == null) { @@ -339,20 +329,23 @@ public class SessionUtil { return fileUploadSession; } - - public static void setCodelistMappingFileUploadSession(HttpSession httpSession, - CodelistMappingFileUploadSession s) throws TDGWTSessionExpiredException { + public static void setCodelistMappingFileUploadSession( + HttpSession httpSession, CodelistMappingFileUploadSession s) + throws TDGWTSessionExpiredException { CodelistMappingFileUploadSession session = (CodelistMappingFileUploadSession) httpSession .getAttribute(SessionConstants.CODELIST_MAPPING_FILE_UPLOAD_SESSION); if (session != null) - httpSession.removeAttribute(SessionConstants.CODELIST_MAPPING_FILE_UPLOAD_SESSION); - httpSession.setAttribute(SessionConstants.CODELIST_MAPPING_FILE_UPLOAD_SESSION, s); + httpSession + .removeAttribute(SessionConstants.CODELIST_MAPPING_FILE_UPLOAD_SESSION); + httpSession.setAttribute( + SessionConstants.CODELIST_MAPPING_FILE_UPLOAD_SESSION, s); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } - public static CodelistMappingFileUploadSession getCodelistMappingFileUploadSession(HttpSession httpSession) { + public static CodelistMappingFileUploadSession getCodelistMappingFileUploadSession( + HttpSession httpSession) { CodelistMappingFileUploadSession fileUploadSession = (CodelistMappingFileUploadSession) httpSession .getAttribute(SessionConstants.CODELIST_MAPPING_FILE_UPLOAD_SESSION); if (fileUploadSession == null) { @@ -361,32 +354,6 @@ public class SessionUtil { return fileUploadSession; } - // - public static FileUploadMonitor getFileUploadMonitor( - HttpSession httpSession) { - FileUploadMonitor fileUploadMonitor = (FileUploadMonitor) httpSession - .getAttribute(SessionConstants.FILE_UPLOAD_MONITOR); - if (fileUploadMonitor != null) { - return fileUploadMonitor; - } else { - fileUploadMonitor = new FileUploadMonitor(); - httpSession - .setAttribute(SessionConstants.FILE_UPLOAD_MONITOR, fileUploadMonitor); - return fileUploadMonitor; - } - } - - public static void setFileUploadMonitor(HttpSession httpSession, - FileUploadMonitor fileUploadMonitor) { - FileUploadMonitor fum = (FileUploadMonitor) httpSession - .getAttribute(SessionConstants.FILE_UPLOAD_MONITOR); - if (fum != null) { - httpSession.removeAttribute(SessionConstants.FILE_UPLOAD_MONITOR); - } - httpSession.setAttribute(SessionConstants.FILE_UPLOAD_MONITOR, fileUploadMonitor); - - } - // public static ArrayList retrieveCodelists(HttpSession httpSession) throws Exception { @@ -416,13 +383,15 @@ public class SessionUtil { } public static void setSDMXRegistrySource(HttpSession httpSession, - SDMXRegistrySource sdmxRegistrySource) throws TDGWTSessionExpiredException { + SDMXRegistrySource sdmxRegistrySource) + throws TDGWTSessionExpiredException { SDMXRegistrySource source = (SDMXRegistrySource) httpSession .getAttribute(SessionConstants.SDMX_REGISTRY_SOURCE); if (source != null) httpSession.removeAttribute(SessionConstants.SDMX_REGISTRY_SOURCE); - httpSession.setAttribute(SessionConstants.SDMX_REGISTRY_SOURCE, sdmxRegistrySource); + httpSession.setAttribute(SessionConstants.SDMX_REGISTRY_SOURCE, + sdmxRegistrySource); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } @@ -467,67 +436,25 @@ public class SessionUtil { } } } - httpSession.setAttribute(SessionConstants.SDMX_CLIENT_ATTRIBUTE, sdmxClient); + httpSession.setAttribute(SessionConstants.SDMX_CLIENT_ATTRIBUTE, + sdmxClient); } return sdmxClient; } - public static Task getSDMXImportTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.SDMX_IMPORT_TASK); - if (monitor == null) { - logger.error("SDMX_IMPORT_TASK was not acquired"); - } - return monitor; - } - - public static void setSDMXImportTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.SDMX_IMPORT_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.SDMX_IMPORT_TASK); - httpSession.setAttribute(SessionConstants.SDMX_IMPORT_TASK, task); - } - - public static Task getCSVImportFileTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CSV_IMPORT_TASK); - if (monitor == null) { - logger.error("CSV_IMPORT_TASK was not acquired"); - } - return monitor; - } - - public static void setCSVImportFileTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CSV_IMPORT_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.CSV_IMPORT_TASK); - httpSession.setAttribute(SessionConstants.CSV_IMPORT_TASK, task); - } - - public static Task getCSVExportTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CSV_EXPORT_TASK); - if (monitor == null) { - logger.error("CSV_EXPORT_TASK was not acquired"); - } - return monitor; - } - - public static void setCSVExportTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CSV_EXPORT_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.CSV_EXPORT_TASK); - httpSession.setAttribute(SessionConstants.CSV_EXPORT_TASK, task); - } - public static void setCSVExportEnd(HttpSession httpSession, Boolean end) { - Boolean fin = (Boolean) httpSession.getAttribute(SessionConstants.CSV_EXPORT_END); + Boolean fin = (Boolean) httpSession + .getAttribute(SessionConstants.CSV_EXPORT_END); if (fin != null) httpSession.removeAttribute(SessionConstants.CSV_EXPORT_END); httpSession.setAttribute(SessionConstants.CSV_EXPORT_END, end); } public static Boolean getCSVExportEnd(HttpSession httpSession) { - Boolean end = (Boolean) httpSession.getAttribute(SessionConstants.CSV_EXPORT_END); + Boolean end = (Boolean) httpSession + .getAttribute(SessionConstants.CSV_EXPORT_END); logger.debug("getCSVExportEnd(): " + end); if (end == null) { logger.error("CSV_EXPORT_END was not acquired"); @@ -536,21 +463,6 @@ public class SessionUtil { return end; } - public static Task getSDMXExportTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.SDMX_EXPORT_TASK); - if (monitor == null) { - logger.error("SDMX_EXPORT_TASK was not acquired"); - } - return monitor; - } - - public static void setSDMXExportTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.SDMX_EXPORT_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.SDMX_EXPORT_TASK); - httpSession.setAttribute(SessionConstants.SDMX_EXPORT_TASK, task); - } - public static TRTasksManager getTRTasksManager(HttpSession httpSession) { TRTasksManager tasksManager = (TRTasksManager) httpSession .getAttribute(SessionConstants.TR_TASK_MANAGER); @@ -558,7 +470,8 @@ public class SessionUtil { return tasksManager; } else { tasksManager = new TRTasksManager(); - httpSession.setAttribute(SessionConstants.TR_TASK_MANAGER, tasksManager); + httpSession.setAttribute(SessionConstants.TR_TASK_MANAGER, + tasksManager); return tasksManager; } } @@ -570,7 +483,8 @@ public class SessionUtil { if (tm != null) { httpSession.removeAttribute(SessionConstants.TR_TASK_MANAGER); } - httpSession.setAttribute(SessionConstants.TR_TASK_MANAGER, trTasksManager); + httpSession.setAttribute(SessionConstants.TR_TASK_MANAGER, + trTasksManager); } @@ -583,7 +497,8 @@ public class SessionUtil { return changeColumnTypeSession; } else { changeColumnTypeSession = new ChangeColumnTypeSession(); - httpSession.setAttribute(SessionConstants.CHANGE_COLUMN_TYPE_SESSION, + httpSession.setAttribute( + SessionConstants.CHANGE_COLUMN_TYPE_SESSION, changeColumnTypeSession); return changeColumnTypeSession; } @@ -594,55 +509,14 @@ public class SessionUtil { ChangeColumnTypeSession ct = (ChangeColumnTypeSession) httpSession .getAttribute(SessionConstants.CHANGE_COLUMN_TYPE_SESSION); if (ct != null) { - httpSession.removeAttribute(SessionConstants.CHANGE_COLUMN_TYPE_SESSION); + httpSession + .removeAttribute(SessionConstants.CHANGE_COLUMN_TYPE_SESSION); } httpSession.setAttribute(SessionConstants.CHANGE_COLUMN_TYPE_SESSION, changeColumnTypeSession); } - public static ChangeColumnTypeMonitor getChangeColumnTypeMonitor( - HttpSession httpSession) { - ChangeColumnTypeMonitor changeColumnTypeMonitor = (ChangeColumnTypeMonitor) httpSession - .getAttribute(SessionConstants.CHANGE_COLUMN_TYPE_MONITOR); - if (changeColumnTypeMonitor != null) { - return changeColumnTypeMonitor; - } else { - changeColumnTypeMonitor = new ChangeColumnTypeMonitor(); - httpSession.setAttribute(SessionConstants.CHANGE_COLUMN_TYPE_MONITOR, - changeColumnTypeMonitor); - return changeColumnTypeMonitor; - } - } - - public static void setChangeColumnTypeMonitor(HttpSession httpSession, - ChangeColumnTypeMonitor changeColumnTypeMonitor) { - ChangeColumnTypeMonitor cm = (ChangeColumnTypeMonitor) httpSession - .getAttribute(SessionConstants.CHANGE_COLUMN_TYPE_MONITOR); - if (cm != null) { - httpSession.removeAttribute(SessionConstants.CHANGE_COLUMN_TYPE_MONITOR); - } - httpSession.setAttribute(SessionConstants.CHANGE_COLUMN_TYPE_MONITOR, - changeColumnTypeMonitor); - - } - - public static Task getChangeColumnTypeTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CHANGE_COLUMN_TYPE_TASK); - if (monitor == null) { - logger.error("CHANGE_COLUMN_TYPE_TASK was not acquired"); - } - return monitor; - } - - public static void setChangeColumnTypeTask(HttpSession httpSession, - Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CHANGE_COLUMN_TYPE_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.CHANGE_COLUMN_TYPE_TASK); - httpSession.setAttribute(SessionConstants.CHANGE_COLUMN_TYPE_TASK, task); - } - // / public static LabelColumnSession getLabelColumnSession( @@ -653,7 +527,8 @@ public class SessionUtil { return labelColumnSession; } else { labelColumnSession = new LabelColumnSession(); - httpSession.setAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION, + httpSession.setAttribute( + SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION, labelColumnSession); return labelColumnSession; } @@ -664,68 +539,26 @@ public class SessionUtil { LabelColumnSession lc = (LabelColumnSession) httpSession .getAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION); if (lc != null) { - httpSession.removeAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION); + httpSession + .removeAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION); } - httpSession.setAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION, + httpSession.setAttribute( + SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION, labelColumnSession); } - public static LabelColumnMonitor getLabelColumnMonitor( - HttpSession httpSession) { - LabelColumnMonitor labelColumnMonitor = (LabelColumnMonitor) httpSession - .getAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_MONITOR); - if (labelColumnMonitor != null) { - return labelColumnMonitor; - } else { - labelColumnMonitor = new LabelColumnMonitor(); - httpSession.setAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_MONITOR, - labelColumnMonitor); - return labelColumnMonitor; - } - } - - public static void setLabelColumnMonitor(HttpSession httpSession, - LabelColumnMonitor labelColumnMonitor) { - LabelColumnMonitor lc = (LabelColumnMonitor) httpSession - .getAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_MONITOR); - if (lc != null) { - httpSession.removeAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_MONITOR); - } - httpSession.setAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_MONITOR, - labelColumnMonitor); - - } - - public static Task getLabelColumnTask(HttpSession httpSession) { - Task monitor = (Task) httpSession - .getAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_TASK); - if (monitor == null) { - logger.error("CHANGE_THE_COLUMN_LABEL_TASK was not acquired"); - } - return monitor; - } - - public static void setLabelColumnTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession - .getAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_TASK); - httpSession.setAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_TASK, task); - } - // - public static AddColumnSession getAddColumnSession( - HttpSession httpSession) { + public static AddColumnSession getAddColumnSession(HttpSession httpSession) { AddColumnSession addColumnSession = (AddColumnSession) httpSession .getAttribute(SessionConstants.ADD_COLUMN_SESSION); if (addColumnSession != null) { return addColumnSession; } else { addColumnSession = new AddColumnSession(); - httpSession - .setAttribute(SessionConstants.ADD_COLUMN_SESSION, addColumnSession); + httpSession.setAttribute(SessionConstants.ADD_COLUMN_SESSION, + addColumnSession); return addColumnSession; } } @@ -737,51 +570,11 @@ public class SessionUtil { if (ac != null) { httpSession.removeAttribute(SessionConstants.ADD_COLUMN_SESSION); } - httpSession.setAttribute(SessionConstants.ADD_COLUMN_SESSION, addColumnSession); + httpSession.setAttribute(SessionConstants.ADD_COLUMN_SESSION, + addColumnSession); } - public static AddColumnMonitor getAddColumnMonitor( - HttpSession httpSession) { - AddColumnMonitor addColumnMonitor = (AddColumnMonitor) httpSession - .getAttribute(SessionConstants.ADD_COLUMN_MONITOR); - if (addColumnMonitor != null) { - return addColumnMonitor; - } else { - addColumnMonitor = new AddColumnMonitor(); - httpSession - .setAttribute(SessionConstants.ADD_COLUMN_MONITOR, addColumnMonitor); - return addColumnMonitor; - } - } - - public static void setAddColumnMonitor(HttpSession httpSession, - AddColumnMonitor addColumnMonitor) { - AddColumnMonitor cm = (AddColumnMonitor) httpSession - .getAttribute(SessionConstants.ADD_COLUMN_MONITOR); - if (cm != null) { - httpSession.removeAttribute(SessionConstants.ADD_COLUMN_MONITOR); - } - httpSession.setAttribute(SessionConstants.ADD_COLUMN_MONITOR, addColumnMonitor); - - } - - public static Task getAddColumnTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.ADD_COLUMN_TASK); - if (monitor == null) { - logger.error("ADD_COLUMN_TASK was not acquired"); - } - return monitor; - } - - public static void setAddColumnTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.ADD_COLUMN_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.ADD_COLUMN_TASK); - httpSession.setAttribute(SessionConstants.ADD_COLUMN_TASK, task); - } - - // public static DeleteColumnSession getDeleteColumnSession( @@ -792,8 +585,8 @@ public class SessionUtil { return deleteColumnSession; } else { deleteColumnSession = new DeleteColumnSession(); - httpSession - .setAttribute(SessionConstants.DELETE_COLUMN_SESSION, deleteColumnSession); + httpSession.setAttribute(SessionConstants.DELETE_COLUMN_SESSION, + deleteColumnSession); return deleteColumnSession; } } @@ -805,50 +598,11 @@ public class SessionUtil { if (dc != null) { httpSession.removeAttribute(SessionConstants.DELETE_COLUMN_SESSION); } - httpSession.setAttribute(SessionConstants.DELETE_COLUMN_SESSION, deleteColumnSession); + httpSession.setAttribute(SessionConstants.DELETE_COLUMN_SESSION, + deleteColumnSession); } - public static DeleteColumnMonitor getDeleteColumnMonitor( - HttpSession httpSession) { - DeleteColumnMonitor deleteColumnMonitor = (DeleteColumnMonitor) httpSession - .getAttribute(SessionConstants.DELETE_COLUMN_MONITOR); - if (deleteColumnMonitor != null) { - return deleteColumnMonitor; - } else { - deleteColumnMonitor = new DeleteColumnMonitor(); - httpSession - .setAttribute(SessionConstants.DELETE_COLUMN_MONITOR, deleteColumnMonitor); - return deleteColumnMonitor; - } - } - - public static void setDeleteColumnMonitor(HttpSession httpSession, - DeleteColumnMonitor deleteColumnMonitor) { - DeleteColumnMonitor cm = (DeleteColumnMonitor) httpSession - .getAttribute(SessionConstants.DELETE_COLUMN_MONITOR); - if (cm != null) { - httpSession.removeAttribute(SessionConstants.DELETE_COLUMN_MONITOR); - } - httpSession.setAttribute(SessionConstants.DELETE_COLUMN_MONITOR, deleteColumnMonitor); - - } - - public static Task getDeleteColumnTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.DELETE_COLUMN_TASK); - if (monitor == null) { - logger.error("DELETE_COLUMN_TASK was not acquired"); - } - return monitor; - } - - public static void setDeleteColumnTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.DELETE_COLUMN_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.DELETE_COLUMN_TASK); - httpSession.setAttribute(SessionConstants.DELETE_COLUMN_TASK, task); - } - // public static TaskResubmitSession getTaskResubmitSession( HttpSession httpSession) { @@ -871,53 +625,13 @@ public class SessionUtil { if (tr != null) { httpSession.removeAttribute(SessionConstants.TASK_RESUBMIT_SESSION); } - httpSession.setAttribute(SessionConstants.TASK_RESUBMIT_SESSION, taskResubmitSession); + httpSession.setAttribute(SessionConstants.TASK_RESUBMIT_SESSION, + taskResubmitSession); } - public static TaskResubmitMonitor getTaskResubmitMonitor( - HttpSession httpSession) { - TaskResubmitMonitor taskResubmitMonitor = (TaskResubmitMonitor) httpSession - .getAttribute(SessionConstants.TASK_RESUBMIT_MONITOR); - if (taskResubmitMonitor != null) { - return taskResubmitMonitor; - } else { - taskResubmitMonitor = new TaskResubmitMonitor(); - httpSession.setAttribute(SessionConstants.TASK_RESUBMIT_MONITOR, - taskResubmitMonitor); - return taskResubmitMonitor; - } - } - - public static void setTaskResubmitMonitor(HttpSession httpSession, - TaskResubmitMonitor TaskResubmitMonitor) { - TaskResubmitMonitor trm = (TaskResubmitMonitor) httpSession - .getAttribute(SessionConstants.TASK_RESUBMIT_MONITOR); - if (trm != null) { - httpSession.removeAttribute(SessionConstants.TASK_RESUBMIT_MONITOR); - } - httpSession.setAttribute(SessionConstants.TASK_RESUBMIT_MONITOR, TaskResubmitMonitor); - - } - - public static Task getTaskResubmitTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.TASK_RESUBMIT_TASK); - if (monitor == null) { - logger.error("TASK_RESUBMIT_TASK was not acquired"); - } - return monitor; - } - - public static void setTaskResubmitTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.TASK_RESUBMIT_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.TASK_RESUBMIT_TASK); - httpSession.setAttribute(SessionConstants.TASK_RESUBMIT_TASK, task); - } - // - public static TaskResumeSession getTaskResumeSession( - HttpSession httpSession) { + public static TaskResumeSession getTaskResumeSession(HttpSession httpSession) { TaskResumeSession taskResumeSession = (TaskResumeSession) httpSession .getAttribute(SessionConstants.TASK_RESUME_SESSION); if (taskResumeSession != null) { @@ -937,56 +651,13 @@ public class SessionUtil { if (tr != null) { httpSession.removeAttribute(SessionConstants.TASK_RESUME_SESSION); } - httpSession.setAttribute(SessionConstants.TASK_RESUME_SESSION, taskResumeSession); + httpSession.setAttribute(SessionConstants.TASK_RESUME_SESSION, + taskResumeSession); } - public static TaskResumeMonitor getTaskResumeMonitor( - HttpSession httpSession) { - TaskResumeMonitor taskResumeMonitor = (TaskResumeMonitor) httpSession - .getAttribute(SessionConstants.TASK_RESUME_MONITOR); - if (taskResumeMonitor != null) { - return taskResumeMonitor; - } else { - taskResumeMonitor = new TaskResumeMonitor(); - httpSession.setAttribute(SessionConstants.TASK_RESUME_MONITOR, - taskResumeMonitor); - return taskResumeMonitor; - } - } - - public static void setTaskResumeMonitor(HttpSession httpSession, - TaskResumeMonitor taskResumeMonitor) { - TaskResumeMonitor trm = (TaskResumeMonitor) httpSession - .getAttribute(SessionConstants.TASK_RESUME_MONITOR); - if (trm != null) { - httpSession.removeAttribute(SessionConstants.TASK_RESUME_MONITOR); - } - httpSession.setAttribute(SessionConstants.TASK_RESUME_MONITOR, taskResumeMonitor); - - } - - public static Task getTaskResumeTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.TASK_RESUME_TASK); - if (monitor == null) { - logger.error("TASK_RESUME_TASK was not acquired"); - } - return monitor; - } - - public static void setTaskResumeTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.TASK_RESUME_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.TASK_RESUME_TASK); - httpSession.setAttribute(SessionConstants.TASK_RESUME_TASK, task); - } - - - - // - public static EditRowSession getEditRowSession( - HttpSession httpSession) { + public static EditRowSession getEditRowSession(HttpSession httpSession) { EditRowSession editRowSession = (EditRowSession) httpSession .getAttribute(SessionConstants.EDIT_ROW_SESSION); if (editRowSession != null) { @@ -1006,52 +677,11 @@ public class SessionUtil { if (er != null) { httpSession.removeAttribute(SessionConstants.EDIT_ROW_SESSION); } - httpSession.setAttribute(SessionConstants.EDIT_ROW_SESSION, editRowSession); + httpSession.setAttribute(SessionConstants.EDIT_ROW_SESSION, + editRowSession); } - public static EditRowMonitor getEditRowMonitor( - HttpSession httpSession) { - EditRowMonitor editRowMonitor = (EditRowMonitor) httpSession - .getAttribute(SessionConstants.EDIT_ROW_MONITOR); - if (editRowMonitor != null) { - return editRowMonitor; - } else { - editRowMonitor = new EditRowMonitor(); - httpSession.setAttribute(SessionConstants.EDIT_ROW_MONITOR, - editRowMonitor); - return editRowMonitor; - } - } - - public static void setEditRowMonitor(HttpSession httpSession, - EditRowMonitor editRowMonitor) { - EditRowMonitor er = (EditRowMonitor) httpSession - .getAttribute(SessionConstants.EDIT_ROW_MONITOR); - if (er != null) { - httpSession.removeAttribute(SessionConstants.EDIT_ROW_MONITOR); - } - httpSession.setAttribute(SessionConstants.EDIT_ROW_MONITOR, editRowMonitor); - - } - - public static Task getEditRowTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.EDIT_ROW_TASK); - if (monitor == null) { - logger.error("EDIT_ROW_TASK was not acquired"); - } - return monitor; - } - - public static void setEditRowTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.EDIT_ROW_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.EDIT_ROW_TASK); - httpSession.setAttribute(SessionConstants.EDIT_ROW_TASK, task); - } - - - // public static ReplaceColumnSession getReplaceColumnSession( @@ -1073,53 +703,14 @@ public class SessionUtil { ReplaceColumnSession rc = (ReplaceColumnSession) httpSession .getAttribute(SessionConstants.REPLACE_COLUMN_SESSION); if (rc != null) { - httpSession.removeAttribute(SessionConstants.REPLACE_COLUMN_SESSION); + httpSession + .removeAttribute(SessionConstants.REPLACE_COLUMN_SESSION); } - httpSession.setAttribute(SessionConstants.REPLACE_COLUMN_SESSION, replaceColumnSession); + httpSession.setAttribute(SessionConstants.REPLACE_COLUMN_SESSION, + replaceColumnSession); } - public static ReplaceColumnMonitor getReplaceColumnMonitor( - HttpSession httpSession) { - ReplaceColumnMonitor replaceColumnMonitor = (ReplaceColumnMonitor) httpSession - .getAttribute(SessionConstants.REPLACE_COLUMN_MONITOR); - if (replaceColumnMonitor != null) { - return replaceColumnMonitor; - } else { - replaceColumnMonitor = new ReplaceColumnMonitor(); - httpSession.setAttribute(SessionConstants.REPLACE_COLUMN_MONITOR, - replaceColumnMonitor); - return replaceColumnMonitor; - } - } - - public static void setReplaceColumnMonitor(HttpSession httpSession, - ReplaceColumnMonitor replaceColumnMonitor) { - ReplaceColumnMonitor rc = (ReplaceColumnMonitor) httpSession - .getAttribute(SessionConstants.REPLACE_COLUMN_MONITOR); - if (rc != null) { - httpSession.removeAttribute(SessionConstants.REPLACE_COLUMN_MONITOR); - } - httpSession.setAttribute(SessionConstants.REPLACE_COLUMN_MONITOR, replaceColumnMonitor); - - } - - public static Task getReplaceColumnTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.REPLACE_COLUMN_TASK); - if (monitor == null) { - logger.error("REPLACE_COLUMN_TASK was not acquired"); - } - return monitor; - } - - public static void setReplaceColumnTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.REPLACE_COLUMN_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.REPLACE_COLUMN_TASK); - httpSession.setAttribute(SessionConstants.REPLACE_COLUMN_TASK, task); - } - - // public static ReplaceBatchColumnSession getReplaceBatchColumnSession( HttpSession httpSession) { @@ -1129,7 +720,8 @@ public class SessionUtil { return replaceBatchColumnSession; } else { replaceBatchColumnSession = new ReplaceBatchColumnSession(); - httpSession.setAttribute(SessionConstants.REPLACE_BATCH_COLUMN_SESSION, + httpSession.setAttribute( + SessionConstants.REPLACE_BATCH_COLUMN_SESSION, replaceBatchColumnSession); return replaceBatchColumnSession; } @@ -1140,53 +732,14 @@ public class SessionUtil { ReplaceBatchColumnSession rbc = (ReplaceBatchColumnSession) httpSession .getAttribute(SessionConstants.REPLACE_BATCH_COLUMN_SESSION); if (rbc != null) { - httpSession.removeAttribute(SessionConstants.REPLACE_BATCH_COLUMN_SESSION); + httpSession + .removeAttribute(SessionConstants.REPLACE_BATCH_COLUMN_SESSION); } - httpSession.setAttribute(SessionConstants.REPLACE_BATCH_COLUMN_SESSION, replaceBatchColumnSession); + httpSession.setAttribute(SessionConstants.REPLACE_BATCH_COLUMN_SESSION, + replaceBatchColumnSession); } - public static ReplaceBatchColumnMonitor getReplaceBatchColumnMonitor( - HttpSession httpSession) { - ReplaceBatchColumnMonitor replaceBatchColumnMonitor = (ReplaceBatchColumnMonitor) httpSession - .getAttribute(SessionConstants.REPLACE_BATCH_COLUMN_MONITOR); - if (replaceBatchColumnMonitor != null) { - return replaceBatchColumnMonitor; - } else { - replaceBatchColumnMonitor = new ReplaceBatchColumnMonitor(); - httpSession.setAttribute(SessionConstants.REPLACE_BATCH_COLUMN_MONITOR, - replaceBatchColumnMonitor); - return replaceBatchColumnMonitor; - } - } - - public static void setReplaceBatchColumnMonitor(HttpSession httpSession, - ReplaceBatchColumnMonitor replaceBatchColumnMonitor) { - ReplaceBatchColumnMonitor rbc = (ReplaceBatchColumnMonitor) httpSession - .getAttribute(SessionConstants.REPLACE_BATCH_COLUMN_MONITOR); - if (rbc != null) { - httpSession.removeAttribute(SessionConstants.REPLACE_BATCH_COLUMN_MONITOR); - } - httpSession.setAttribute(SessionConstants.REPLACE_BATCH_COLUMN_MONITOR, replaceBatchColumnMonitor); - - } - - public static Task getReplaceBatchColumnTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.REPLACE_BATCH_COLUMN_TASK); - if (monitor == null) { - logger.error("REPLACE_BATCH_COLUMN_TASK was not acquired"); - } - return monitor; - } - - public static void setReplaceBatchColumnTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.REPLACE_BATCH_COLUMN_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.REPLACE_BATCH_COLUMN_TASK); - httpSession.setAttribute(SessionConstants.REPLACE_BATCH_COLUMN_TASK, task); - } - - // public static ChangeTableTypeSession getChangeTableTypeSession( @@ -1197,7 +750,8 @@ public class SessionUtil { return changeTableTypeSession; } else { changeTableTypeSession = new ChangeTableTypeSession(); - httpSession.setAttribute(SessionConstants.CHANGE_TABLE_TYPE_SESSION, + httpSession.setAttribute( + SessionConstants.CHANGE_TABLE_TYPE_SESSION, changeTableTypeSession); return changeTableTypeSession; } @@ -1208,54 +762,14 @@ public class SessionUtil { ChangeTableTypeSession ctts = (ChangeTableTypeSession) httpSession .getAttribute(SessionConstants.CHANGE_TABLE_TYPE_SESSION); if (ctts != null) { - httpSession.removeAttribute(SessionConstants.CHANGE_TABLE_TYPE_SESSION); + httpSession + .removeAttribute(SessionConstants.CHANGE_TABLE_TYPE_SESSION); } httpSession.setAttribute(SessionConstants.CHANGE_TABLE_TYPE_SESSION, changeTableTypeSession); } - public static ChangeTableTypeMonitor getChangeTableTypeMonitor( - HttpSession httpSession) { - ChangeTableTypeMonitor changeTableTypeMonitor = (ChangeTableTypeMonitor) httpSession - .getAttribute(SessionConstants.CHANGE_TABLE_TYPE_MONITOR); - if (changeTableTypeMonitor != null) { - return changeTableTypeMonitor; - } else { - changeTableTypeMonitor = new ChangeTableTypeMonitor(); - httpSession.setAttribute(SessionConstants.CHANGE_TABLE_TYPE_MONITOR, - changeTableTypeMonitor); - return changeTableTypeMonitor; - } - } - - public static void setChangeTableTypeMonitor(HttpSession httpSession, - ChangeTableTypeMonitor changeTableTypeMonitor) { - ChangeTableTypeMonitor ctt = (ChangeTableTypeMonitor) httpSession - .getAttribute(SessionConstants.CHANGE_TABLE_TYPE_MONITOR); - if (ctt != null) { - httpSession.removeAttribute(SessionConstants.CHANGE_TABLE_TYPE_MONITOR); - } - httpSession.setAttribute(SessionConstants.CHANGE_TABLE_TYPE_MONITOR, - changeTableTypeMonitor); - - } - - public static Task getChangeTableTypeTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CHANGE_TABLE_TYPE_TASK); - if (monitor == null) { - logger.error("CHANGE_TABLE_TYPE_TASK was not acquired"); - } - return monitor; - } - - public static void setChangeTableTypeTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CHANGE_TABLE_TYPE_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.CHANGE_TABLE_TYPE_TASK); - httpSession.setAttribute(SessionConstants.CHANGE_TABLE_TYPE_TASK, task); - } - // / public static CloneTabularResourceSession getCloneTabularResourceSession( @@ -1266,7 +780,8 @@ public class SessionUtil { return cloneTabularResourceSession; } else { cloneTabularResourceSession = new CloneTabularResourceSession(); - httpSession.setAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_SESSION, + httpSession.setAttribute( + SessionConstants.CLONE_TABULAR_RESOURCE_SESSION, cloneTabularResourceSession); return cloneTabularResourceSession; } @@ -1277,52 +792,14 @@ public class SessionUtil { CloneTabularResourceSession c = (CloneTabularResourceSession) httpSession .getAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_SESSION); if (c != null) { - httpSession.removeAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_SESSION); + httpSession + .removeAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_SESSION); } - httpSession.setAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_SESSION, + httpSession.setAttribute( + SessionConstants.CLONE_TABULAR_RESOURCE_SESSION, cloneTabularResourceSession); } - - public static CloneMonitor getCloneMonitor(HttpSession httpSession) { - CloneMonitor cloneMonitor = (CloneMonitor) httpSession - .getAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_MONITOR); - if (cloneMonitor != null) { - return cloneMonitor; - } else { - cloneMonitor = new CloneMonitor(); - httpSession.setAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_MONITOR, cloneMonitor); - return cloneMonitor; - } - } - - public static void setCloneMonitor(HttpSession httpSession, - DeleteRowsMonitor cloneMonitor) { - CloneMonitor cm = (CloneMonitor) httpSession - .getAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_MONITOR); - if (cm != null) { - httpSession.removeAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_MONITOR); - } - httpSession.setAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_MONITOR, cloneMonitor); - - } - - public static Task getCloneTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_TASK); - if (monitor == null) { - logger.error("CLONE_TABULAR_RESOURCE_TASK was not acquired"); - } - return monitor; - } - - public static void setCloneTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_TASK); - httpSession.setAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_TASK, task); - } - - // / @@ -1333,7 +810,8 @@ public class SessionUtil { return deleteRowsSession; } else { deleteRowsSession = new DeleteRowsSession(); - httpSession.setAttribute(SessionConstants.DELETE_ROWS_SESSION, deleteRowsSession); + httpSession.setAttribute(SessionConstants.DELETE_ROWS_SESSION, + deleteRowsSession); return deleteRowsSession; } } @@ -1345,48 +823,11 @@ public class SessionUtil { if (dr != null) { httpSession.removeAttribute(SessionConstants.DELETE_ROWS_SESSION); } - httpSession.setAttribute(SessionConstants.DELETE_ROWS_SESSION, deleteRowsSession); + httpSession.setAttribute(SessionConstants.DELETE_ROWS_SESSION, + deleteRowsSession); } - public static DeleteRowsMonitor getDeleteRowsMonitor(HttpSession httpSession) { - DeleteRowsMonitor deleteRowsMonitor = (DeleteRowsMonitor) httpSession - .getAttribute(SessionConstants.DELETE_ROWS_MONITOR); - if (deleteRowsMonitor != null) { - return deleteRowsMonitor; - } else { - deleteRowsMonitor = new DeleteRowsMonitor(); - httpSession.setAttribute(SessionConstants.DELETE_ROWS_MONITOR, deleteRowsMonitor); - return deleteRowsMonitor; - } - } - - public static void setDeleteRowsMonitor(HttpSession httpSession, - DeleteRowsMonitor deleteRowsMonitor) { - DeleteRowsMonitor ctt = (DeleteRowsMonitor) httpSession - .getAttribute(SessionConstants.DELETE_ROWS_MONITOR); - if (ctt != null) { - httpSession.removeAttribute(SessionConstants.DELETE_ROWS_MONITOR); - } - httpSession.setAttribute(SessionConstants.DELETE_ROWS_MONITOR, deleteRowsMonitor); - - } - - public static Task getDeleteRowsTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.DELETE_ROWS_TASK); - if (monitor == null) { - logger.error("DELETE_ROWS_TASK was not acquired"); - } - return monitor; - } - - public static void setDeleteRowsTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.DELETE_ROWS_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.DELETE_ROWS_TASK); - httpSession.setAttribute(SessionConstants.DELETE_ROWS_TASK, task); - } - // public static TemplateApplySession getTemplateApplySession( @@ -1408,52 +849,14 @@ public class SessionUtil { TemplateApplySession dr = (TemplateApplySession) httpSession .getAttribute(SessionConstants.TEMPLATE_APPLY_SESSION); if (dr != null) { - httpSession.removeAttribute(SessionConstants.TEMPLATE_APPLY_SESSION); + httpSession + .removeAttribute(SessionConstants.TEMPLATE_APPLY_SESSION); } - httpSession.setAttribute(SessionConstants.TEMPLATE_APPLY_SESSION, templateApplySession); + httpSession.setAttribute(SessionConstants.TEMPLATE_APPLY_SESSION, + templateApplySession); } - public static TemplateApplyMonitor getTemplateApplyMonitor( - HttpSession httpSession) { - TemplateApplyMonitor templateApplyMonitor = (TemplateApplyMonitor) httpSession - .getAttribute(SessionConstants.TEMPLATE_APPLY_MONITOR); - if (templateApplyMonitor != null) { - return templateApplyMonitor; - } else { - templateApplyMonitor = new TemplateApplyMonitor(); - httpSession.setAttribute(SessionConstants.TEMPLATE_APPLY_MONITOR, - templateApplyMonitor); - return templateApplyMonitor; - } - } - - public static void setTemplateApplyMonitor(HttpSession httpSession, - TemplateApplyMonitor templateApplyMonitor) { - TemplateApplyMonitor d = (TemplateApplyMonitor) httpSession - .getAttribute(SessionConstants.TEMPLATE_APPLY_MONITOR); - if (d != null) { - httpSession.removeAttribute(SessionConstants.TEMPLATE_APPLY_MONITOR); - } - httpSession.setAttribute(SessionConstants.TEMPLATE_APPLY_MONITOR, templateApplyMonitor); - - } - - public static Task getTemplateApplyTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.TEMPLATE_APPLY_TASK); - if (monitor == null) { - logger.error("TEMPLATE_APPLY_TASK was not acquired"); - } - return monitor; - } - - public static void setTemplateApplyTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.TEMPLATE_APPLY_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.TEMPLATE_APPLY_TASK); - httpSession.setAttribute(SessionConstants.TEMPLATE_APPLY_TASK, task); - } - // public static DuplicatesSession getDuplicatesSession(HttpSession httpSession) { @@ -1463,8 +866,8 @@ public class SessionUtil { return duplicatesSession; } else { duplicatesSession = new DuplicatesSession(); - httpSession - .setAttribute(SessionConstants.DUPLICATES_ROWS_SESSION, duplicatesSession); + httpSession.setAttribute(SessionConstants.DUPLICATES_ROWS_SESSION, + duplicatesSession); return duplicatesSession; } } @@ -1474,49 +877,12 @@ public class SessionUtil { DuplicatesSession dr = (DuplicatesSession) httpSession .getAttribute(SessionConstants.DUPLICATES_ROWS_SESSION); if (dr != null) { - httpSession.removeAttribute(SessionConstants.DUPLICATES_ROWS_SESSION); - } - httpSession.setAttribute(SessionConstants.DUPLICATES_ROWS_SESSION, duplicatesSession); - - } - - public static DuplicatesMonitor getDuplicatesMonitor(HttpSession httpSession) { - DuplicatesMonitor duplicatesMonitor = (DuplicatesMonitor) httpSession - .getAttribute(SessionConstants.DUPLICATES_ROWS_MONITOR); - if (duplicatesMonitor != null) { - return duplicatesMonitor; - } else { - duplicatesMonitor = new DuplicatesMonitor(); httpSession - .setAttribute(SessionConstants.DUPLICATES_ROWS_MONITOR, duplicatesMonitor); - return duplicatesMonitor; + .removeAttribute(SessionConstants.DUPLICATES_ROWS_SESSION); } - } + httpSession.setAttribute(SessionConstants.DUPLICATES_ROWS_SESSION, + duplicatesSession); - public static void setDuplicatesMonitor(HttpSession httpSession, - DuplicatesMonitor duplicateMonitor) { - DuplicatesMonitor d = (DuplicatesMonitor) httpSession - .getAttribute(SessionConstants.DUPLICATES_ROWS_MONITOR); - if (d != null) { - httpSession.removeAttribute(SessionConstants.DUPLICATES_ROWS_MONITOR); - } - httpSession.setAttribute(SessionConstants.DUPLICATES_ROWS_MONITOR, duplicateMonitor); - - } - - public static Task getDuplicatesTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.DUPLICATES_ROWS_TASK); - if (monitor == null) { - logger.error("DUPLICATES_ROWS_TASK was not acquired"); - } - return monitor; - } - - public static void setDuplicatesTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.DUPLICATES_ROWS_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.DUPLICATES_ROWS_TASK); - httpSession.setAttribute(SessionConstants.DUPLICATES_ROWS_TASK, task); } // @@ -1538,8 +904,10 @@ public class SessionUtil { ArrayList ltr = ((ArrayList) httpSession .getAttribute(SessionConstants.CODELISTS_PAGING_LOADED)); if (ltr != null) - httpSession.removeAttribute(SessionConstants.CODELISTS_PAGING_LOADED); - httpSession.setAttribute(SessionConstants.CODELISTS_PAGING_LOADED, listCodelists); + httpSession + .removeAttribute(SessionConstants.CODELISTS_PAGING_LOADED); + httpSession.setAttribute(SessionConstants.CODELISTS_PAGING_LOADED, + listCodelists); } public static ArrayList getCodelistsPagingLoadedFilteredCopy( @@ -1560,8 +928,10 @@ public class SessionUtil { ArrayList ltrFilteredCopy = ((ArrayList) httpSession .getAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTERED_COPY)); if (ltrFilteredCopy != null) - httpSession.removeAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTERED_COPY); - httpSession.setAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTERED_COPY, + httpSession + .removeAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTERED_COPY); + httpSession.setAttribute( + SessionConstants.CODELISTS_PAGING_LOADED_FILTERED_COPY, listCodelistsFilteredCopy); } @@ -1580,22 +950,23 @@ public class SessionUtil { String fil = ((String) httpSession .getAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTER)); if (fil != null) - httpSession.removeAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTER); - httpSession.setAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTER, filter); + httpSession + .removeAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTER); + httpSession.setAttribute( + SessionConstants.CODELISTS_PAGING_LOADED_FILTER, filter); } - + // - public static RollBackSession getRollBackSession( - HttpSession httpSession) { + public static RollBackSession getRollBackSession(HttpSession httpSession) { RollBackSession rollBackSession = (RollBackSession) httpSession .getAttribute(SessionConstants.ROLLBACK_SESSION); if (rollBackSession != null) { return rollBackSession; } else { rollBackSession = new RollBackSession(); - httpSession - .setAttribute(SessionConstants.ROLLBACK_SESSION, rollBackSession); + httpSession.setAttribute(SessionConstants.ROLLBACK_SESSION, + rollBackSession); return rollBackSession; } } @@ -1607,50 +978,11 @@ public class SessionUtil { if (rb != null) { httpSession.removeAttribute(SessionConstants.ROLLBACK_SESSION); } - httpSession.setAttribute(SessionConstants.ROLLBACK_SESSION, rollBackSession); + httpSession.setAttribute(SessionConstants.ROLLBACK_SESSION, + rollBackSession); } - public static RollBackSessionMonitor getRollBackSessionMonitor( - HttpSession httpSession) { - RollBackSessionMonitor rollBackMonitor = (RollBackSessionMonitor) httpSession - .getAttribute(SessionConstants.ROLLBACK_MONITOR); - if (rollBackMonitor != null) { - return rollBackMonitor; - } else { - rollBackMonitor = new RollBackSessionMonitor(); - httpSession - .setAttribute(SessionConstants.ROLLBACK_MONITOR, rollBackMonitor); - return rollBackMonitor; - } - } - - public static void setRollBackSessionMonitor(HttpSession httpSession, - RollBackSessionMonitor rollBackMonitor) { - RollBackSessionMonitor rb = (RollBackSessionMonitor) httpSession - .getAttribute(SessionConstants.ROLLBACK_MONITOR); - if (rb != null) { - httpSession.removeAttribute(SessionConstants.ROLLBACK_MONITOR); - } - httpSession.setAttribute(SessionConstants.ROLLBACK_MONITOR, rollBackMonitor); - - } - - public static Task getRollBackSessionTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.ROLLBACK_TASK); - if (monitor == null) { - logger.error("ROLLBACK_TASK was not acquired"); - } - return monitor; - } - - public static void setRollBackSessionTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.ROLLBACK_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.ROLLBACK_TASK); - httpSession.setAttribute(SessionConstants.ROLLBACK_TASK, task); - } - // public static ExtractCodelistSession getExtractCodelistSession( HttpSession httpSession) { @@ -1671,52 +1003,14 @@ public class SessionUtil { ExtractCodelistSession ec = (ExtractCodelistSession) httpSession .getAttribute(SessionConstants.EXTRACT_CODELIST_SESSION); if (ec != null) { - httpSession.removeAttribute(SessionConstants.EXTRACT_CODELIST_SESSION); + httpSession + .removeAttribute(SessionConstants.EXTRACT_CODELIST_SESSION); } - httpSession.setAttribute(SessionConstants.EXTRACT_CODELIST_SESSION, extractCodelistSession); + httpSession.setAttribute(SessionConstants.EXTRACT_CODELIST_SESSION, + extractCodelistSession); } - public static ExtractCodelistMonitor getExtractCodelistMonitor( - HttpSession httpSession) { - ExtractCodelistMonitor extractCodelistMonitor = (ExtractCodelistMonitor) httpSession - .getAttribute(SessionConstants.EXTRACT_CODELIST_MONITOR); - if (extractCodelistMonitor != null) { - return extractCodelistMonitor; - } else { - extractCodelistMonitor = new ExtractCodelistMonitor(); - httpSession.setAttribute(SessionConstants.EXTRACT_CODELIST_MONITOR, - extractCodelistMonitor); - return extractCodelistMonitor; - } - } - - public static void setExtractCodelistMonitor(HttpSession httpSession, - ExtractCodelistMonitor extractCodelistMonitor) { - ExtractCodelistMonitor ecm = (ExtractCodelistMonitor) httpSession - .getAttribute(SessionConstants.EXTRACT_CODELIST_MONITOR); - if (ecm != null) { - httpSession.removeAttribute(SessionConstants.EXTRACT_CODELIST_MONITOR); - } - httpSession.setAttribute(SessionConstants.EXTRACT_CODELIST_MONITOR, extractCodelistMonitor); - - } - - public static Task getExtractCodelistTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.EXTRACT_CODELIST_TASK); - if (monitor == null) { - logger.error("EXTRACT_CODELIST_TASK was not acquired"); - } - return monitor; - } - - public static void setExtractCodelistTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.EXTRACT_CODELIST_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.EXTRACT_CODELIST_TASK); - httpSession.setAttribute(SessionConstants.EXTRACT_CODELIST_TASK, task); - } - // public static SplitColumnSession getSplitColumnSession( HttpSession httpSession) { @@ -1726,8 +1020,8 @@ public class SessionUtil { return splitColumnSession; } else { splitColumnSession = new SplitColumnSession(); - httpSession - .setAttribute(SessionConstants.SPLIT_COLUMN_SESSION, splitColumnSession); + httpSession.setAttribute(SessionConstants.SPLIT_COLUMN_SESSION, + splitColumnSession); return splitColumnSession; } } @@ -1739,51 +1033,11 @@ public class SessionUtil { if (sc != null) { httpSession.removeAttribute(SessionConstants.SPLIT_COLUMN_SESSION); } - httpSession.setAttribute(SessionConstants.SPLIT_COLUMN_SESSION, splitColumnSession); + httpSession.setAttribute(SessionConstants.SPLIT_COLUMN_SESSION, + splitColumnSession); } - public static SplitColumnMonitor getSplitColumnMonitor( - HttpSession httpSession) { - SplitColumnMonitor splitColumnMonitor = (SplitColumnMonitor) httpSession - .getAttribute(SessionConstants.SPLIT_COLUMN_MONITOR); - if (splitColumnMonitor != null) { - return splitColumnMonitor; - } else { - splitColumnMonitor = new SplitColumnMonitor(); - httpSession - .setAttribute(SessionConstants.SPLIT_COLUMN_MONITOR, splitColumnMonitor); - return splitColumnMonitor; - } - } - - public static void setSplitColumnMonitor(HttpSession httpSession, - SplitColumnMonitor splitColumnMonitor) { - SplitColumnMonitor sm = (SplitColumnMonitor) httpSession - .getAttribute(SessionConstants.SPLIT_COLUMN_MONITOR); - if (sm != null) { - httpSession.removeAttribute(SessionConstants.SPLIT_COLUMN_MONITOR); - } - httpSession.setAttribute(SessionConstants.SPLIT_COLUMN_MONITOR, splitColumnMonitor); - - } - - public static Task getSplitColumnTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.SPLIT_COLUMN_TASK); - if (monitor == null) { - logger.error("SPLIT_COLUMN_TASK was not acquired"); - } - return monitor; - } - - public static void setSplitColumnTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.SPLIT_COLUMN_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.SPLIT_COLUMN_TASK); - httpSession.setAttribute(SessionConstants.SPLIT_COLUMN_TASK, task); - } - - // public static MergeColumnSession getMergeColumnSession( HttpSession httpSession) { @@ -1793,8 +1047,8 @@ public class SessionUtil { return mergeColumnSession; } else { mergeColumnSession = new MergeColumnSession(); - httpSession - .setAttribute(SessionConstants.MERGE_COLUMN_SESSION, mergeColumnSession); + httpSession.setAttribute(SessionConstants.MERGE_COLUMN_SESSION, + mergeColumnSession); return mergeColumnSession; } } @@ -1806,61 +1060,21 @@ public class SessionUtil { if (mc != null) { httpSession.removeAttribute(SessionConstants.MERGE_COLUMN_SESSION); } - httpSession.setAttribute(SessionConstants.MERGE_COLUMN_SESSION, splitColumnSession); + httpSession.setAttribute(SessionConstants.MERGE_COLUMN_SESSION, + splitColumnSession); } - public static MergeColumnMonitor getMergeColumnMonitor( - HttpSession httpSession) { - MergeColumnMonitor mergeColumnMonitor = (MergeColumnMonitor) httpSession - .getAttribute(SessionConstants.MERGE_COLUMN_MONITOR); - if (mergeColumnMonitor != null) { - return mergeColumnMonitor; - } else { - mergeColumnMonitor = new MergeColumnMonitor(); - httpSession - .setAttribute(SessionConstants.MERGE_COLUMN_MONITOR, mergeColumnMonitor); - return mergeColumnMonitor; - } - } - - public static void setMergeColumnMonitor(HttpSession httpSession, - MergeColumnMonitor mergeColumnMonitor) { - MergeColumnMonitor sm = (MergeColumnMonitor) httpSession - .getAttribute(SessionConstants.MERGE_COLUMN_MONITOR); - if (sm != null) { - httpSession.removeAttribute(SessionConstants.MERGE_COLUMN_MONITOR); - } - httpSession.setAttribute(SessionConstants.MERGE_COLUMN_MONITOR, mergeColumnMonitor); - - } - - public static Task getMergeColumnTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.MERGE_COLUMN_TASK); - if (monitor == null) { - logger.error("MERGE_COLUMN_TASK was not acquired"); - } - return monitor; - } - - public static void setMergeColumnTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.MERGE_COLUMN_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.MERGE_COLUMN_TASK); - httpSession.setAttribute(SessionConstants.MERGE_COLUMN_TASK, task); - } - // - public static GroupBySession getGroupBySession( - HttpSession httpSession) { + public static GroupBySession getGroupBySession(HttpSession httpSession) { GroupBySession groupBySession = (GroupBySession) httpSession .getAttribute(SessionConstants.GROUPBY_SESSION); if (groupBySession != null) { return groupBySession; } else { groupBySession = new GroupBySession(); - httpSession - .setAttribute(SessionConstants.GROUPBY_SESSION, groupBySession); + httpSession.setAttribute(SessionConstants.GROUPBY_SESSION, + groupBySession); return groupBySession; } } @@ -1872,53 +1086,14 @@ public class SessionUtil { if (gb != null) { httpSession.removeAttribute(SessionConstants.GROUPBY_SESSION); } - httpSession.setAttribute(SessionConstants.GROUPBY_SESSION, groupBySession); + httpSession.setAttribute(SessionConstants.GROUPBY_SESSION, + groupBySession); } - public static GroupByMonitor getGroupByMonitor( - HttpSession httpSession) { - GroupByMonitor groupByMonitor = (GroupByMonitor) httpSession - .getAttribute(SessionConstants.GROUPBY_MONITOR); - if (groupByMonitor != null) { - return groupByMonitor; - } else { - groupByMonitor = new GroupByMonitor(); - httpSession - .setAttribute(SessionConstants.GROUPBY_MONITOR, groupByMonitor); - return groupByMonitor; - } - } - - public static void setGroupByMonitor(HttpSession httpSession, - GroupByMonitor groupByMonitor) { - GroupByMonitor gb = (GroupByMonitor) httpSession - .getAttribute(SessionConstants.GROUPBY_MONITOR); - if (gb != null) { - httpSession.removeAttribute(SessionConstants.GROUPBY_MONITOR); - } - httpSession.setAttribute(SessionConstants.GROUPBY_MONITOR, groupByMonitor); - - } - - public static Task getGroupByTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.GROUPBY_TASK); - if (monitor == null) { - logger.error("GROUPBY_TASK was not acquired"); - } - return monitor; - } - - public static void setGroupByTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.GROUPBY_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.GROUPBY_TASK); - httpSession.setAttribute(SessionConstants.GROUPBY_TASK, task); - } - - // - public static CodelistMappingSession getCodelistMappingSession(HttpSession httpSession) { + public static CodelistMappingSession getCodelistMappingSession( + HttpSession httpSession) { CodelistMappingSession importSession = (CodelistMappingSession) httpSession .getAttribute(SessionConstants.CODELIST_MAPPING_SESSION); if (importSession == null) { @@ -1926,57 +1101,21 @@ public class SessionUtil { } return importSession; } + public static void setCodelistMappingSession(HttpSession httpSession, - CodelistMappingSession codelistMappingSession) throws TDGWTSessionExpiredException { + CodelistMappingSession codelistMappingSession) + throws TDGWTSessionExpiredException { CodelistMappingSession session = (CodelistMappingSession) httpSession .getAttribute(SessionConstants.CODELIST_MAPPING_SESSION); if (session != null) - httpSession.removeAttribute(SessionConstants.CODELIST_MAPPING_SESSION); - httpSession.setAttribute(SessionConstants.CODELIST_MAPPING_SESSION, codelistMappingSession); + httpSession + .removeAttribute(SessionConstants.CODELIST_MAPPING_SESSION); + httpSession.setAttribute(SessionConstants.CODELIST_MAPPING_SESSION, + codelistMappingSession); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } - - public static CodelistMappingMonitor getCodelistMappingMonitor( - HttpSession httpSession) { - CodelistMappingMonitor codelistMappingMonitor = (CodelistMappingMonitor) httpSession - .getAttribute(SessionConstants.CODELIST_MAPPING_MONITOR); - if (codelistMappingMonitor != null) { - return codelistMappingMonitor; - } else { - codelistMappingMonitor = new CodelistMappingMonitor(); - httpSession - .setAttribute(SessionConstants.CODELIST_MAPPING_MONITOR, codelistMappingMonitor); - return codelistMappingMonitor; - } - } - - public static void setCodelistMappingMonitor(HttpSession httpSession, - CodelistMappingMonitor codelistMappingMonitor) { - CodelistMappingMonitor cmm = (CodelistMappingMonitor) httpSession - .getAttribute(SessionConstants.CODELIST_MAPPING_MONITOR); - if (cmm != null) { - httpSession.removeAttribute(SessionConstants.CODELIST_MAPPING_MONITOR); - } - httpSession.setAttribute(SessionConstants.CODELIST_MAPPING_MONITOR, codelistMappingMonitor); - - } - - public static Task getCodelistMappingTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CODELIST_MAPPING_TASK); - if (monitor == null) { - logger.error("CODELIST_MAPPING_TASK was not acquired"); - } - return monitor; - } - - public static void setCodelistMappingTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.CODELIST_MAPPING_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.CODELIST_MAPPING_TASK); - httpSession.setAttribute(SessionConstants.CODELIST_MAPPING_TASK, task); - } // public static NormalizationSession getNormalizationSession( @@ -1987,8 +1126,8 @@ public class SessionUtil { return normalizationSession; } else { normalizationSession = new NormalizationSession(); - httpSession - .setAttribute(SessionConstants.NORMALIZATION_SESSION, normalizationSession); + httpSession.setAttribute(SessionConstants.NORMALIZATION_SESSION, + normalizationSession); return normalizationSession; } } @@ -2000,51 +1139,11 @@ public class SessionUtil { if (gb != null) { httpSession.removeAttribute(SessionConstants.NORMALIZATION_SESSION); } - httpSession.setAttribute(SessionConstants.NORMALIZATION_SESSION, normalizationSession); + httpSession.setAttribute(SessionConstants.NORMALIZATION_SESSION, + normalizationSession); } - public static NormalizationMonitor getNormalizationMonitor( - HttpSession httpSession) { - NormalizationMonitor normalizationMonitor = (NormalizationMonitor) httpSession - .getAttribute(SessionConstants.NORMALIZATION_MONITOR); - if (normalizationMonitor != null) { - return normalizationMonitor; - } else { - normalizationMonitor = new NormalizationMonitor(); - httpSession - .setAttribute(SessionConstants.NORMALIZATION_MONITOR, normalizationMonitor); - return normalizationMonitor; - } - } - - public static void setNormalizationMonitor(HttpSession httpSession, - NormalizationMonitor normalizationMonitor) { - NormalizationMonitor nm = (NormalizationMonitor) httpSession - .getAttribute(SessionConstants.NORMALIZATION_MONITOR); - if (nm != null) { - httpSession.removeAttribute(SessionConstants.NORMALIZATION_MONITOR); - } - httpSession.setAttribute(SessionConstants.NORMALIZATION_MONITOR, normalizationMonitor); - - } - - public static Task getNormalizationTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.NORMALIZATION_TASK); - if (monitor == null) { - logger.error("NORMALIZATION_TASK was not acquired"); - } - return monitor; - } - - public static void setNormalizationTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.NORMALIZATION_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.NORMALIZATION_TASK); - httpSession.setAttribute(SessionConstants.NORMALIZATION_TASK, task); - } - - // public static DenormalizationSession getDenormalizationSession( HttpSession httpSession) { @@ -2054,8 +1153,8 @@ public class SessionUtil { return denormalizationSession; } else { denormalizationSession = new DenormalizationSession(); - httpSession - .setAttribute(SessionConstants.DENORMALIZATION_SESSION, denormalizationSession); + httpSession.setAttribute(SessionConstants.DENORMALIZATION_SESSION, + denormalizationSession); return denormalizationSession; } } @@ -2065,65 +1164,24 @@ public class SessionUtil { DenormalizationSession dn = (DenormalizationSession) httpSession .getAttribute(SessionConstants.DENORMALIZATION_SESSION); if (dn != null) { - httpSession.removeAttribute(SessionConstants.DENORMALIZATION_SESSION); - } - httpSession.setAttribute(SessionConstants.DENORMALIZATION_SESSION, denormalizationSession); - - } - - public static DenormalizationMonitor getDenormalizationMonitor( - HttpSession httpSession) { - DenormalizationMonitor denormalizationMonitor = (DenormalizationMonitor) httpSession - .getAttribute(SessionConstants.DENORMALIZATION_MONITOR); - if (denormalizationMonitor != null) { - return denormalizationMonitor; - } else { - denormalizationMonitor = new DenormalizationMonitor(); httpSession - .setAttribute(SessionConstants.DENORMALIZATION_MONITOR, denormalizationMonitor); - return denormalizationMonitor; + .removeAttribute(SessionConstants.DENORMALIZATION_SESSION); } - } - - public static void setDeNormalizationMonitor(HttpSession httpSession, - DenormalizationMonitor denormalizationMonitor) { - DenormalizationMonitor dn = (DenormalizationMonitor) httpSession - .getAttribute(SessionConstants.DENORMALIZATION_MONITOR); - if (dn != null) { - httpSession.removeAttribute(SessionConstants.DENORMALIZATION_MONITOR); - } - httpSession.setAttribute(SessionConstants.DENORMALIZATION_MONITOR, denormalizationMonitor); + httpSession.setAttribute(SessionConstants.DENORMALIZATION_SESSION, + denormalizationSession); } - public static Task getDenormalizationTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.DENORMALIZATION_TASK); - if (monitor == null) { - logger.error("DENORMALIZATION_TASK was not acquired"); - } - return monitor; - } - - public static void setDenormalizationTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.DENORMALIZATION_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.DENORMALIZATION_TASK); - httpSession.setAttribute(SessionConstants.DENORMALIZATION_TASK, task); - } - - - // - public static UnionSession getUnionSession( - HttpSession httpSession) { + public static UnionSession getUnionSession(HttpSession httpSession) { UnionSession unionSession = (UnionSession) httpSession .getAttribute(SessionConstants.UNION_SESSION); if (unionSession != null) { return unionSession; } else { unionSession = new UnionSession(); - httpSession - .setAttribute(SessionConstants.UNION_SESSION, unionSession); + httpSession.setAttribute(SessionConstants.UNION_SESSION, + unionSession); return unionSession; } } @@ -2139,89 +1197,82 @@ public class SessionUtil { } - public static UnionMonitor getUnionMonitor( - HttpSession httpSession) { - UnionMonitor unionMonitor = (UnionMonitor) httpSession - .getAttribute(SessionConstants.UNION_MONITOR); - if (unionMonitor != null) { - return unionMonitor; - } else { - unionMonitor = new UnionMonitor(); - httpSession - .setAttribute(SessionConstants.UNION_MONITOR, unionMonitor); - return unionMonitor; + public static TaskWrapper getTaskStarted(HttpSession httpSession, + String taskId) { + TaskWrapper taskWrapper = null; + + if (taskId == null || taskId.isEmpty()) { + logger.error("TaskId is not valid: " + taskId); + return taskWrapper; } - } - public static void setUnionMonitor(HttpSession httpSession, - UnionMonitor unionMonitor) { - UnionMonitor um = (UnionMonitor) httpSession - .getAttribute(SessionConstants.UNION_MONITOR); - if (um != null) { - httpSession.removeAttribute(SessionConstants.UNION_MONITOR); - } - httpSession.setAttribute(SessionConstants.UNION_MONITOR, unionMonitor); - - } - - public static Task getUnionTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.UNION_TASK); - if (monitor == null) { - logger.error("UNION_TASK was not acquired"); - } - return monitor; - } - - public static void setUnionTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SessionConstants.UNION_TASK); - if (monitor != null) - httpSession.removeAttribute(SessionConstants.UNION_TASK); - httpSession.setAttribute(SessionConstants.UNION_TASK, task); - } - - - public static Task getTaskById(HttpSession httpSession, String taskId){ - Task task=null; - - if(taskId==null|| taskId.isEmpty()){ - logger.error("TaskId is not valid: "+taskId); - return task; - } - @SuppressWarnings("unchecked") - HashMap tasks= (HashMap) httpSession.getAttribute(SessionConstants.OPERATIONS_TASKS); - if(tasks==null){ - logger.error("Task with id="+taskId+ " was not acquired"); - return task; + HashMap tasksStarted = (HashMap) httpSession + .getAttribute(SessionConstants.OPERATIONS_TASKS_STARTED); + if (tasksStarted == null) { + logger.error("Task with id=" + taskId + " was not acquired"); + return taskWrapper; } - - task=tasks.get(taskId); - if(task== null){ - logger.error("Task with id="+taskId+ " was not acquired"); + + taskWrapper = tasksStarted.get(taskId); + if (taskWrapper == null) { + logger.error("Task with id=" + taskId + " was not acquired"); } - return task; + return taskWrapper; }; - - - - public static void setTaskById(HttpSession httpSession, Task task) { - if(task==null){ - logger.error("Task is null"); + + public static void setTaskStarted(HttpSession httpSession, + TaskWrapper taskWrapper) { + if (taskWrapper == null) { + logger.error("TaskWrapper is null"); return; } - - @SuppressWarnings("unchecked") - HashMap tasks=((HashMap) httpSession.getAttribute(SessionConstants.OPERATIONS_TASKS)); - if(tasks==null){ - tasks=new HashMap(); - tasks.put(task.getId().getValue(), task); - } else { - tasks.put(task.getId().getValue(), task); - httpSession.removeAttribute(SessionConstants.OPERATIONS_TASKS); + + if (taskWrapper.getTask().getId() == null + || taskWrapper.getTask().getId().getValue() == null + || taskWrapper.getTask().getId().getValue().isEmpty()) { + logger.error("TaskWrapper contains Task with invalid task id"); + return; } - httpSession.setAttribute(SessionConstants.OPERATIONS_TASKS, tasks); - + + @SuppressWarnings("unchecked") + HashMap tasksStarted = ((HashMap) httpSession + .getAttribute(SessionConstants.OPERATIONS_TASKS_STARTED)); + if (tasksStarted == null) { + tasksStarted = new HashMap(); + } else { + httpSession.removeAttribute(SessionConstants.OPERATIONS_TASKS_STARTED); + } + tasksStarted.put(taskWrapper.getTask().getId().getValue(), taskWrapper); + httpSession.setAttribute(SessionConstants.OPERATIONS_TASKS_STARTED, + tasksStarted); + } - - + + // + public static FileUploadMonitor getFileUploadMonitor(HttpSession httpSession) { + FileUploadMonitor fileUploadMonitor = (FileUploadMonitor) httpSession + .getAttribute(SessionConstants.FILE_UPLOAD_MONITOR); + if (fileUploadMonitor != null) { + return fileUploadMonitor; + } else { + fileUploadMonitor = new FileUploadMonitor(); + httpSession.setAttribute(SessionConstants.FILE_UPLOAD_MONITOR, + fileUploadMonitor); + return fileUploadMonitor; + } + } + + public static void setFileUploadMonitor(HttpSession httpSession, + FileUploadMonitor fileUploadMonitor) { + FileUploadMonitor fum = (FileUploadMonitor) httpSession + .getAttribute(SessionConstants.FILE_UPLOAD_MONITOR); + if (fum != null) { + httpSession.removeAttribute(SessionConstants.FILE_UPLOAD_MONITOR); + } + httpSession.setAttribute(SessionConstants.FILE_UPLOAD_MONITOR, + fileUploadMonitor); + + } + } 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 1dbe18d..9fbaaf7 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 @@ -36,7 +36,6 @@ import org.gcube.common.resources.gcore.ServiceEndpoint.Profile; import org.gcube.common.resources.gcore.utils.Group; 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.commons.webservice.types.TemplateDescription; import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationDefinition; import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution; @@ -125,12 +124,11 @@ import org.gcube.portlets.user.td.gwtservice.server.trservice.TDTypeValueMap; 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.OperationsId; +import org.gcube.portlets.user.td.gwtservice.shared.UIOperationsId; import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList; -import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVFileUtil; -import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVParserConfiguration; import org.gcube.portlets.user.td.gwtservice.shared.csv.CheckCSVSession; @@ -142,31 +140,10 @@ 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.history.OpHistory; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.AddColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ChangeTableTypeMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.CloneMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.CodelistMappingMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DeleteColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DeleteRowsMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DenormalizationMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.DuplicatesMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.EditRowMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ExtractCodelistMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.GroupByMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.LabelColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.MergeColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.NormalizationMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ReplaceBatchColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.ReplaceColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.RollBackSessionMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.SplitColumnMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TaskResubmitMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TaskResumeMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.TemplateApplyMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.UnionMonitor; -import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorCreator; +import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession; 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.share.Contacts; import org.gcube.portlets.user.td.gwtservice.shared.share.ShareInfo; @@ -178,6 +155,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.task.State; import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResubmitSession; import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession; 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.ValidationsTasksMetadata; import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession; import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData; @@ -200,7 +178,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.column.MergeColumnSession import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.SplitColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingData; -import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.groupby.GroupBySession; import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRAgencyMetadata; @@ -257,7 +234,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements protected static SimpleDateFormat sdf = new SimpleDateFormat( "yyyy/MM/dd HH:mm"); - + protected static SimpleDateFormat sdfDate = new SimpleDateFormat( "yyyy/MM/dd"); @@ -283,7 +260,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements try { HttpSession session = this.getThreadLocalRequest().getSession(); SessionUtil.getAslSession(session); - + if (tabResource == null) { logger.error("Error setting TabResource: null"); throw new TDGWTServiceException( @@ -293,7 +270,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setTabResource(session, tabResource); SessionUtil.setTRId(session, tabResource.getTrId()); return; - + } catch (TDGWTSessionExpiredException e) { throw e; } catch (Throwable e) { @@ -316,7 +293,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements try { HttpSession session = this.getThreadLocalRequest().getSession(); SessionUtil.getAslSession(session); - + TabResource currentTR = SessionUtil.getTabResource(session); logger.debug("getCurrentTRId()"); if (currentTR == null) { @@ -443,8 +420,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements TabularResource tr = service .getTabularResource(new TabularResourceId(Long .valueOf(currentTR.getTrId().getId()))); - logger.debug("GetTabResourceInformation() TR on service: "+tr); - + logger.debug("GetTabResourceInformation() TR on service: " + tr); + currentTR.setDate(sdf.format(tr.getCreationDate().getTime())); currentTR.setValid(tr.isValid()); currentTR.setFinalized(tr.isFinalized()); @@ -1461,7 +1438,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * * {@inheritDoc} */ - public void startTDOpen(TDOpenSession s) throws TDGWTServiceException { + public void tdOpen(TDOpenSession s) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); SessionUtil.getAslSession(session); @@ -2322,7 +2299,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements /** * {@inheritDoc} */ - public void startSDMXImport(SDMXImportSession sdmxImportSession) + @Override + public String startSDMXImport(SDMXImportSession sdmxImportSession) throws TDGWTServiceException { try { @@ -2361,8 +2339,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR.getId()); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setSDMXImportTask(session, trTask); - return; + + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.SDMXImport, trId); + SessionUtil.setTaskStarted(session, taskWrapper); + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -2446,119 +2428,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements /** * {@inheritDoc} */ - public SDMXImportMonitor getSDMXImportMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - // ASLSession aslSession = SessionUtil.getAslSession(session); - Task task = SessionUtil.getSDMXImportTask(session); - TabResource sdmxImportTabResource = SessionUtil - .getSDMXImportTabResource(session); - TRId trId = sdmxImportTabResource.getTrId(); - - SDMXImportMonitor importMonitor = new SDMXImportMonitor(); - if (trId == null) { - throw new TDGWTServiceException( - "Error in importSDMX TabularResource Id null"); - } else { - if (task == null) { - throw new TDGWTServiceException( - "Error in importSDMX task null"); - } else { - logger.debug("Service task: " + task.toString()); - TaskStatus status = task.getStatus(); - if (status == null) { - throw new TDGWTServiceException( - "Error in importSDMX Status null"); - } else { - logger.debug("Service Task.getStatus(): " - + task.getStatus()); - - importMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - // Table table; - switch (importMonitor.getStatus()) { - case SUCCEDED: - importMonitor.setProgress(task.getProgress()); - logger.debug("Task Result: " + task.getResult()); - - trId = retrieveTabularResourceBasicData(trId); - - sdmxImportTabResource.setTrId(trId); - SessionUtil.setSDMXImportTabResource(session, - sdmxImportTabResource); - SessionUtil.setTabResource(session, - sdmxImportTabResource); - - SessionUtil.setTRId(session, trId); - break; - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - importMonitor.setError(task.getErrorCause()); - } else { - logger.debug("Task exception: Error In Import"); - importMonitor.setError(new Throwable( - "Error In Import")); - } - importMonitor.setProgress(task.getProgress()); - break; - case STOPPED: - importMonitor.setProgress(task.getProgress()); - logger.debug("Task Result: " + task.getResult()); - trId = retrieveTabularResourceBasicData(trId); - - sdmxImportTabResource.setTrId(trId); - SessionUtil.setSDMXImportTabResource(session, - sdmxImportTabResource); - SessionUtil.setTabResource(session, - sdmxImportTabResource); - - SessionUtil.setTRId(session, trId); - - break; - case ABORTED: - break; - case IN_PROGRESS: - importMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - importMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setSDMXImportTask(session, task); - } - - importMonitor.setTrId(trId); - } - logger.debug("getSDMXImportMonitor(): " + importMonitor); - return importMonitor; - - } catch (TDGWTSessionExpiredException e) { - throw e; - - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in importSDMX ImportMonitor: " - + e.getLocalizedMessage()); - - } - - } - - /** - * {@inheritDoc} - */ + @Override public void setSDMXRegistrySource(SDMXRegistrySource sdmxRegistrySource) throws TDGWTServiceException { try { @@ -2606,6 +2476,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements /** * {@inheritDoc} */ + @Override public FileUploadMonitor getFileUploadMonitor() throws TDGWTServiceException { @@ -2630,6 +2501,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements /** * {@inheritDoc} */ + @Override public AvailableCharsetList getAvailableCharset() throws TDGWTServiceException { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -2644,6 +2516,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements return new AvailableCharsetList(charsetList, defaultEncoding); } + @Override public ArrayList configureCSVParser(String encoding, HeaderPresence headerPresence, char delimiter, char comment) throws TDGWTServiceException { @@ -2720,35 +2593,47 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements /** * {@inheritDoc} */ - public void startCSVImport(CSVImportSession csvImportSession) + @Override + public String startCSVImport(CSVImportSession csvImportSession) throws TDGWTServiceException { - HttpSession session = this.getThreadLocalRequest().getSession(); - if (session == null) { + try { + + HttpSession session = this.getThreadLocalRequest().getSession(); + if (session == null) { + throw new TDGWTServiceException( + "Error retrieving the session: null"); + } + logger.debug("Session:" + session.getId()); + + ASLSession aslSession = SessionUtil.getAslSession(session); + String user = aslSession.getUsername(); + logger.debug("Session User:" + user); + + logger.debug("StartCSVImport: " + csvImportSession.toString()); + + CSVFileUploadSession fileUploadSession = SessionUtil + .getCSVFileUploadSession(session); + if (fileUploadSession == null) { + throw new TDGWTServiceException( + "Error retrieving the fileUploadSession: null"); + } + + String taskId = importCSVFileOnService(session, aslSession, user, + fileUploadSession, csvImportSession); + + return taskId; + + } catch (TDGWTSessionExpiredException e) { + throw e; + } catch (SecurityException e) { + e.printStackTrace(); throw new TDGWTServiceException( - "Error retrieving the session: null"); + "Security exception, you haven't rights!"); + } catch (Throwable e) { + e.printStackTrace(); + throw new TDGWTServiceException("Error in CSVImport: " + + e.getLocalizedMessage()); } - logger.debug("Session:" + session.getId()); - - ASLSession aslSession = SessionUtil.getAslSession(session); - if (aslSession == null) { - throw new TDGWTServiceException( - "Error retrieving the asl session: null"); - } - String user = aslSession.getUsername(); - logger.debug("Session User:" + user); - - logger.debug("StartCSVImport: " + csvImportSession.toString()); - - CSVFileUploadSession fileUploadSession = SessionUtil - .getCSVFileUploadSession(session); - if (fileUploadSession == null) { - throw new TDGWTServiceException( - "Error retrieving the fileUploadSession: null"); - } - - importCSVFileOnService(session, aslSession, user, fileUploadSession, - csvImportSession); - } /** @@ -2788,7 +2673,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * @param csvImportSession * @throws TDGWTServiceException */ - protected void importCSVFileOnService(HttpSession session, + protected String importCSVFileOnService(HttpSession session, ASLSession aslSession, String user, CSVFileUploadSession fileUploadSession, CSVImportSession csvImportSession) throws TDGWTServiceException { @@ -2862,119 +2747,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setCSVImportFileTask(session, trTask); + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.CSVImport, trId); + SessionUtil.setTaskStarted(session, taskWrapper); + return trTask.getId().getValue(); } - /** - * {@inheritDoc} - */ - public CSVImportMonitor getCSVImportMonitor() throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - Task task = SessionUtil.getCSVImportFileTask(session); - TabResource csvImportTabResource = SessionUtil - .getCSVImportTabResource(session); - TRId trId = csvImportTabResource.getTrId(); - - CSVImportMonitor importMonitor = new CSVImportMonitor(); - if (trId == null) { - throw new TDGWTServiceException( - "Error in importCSV TabularResource Id null"); - } else { - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in importCSV task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - throw new TDGWTServiceException( - "Error in importCSV Status null"); - } else { - logger.debug("Status: " + task.getStatus()); - - importMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - switch (importMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - importMonitor.setError(task.getErrorCause()); - } else { - logger.debug("Task exception: Error In Import"); - importMonitor.setError(new Throwable( - "Error In Import")); - } - importMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result: " + task.getResult()); - importMonitor.setProgress(task.getProgress()); - trId = retrieveTabularResourceBasicData(trId); - - 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 STOPPED: - logger.debug("Task Result: " + task.getResult()); - importMonitor.setProgress(task.getProgress()); - trId = retrieveTabularResourceBasicData(trId); - - 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()); - break; - case VALIDATING_RULES: - importMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setCSVImportFileTask(session, task); - } - - importMonitor.setTrId(trId); - } - logger.debug("getImportMonitor(): " + importMonitor); - return importMonitor; - - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in importCSV CSVImportMonitor: " - + e.getLocalizedMessage()); - - } - - } + /** * @@ -3021,14 +2801,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } CSVFileUploadSession fileUploadSession = new CSVFileUploadSession(); - CSVImportMonitor csvImportMonitor = new CSVImportMonitor(); + // CSVImportMonitor csvImportMonitor = new CSVImportMonitor(); FileUploadMonitor fileUploadMonitor = new FileUploadMonitor(); SessionUtil.setFileUploadMonitor(session, fileUploadMonitor); fileUploadSession.setId(session.getId()); fileUploadSession.setFileUploadState(FileUploadState.STARTED); - fileUploadSession.setCsvImportMonitor(csvImportMonitor); + // fileUploadSession.setCsvImportMonitor(csvImportMonitor); SessionUtil.setCSVFileUploadSession(session, fileUploadSession); @@ -3189,7 +2969,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements TabularResource tr = service .getTabularResource(new TabularResourceId(Long.valueOf(trId .getId()))); - + Collection trMetas = tr.getAllMetadata(); logger.debug("GetTRMetadata size: " + trMetas.size()); @@ -3519,417 +3299,157 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * @param exportSession * @return */ - public void startSDMXExport(SDMXExportSession exportSession) - throws TDGWTServiceException { - logger.debug("Start SDMX Export"); - HttpSession session = this.getThreadLocalRequest().getSession(); - if (session == null) { - throw new TDGWTServiceException( - "Error retrieving the session: null"); - } - logger.debug("Session:" + session.getId()); - - ASLSession aslSession = SessionUtil.getAslSession(session); - if (aslSession == null) { - throw new TDGWTServiceException( - "Error retrieving the asl session: null"); - } - String user = aslSession.getUsername(); - logger.debug("Session User:" + user); - - TRId trId = SessionUtil.getTRId(session); - if (trId == null) { - throw new TDGWTServiceException( - "Error no tabular resource in session"); - } - - if (trId.getTableId() == null) { - throw new TDGWTServiceException("Error no table present in session"); - } - - SessionUtil.setSDMXExportSession(session, exportSession); - - Map parameterInstance = sdmxExportParameter(exportSession); - - logger.debug("Tabular Data Service"); - - AuthorizationProvider.instance.set(new AuthorizationToken(aslSession - .getUsername(), aslSession.getScope())); - TabularDataService service = TabularDataServiceFactory.getService(); - - // Export SDMX Codelist - OperationDefinition exportSDMXOperation = OperationDefinitionMap.map( - OperationsId.SDMXCodelistExport.toString(), service); - - OperationExecution invocation = new OperationExecution( - exportSDMXOperation.getOperationId(), parameterInstance); - - logger.debug("OperationInvocation: \n" + invocation.toString()); - - Task trTask; - try { - trTask = service.execute(invocation, - new TabularResourceId(Long.valueOf(trId.getId()))); - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Tabular Data Service error exporting TabularResource: " - + e.getLocalizedMessage()); - } - - logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setSDMXExportTask(session, trTask); - } - - /** - * - * {@inheritDoc} - */ - public SDMXExportMonitor getSDMXExportMonitor() + public String startSDMXExport(SDMXExportSession exportSession) throws TDGWTServiceException { try { + + logger.debug("Start SDMX Export"); HttpSession session = this.getThreadLocalRequest().getSession(); - // ASLSession aslSession = SessionUtil.getAslSession(session); - Task task = SessionUtil.getSDMXExportTask(session); - SDMXExportMonitor exportMonitor = new SDMXExportMonitor(); + if (session == null) { + throw new TDGWTServiceException( + "Error retrieving the session: null"); + } + logger.debug("Session:" + session.getId()); - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException("Error in exportSDMX task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - throw new TDGWTServiceException( - "Error in exportSDMX Status null"); - } else { - logger.debug("Status: " + task.getStatus()); + ASLSession aslSession = SessionUtil.getAslSession(session); - exportMonitor.setStatus(TaskStateMap.map(task.getStatus())); - Table table; - ExportMetadata exportMetadata; - TabExportMetadata tabExportMetadata; - switch (exportMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - exportMonitor.setError(task.getErrorCause()); - } else { - logger.debug("Task exception: Error In Export"); - exportMonitor.setError(new Throwable( - "Error In Export")); - } - exportMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - exportMonitor.setProgress(task.getProgress()); + logger.debug("Session User:" + aslSession.getUsername()); - 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 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()); - break; - case VALIDATING_RULES: - exportMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setSDMXExportTask(session, task); + TRId trId = SessionUtil.getTRId(session); + if (trId == null) { + throw new TDGWTServiceException( + "Error no tabular resource in session"); } - logger.debug("getExportMonitor(): " + exportMonitor); - return exportMonitor; + if (trId.getTableId() == null) { + throw new TDGWTServiceException( + "Error no table present in session"); + } + + SessionUtil.setSDMXExportSession(session, exportSession); + + Map parameterInstance = sdmxExportParameter(exportSession); + + logger.debug("Tabular Data Service"); + + AuthorizationProvider.instance.set(new AuthorizationToken( + aslSession.getUsername(), aslSession.getScope())); + TabularDataService service = TabularDataServiceFactory.getService(); + + // Export SDMX Codelist + OperationDefinition exportSDMXOperation = OperationDefinitionMap + .map(OperationsId.SDMXCodelistExport.toString(), service); + + OperationExecution invocation = new OperationExecution( + exportSDMXOperation.getOperationId(), parameterInstance); + + logger.debug("OperationInvocation: \n" + invocation.toString()); + + Task trTask = service.execute(invocation, new TabularResourceId( + Long.valueOf(trId.getId()))); + logger.debug("Start Task on service: TaskId " + trTask.getId()); + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.SDMXExport, trId); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in exportSDMX SDMXExportMonitor: " - + e.getLocalizedMessage()); - - } - - } - - /** - * - * {@inheritDoc} - */ - public void startCSVExport(CSVExportSession exportSession) - throws TDGWTServiceException { - logger.debug("Start CSV Export"); - HttpSession session = this.getThreadLocalRequest().getSession(); - if (session == null) { - throw new TDGWTServiceException( - "Error retrieving the session: null"); - } - logger.debug("Session:" + session.getId()); - - ASLSession aslSession = SessionUtil.getAslSession(session); - if (aslSession == null) { - throw new TDGWTServiceException( - "Error retrieving the asl session: null"); - } - String user = aslSession.getUsername(); - logger.debug("Session User:" + user); - - TRId trId = SessionUtil.getTRId(session); - if (trId == null) { - throw new TDGWTServiceException( - "Error no tabular resource in session"); - } - - if (trId.getTableId() == null) { - throw new TDGWTServiceException("Error no table present in session"); - } - - SessionUtil.setCSVExportSession(session, exportSession); - - Map parameterInstance = csvExportFileParameter(exportSession); - - logger.debug("Tabular Data Service"); - - AuthorizationProvider.instance.set(new AuthorizationToken(aslSession - .getUsername(), aslSession.getScope())); - TabularDataService service = TabularDataServiceFactory.getService(); - - // Export CSV file - OperationDefinition exportCSVFileOperation = OperationDefinitionMap - .map(OperationsId.CSVExport.toString(), service); - - OperationExecution invocation = new OperationExecution( - exportCSVFileOperation.getOperationId(), parameterInstance); - - logger.debug("OperationInvocation: \n" + invocation.toString()); - - Task trTask; - try { - trTask = service.execute(invocation, - new TabularResourceId(Long.valueOf(trId.getId()))); } catch (SecurityException e) { e.printStackTrace(); throw new TDGWTServiceException( "Security exception, you haven't rights!"); } catch (Throwable e) { e.printStackTrace(); - throw new TDGWTServiceException( - "Tabular Data Service error exporting TabularResource: " - + e.getLocalizedMessage()); + throw new TDGWTServiceException("Error in CSVExport: " + + e.getLocalizedMessage()); } - logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setCSVExportEnd(session, false); - SessionUtil.setCSVExportTask(session, trTask); - } /** + * * {@inheritDoc} */ - public CSVExportMonitor getCSVExportMonitor() throws TDGWTServiceException { + public String startCSVExport(CSVExportSession exportSession) + throws TDGWTServiceException { try { + + logger.debug("Start CSV Export"); HttpSession session = this.getThreadLocalRequest().getSession(); + if (session == null) { + throw new TDGWTServiceException( + "Error retrieving the session: null"); + } + logger.debug("Session:" + session.getId()); + ASLSession aslSession = SessionUtil.getAslSession(session); - CSVExportSession exportSession = SessionUtil - .getCSVExportSession(session); - Task task = SessionUtil.getCSVExportTask(session); - CSVExportMonitor exportMonitor = new CSVExportMonitor(); - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException("Error in exportCSV task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in exportCSV Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); + logger.debug("Session User:" + aslSession.getUsername()); - exportMonitor.setStatus(TaskStateMap.map(task.getStatus())); - Table table; - ExportMetadata exportMetadata; - TabExportMetadata trExportMetadata; - switch (exportMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - exportMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In Export"); - exportMonitor.setError(new Throwable( - "Error In Export")); - } - exportMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - 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 IN_PROGRESS: - exportMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - exportMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case 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; - default: - break; - } - } - SessionUtil.setCSVExportTask(session, task); + TRId trId = SessionUtil.getTRId(session); + if (trId == null) { + throw new TDGWTServiceException( + "Error no tabular resource in session"); } - logger.debug("getExportMonitor(): " + exportMonitor); - return exportMonitor; + if (trId.getTableId() == null) { + throw new TDGWTServiceException( + "Error no table present in session"); + } + + SessionUtil.setCSVExportSession(session, exportSession); + + Map parameterInstance = csvExportFileParameter(exportSession); + + logger.debug("Tabular Data Service"); + + AuthorizationProvider.instance.set(new AuthorizationToken( + aslSession.getUsername(), aslSession.getScope())); + TabularDataService service = TabularDataServiceFactory.getService(); + + // Export CSV file + OperationDefinition exportCSVFileOperation = OperationDefinitionMap + .map(OperationsId.CSVExport.toString(), service); + + OperationExecution invocation = new OperationExecution( + exportCSVFileOperation.getOperationId(), parameterInstance); + + logger.debug("OperationInvocation: \n" + invocation.toString()); + Task trTask = service.execute(invocation, new TabularResourceId( + Long.valueOf(trId.getId()))); + logger.debug("Start Task on service: TaskId " + trTask.getId()); + SessionUtil.setCSVExportEnd(session, false); + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.CSVExport, trId); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; - } catch (Throwable e) { + } catch (SecurityException e) { e.printStackTrace(); throw new TDGWTServiceException( - "Error in exportCSV CSVExportMonitor: " - + e.getLocalizedMessage()); - + "Security exception, you haven't rights!"); + } catch (Throwable e) { + e.printStackTrace(); + throw new TDGWTServiceException("Error in CSVExport: " + + e.getLocalizedMessage()); } } - /** - * Save export data on Workspace - * - * @param session - * @param user - * @param exportMetadata - * @param exportSession - * @throws TDGWTServiceException - */ - protected void saveInDestination(HttpSession session, String user, - ExportMetadata exportMetadata, CSVExportSession exportSession) - throws TDGWTServiceException { - 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"); - } - } + // TODO UpThis Monitor not updated /** * * {@inheritDoc} */ - public void startChangeColumnType( + public String startChangeColumnType( ChangeColumnTypeSession changeColumnTypeSession) throws TDGWTServiceException { try { @@ -3960,8 +3480,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setChangeColumnTypeTask(session, trTask); - return; + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.ChangeColumnType, changeColumnTypeSession + .getColumnData().getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -3977,123 +3501,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - /** - * {@inheritDoc} - */ - public ChangeColumnTypeMonitor getChangeColumnTypeMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - ChangeColumnTypeSession changeColumnTypeSession = SessionUtil - .getChangeColumnTypeSession(session); - - Task task = SessionUtil.getChangeColumnTypeTask(session); - ChangeColumnTypeMonitor changeColumnTypeMonitor = new ChangeColumnTypeMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in ChangeColumnType task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in ChangeColumnType Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - changeColumnTypeMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - Table table; - TRId trId; - TabResource tabResource; - switch (changeColumnTypeMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception: " - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - changeColumnTypeMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In ChangeColumnType"); - changeColumnTypeMonitor.setError(new Throwable( - "Error In ChangeColumnType")); - } - changeColumnTypeMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - changeColumnTypeMonitor.setProgress(task.getProgress()); - table = task.getResult().getPrimaryTable(); - logger.debug("Table retrived: " + table.toString()); - trId = new TRId(); - trId.setId(changeColumnTypeSession.getColumnData() - .getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - - changeColumnTypeMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - changeColumnTypeMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - changeColumnTypeMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - table = task.getResult().getPrimaryTable(); - logger.debug("Table retrived: " + table.toString()); - trId = new TRId(); - trId.setId(changeColumnTypeSession.getColumnData() - .getTrId().getId()); - - trId = retrieveTabularResourceBasicData(trId); - - changeColumnTypeMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setChangeColumnTypeTask(session, task); - } - - logger.debug("ChangeColumnTypeMonitor(): " - + changeColumnTypeMonitor); - return changeColumnTypeMonitor; - - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in change column type ChangeColumnTypeMonitor: " - + e.getLocalizedMessage()); - - } - - } - /** * * {@inheritDoc} */ - public void startAddColumn(AddColumnSession addColumnSession) + public String startAddColumn(AddColumnSession addColumnSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -4121,8 +3533,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setAddColumnTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.AddColumn, addColumnSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -4138,120 +3554,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - /** - * {@inheritDoc} - */ - public AddColumnMonitor getAddColumnMonitor() throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - AddColumnSession addColumnSession = SessionUtil - .getAddColumnSession(session); - - Task task = SessionUtil.getAddColumnTask(session); - AddColumnMonitor addColumnMonitor = new AddColumnMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in AddColumnMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in AddColumnMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - addColumnMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - Table table; - TRId trId; - TabResource tabResource; - switch (addColumnMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - addColumnMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In AddColumnMonitor"); - addColumnMonitor.setError(new Throwable( - "Error Add Column")); - } - addColumnMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - addColumnMonitor.setProgress(task.getProgress()); - table = task.getResult().getPrimaryTable(); - logger.debug("Table retrieved: " + table.toString()); - trId = new TRId(); - trId.setId(addColumnSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - - addColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - addColumnMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - addColumnMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - addColumnMonitor.setProgress(task.getProgress()); - table = task.getResult().getPrimaryTable(); - logger.debug("Table retrieved: " + table.toString()); - trId = new TRId(); - trId.setId(addColumnSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - - addColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setAddColumnTask(session, task); - } - - logger.debug("AddColumnMonitor(): " + addColumnMonitor); - return addColumnMonitor; - - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in add column monitor AddColumnMonitor: " - + e.getLocalizedMessage()); - - } - - } - /** * * {@inheritDoc} */ - public void startDeleteColumn(DeleteColumnSession deleteColumnSession) + public String startDeleteColumn(DeleteColumnSession deleteColumnSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -4281,8 +3588,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.executeBatch(invocation, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setDeleteColumnTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.DeleteColumn, deleteColumnSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -4298,121 +3609,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - /** - * {@inheritDoc} - */ - public DeleteColumnMonitor getDeleteColumnMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - DeleteColumnSession deleteColumnSession = SessionUtil - .getDeleteColumnSession(session); - - Task task = SessionUtil.getDeleteColumnTask(session); - DeleteColumnMonitor deleteColumnMonitor = new DeleteColumnMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in DeleteColumnMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in DeleteColumnMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - deleteColumnMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - Table table; - TRId trId; - TabResource tabResource; - switch (deleteColumnMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - deleteColumnMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In DeleteColumnMonitor"); - deleteColumnMonitor.setError(new Throwable( - "Error Deleting Column")); - } - deleteColumnMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - 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.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - - deleteColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - deleteColumnMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - deleteColumnMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case 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.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - - deleteColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setDeleteColumnTask(session, task); - } - - logger.debug("DeleteColumnMonitor(): " + deleteColumnMonitor); - return deleteColumnMonitor; - - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in delete column monitor DeleteColumnMonitor: " - + e.getLocalizedMessage()); - - } - - } - /** * * {@inheritDoc} */ - public void startLabelColumn(LabelColumnSession labelColumnSession) + public String startLabelColumn(LabelColumnSession labelColumnSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -4442,8 +3643,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setLabelColumnTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.ChangeColumnLabel, labelColumnSession + .getColumnData().getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; } catch (SecurityException e) { @@ -4458,119 +3664,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - /** - * {@inheritDoc} - */ - public LabelColumnMonitor getLabelColumnMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - LabelColumnSession labelColumnSession = SessionUtil - .getLabelColumnSession(session); - - Task task = SessionUtil.getLabelColumnTask(session); - LabelColumnMonitor labelColumnMonitor = new LabelColumnMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in LabelColumnMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in LabelColumnMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - labelColumnMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (labelColumnMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - labelColumnMonitor.setError(task - .getErrorCause()); - } else { - logger.debug("Task exception: Error In LabelColumnMonitor"); - labelColumnMonitor.setError(new Throwable( - "Error Changing the Column Label")); - } - labelColumnMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - labelColumnMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(labelColumnSession.getColumnData().getTrId() - .getId()); - trId = retrieveTabularResourceBasicData(trId); - - labelColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - labelColumnMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - labelColumnMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - labelColumnMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(labelColumnSession.getColumnData().getTrId() - .getId()); - trId = retrieveTabularResourceBasicData(trId); - - labelColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setLabelColumnTask(session, task); - } - - logger.debug("LabelColumnMonitor(): " + labelColumnMonitor); - return labelColumnMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in delete column monitor LabelColumnMonitor: " - + e.getLocalizedMessage()); - - } - - } - /** * * {@inheritDoc} */ @Override - public void startChangeTableType( + public String startChangeTableType( ChangeTableTypeSession changeTableTypeSession) throws TDGWTServiceException { try { @@ -4600,8 +3699,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setChangeTableTypeTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.ChangeTableType, + changeTableTypeSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; } catch (SecurityException e) { @@ -4615,119 +3719,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } - /** - * - * {@inheritDoc} - */ - @Override - public ChangeTableTypeMonitor getChangeTableTypeMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - ChangeTableTypeSession changeTableTypeSession = SessionUtil - .getChangeTableTypeSession(session); - - Task task = SessionUtil.getChangeTableTypeTask(session); - ChangeTableTypeMonitor changeTableTypeMonitor = new ChangeTableTypeMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in ChangeTableTypeMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in ChangeTableTypeMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - changeTableTypeMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - Table table; - TRId trId; - TabResource tabResource; - switch (changeTableTypeMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - changeTableTypeMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In ChangeTableTypeMonitor"); - changeTableTypeMonitor.setError(new Throwable( - "Error Changing the Table Type")); - } - changeTableTypeMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - 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 = retrieveTabularResourceBasicData(trId); - - changeTableTypeMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - changeTableTypeMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - changeTableTypeMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case 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 = retrieveTabularResourceBasicData(trId); - - changeTableTypeMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setChangeTableTypeTask(session, task); - } - - logger.debug("ChangeTableTypeMonitor(): " + changeTableTypeMonitor); - return changeTableTypeMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in change table type monitor ChangeTableTypeMonitor: " - + e.getLocalizedMessage()); - - } - - } - /** * Returns only CodeColumnType, CodeNameColumnType, * CodeDescriptionColumnType and AnnotationColumnType @@ -4851,7 +3842,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * {@inheritDoc} */ @Override - public void startDeleteRows(DeleteRowsSession deleteRowsSession) + public String startDeleteRows(DeleteRowsSession deleteRowsSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -4879,8 +3870,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setDeleteRowsTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.DeleteRow, deleteRowsSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; } catch (SecurityException e) { @@ -4900,120 +3895,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * {@inheritDoc} */ @Override - public DeleteRowsMonitor getDeleteRowsMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - DeleteRowsSession deleteRowsSession = SessionUtil - .getDeleteRowsSession(session); - - Task task = SessionUtil.getDeleteRowsTask(session); - DeleteRowsMonitor deleteRowsMonitor = new DeleteRowsMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in DeleteRowsMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in DeleteRowsMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - deleteRowsMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - // Table table; - TRId trId; - TabResource tabResource; - switch (deleteRowsMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception: " - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - deleteRowsMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In DeleteRowsMonitor"); - deleteRowsMonitor.setError(new Throwable( - "Error deleting rows")); - } - deleteRowsMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - deleteRowsMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(deleteRowsSession.getTrId().getId()); - - trId = retrieveTabularResourceBasicData(trId); - - deleteRowsMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - deleteRowsMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - deleteRowsMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - deleteRowsMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(deleteRowsSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - - deleteRowsMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setDeleteRowsTask(session, task); - } - - logger.debug("DeleteRowsMonitor(): " + deleteRowsMonitor); - return deleteRowsMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in monitor DeleteRowsMonitor: " - + e.getLocalizedMessage()); - - } - } - - /** - * - * {@inheritDoc} - */ - @Override - public void startCloneTabularResource( + public String startCloneTabularResource( CloneTabularResourceSession cloneTabularResourceSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); - SessionUtil.setCloneTabularResourceSession(session, - cloneTabularResourceSession); + ASLSession aslSession = SessionUtil.getAslSession(session); AuthorizationProvider.instance.set(new AuthorizationToken( @@ -5023,7 +3910,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements TabularDataService service = TabularDataServiceFactory.getService(); - OpExecution4Clone opEx = new OpExecution4Clone(service, cloneTabularResourceSession); OpExecutionDirector director = new OpExecutionDirector(); @@ -5035,14 +3921,45 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error in invocation: Operation not supported"); } - Long id = Long.valueOf(cloneTabularResourceSession.getTrId().getId()); + Long id = Long.valueOf(cloneTabularResourceSession.getTrId() + .getId()); + + TabularResourceId serviceTRId = new TabularResourceId(id); + TabularResource serviceTR = service.getTabularResource(serviceTRId); + + TabularResource cloneTR = service.createTabularResource(); + cloneTR.setAllMetadata(serviceTR.getAllMetadata()); + NameMetadata nameMetadata = cloneTR.getMetadata(NameMetadata.class); + String name; + if (nameMetadata != null) { + name = nameMetadata.getValue(); + if (name != null) { + name = name + "_cloned"; + } else { + name = "cloned"; + } + nameMetadata.setValue(name); + } else { + name = "cloned"; + nameMetadata = new NameMetadata("cloned"); + } + cloneTR.setMetadata(nameMetadata); + TRId trIdClone = new TRId( + String.valueOf(cloneTR.getId().getValue())); + + cloneTabularResourceSession.setTrIdClone(trIdClone); + SessionUtil.setCloneTabularResourceSession(session, + cloneTabularResourceSession); - TabularResourceId serviceTR = new TabularResourceId(id); logger.debug("OperationInvocation: \n" + invocation.toString()); - Task trTask = service.execute(invocation, serviceTR); + Task trTask = service.execute(invocation, cloneTR.getId()); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setCloneTask(session, trTask); - + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.Clone, trIdClone); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; } catch (SecurityException e) { @@ -5057,120 +3974,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - /** * * {@inheritDoc} */ @Override - public CloneMonitor getCloneMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - CloneTabularResourceSession cloneTabularResourceSession = SessionUtil - .getCloneTabularResourceSession(session); - - Task task = SessionUtil.getCloneTask(session); - CloneMonitor cloneMonitor = new CloneMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in CloneMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in CloneMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - cloneMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - // Table table; - TRId trId; - TabResource tabResource; - switch (cloneMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception: " - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - cloneMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In CloneMonitor"); - cloneMonitor.setError(new Throwable( - "Error cloning tabular resource")); - } - cloneMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - cloneMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(cloneTabularResourceSession.getTrId().getId()); - - trId = retrieveTabularResourceBasicData(trId); - - cloneMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - cloneMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - cloneMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - cloneMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(cloneTabularResourceSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - - cloneMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setCloneTask(session, task); - } - - logger.debug("CloneMonitor(): " + cloneMonitor); - return cloneMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in monitor CloneMonitor: " - + e.getLocalizedMessage()); - - } - } - - /** - * - * {@inheritDoc} - */ - @Override - public void startDuplicates(DuplicatesSession duplicatesSession) + public String startDuplicates(DuplicatesSession duplicatesSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -5198,8 +4007,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setDuplicatesTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.DuplicateTuples, duplicatesSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; } catch (SecurityException e) { @@ -5215,117 +4028,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - /** - * - * {@inheritDoc} - */ - @Override - public DuplicatesMonitor getDuplicatesMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - DuplicatesSession duplicatesSession = SessionUtil - .getDuplicatesSession(session); - - Task task = SessionUtil.getDuplicatesTask(session); - DuplicatesMonitor duplicatesMonitor = new DuplicatesMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in DuplicatesMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in DuplicatesMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - duplicatesMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - Table table; - TRId trId; - TabResource tabResource; - switch (duplicatesMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - duplicatesMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In DuplicatesMonitor"); - duplicatesMonitor.setError(new Throwable( - "Error in operation for duplicates")); - } - duplicatesMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - duplicatesMonitor.setProgress(task.getProgress()); - table = task.getResult().getPrimaryTable(); - logger.debug("Table retrived: " + table.toString()); - trId = new TRId(); - trId.setId(duplicatesSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - - duplicatesMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - duplicatesMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - duplicatesMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - duplicatesMonitor.setProgress(task.getProgress()); - table = task.getResult().getPrimaryTable(); - logger.debug("Table retrived: " + table.toString()); - trId = new TRId(); - trId.setId(duplicatesSession.getTrId().getId()); - - trId = retrieveTabularResourceBasicData(trId); - - duplicatesMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setDuplicatesTask(session, task); - } - - logger.debug("DuplicatesMonitor(): " + duplicatesMonitor); - return duplicatesMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in monitor DuplicatesMonitor: " - + e.getLocalizedMessage()); - - } - } - /** * * {@inheritDoc} @@ -5477,9 +4179,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements new Long(tabResource.getTrId().getId())); TabularResource tr = service.getTabularResource(tabularResourceId); - logger.debug("setTabResourceInformation - old information:"+tr); - - + logger.debug("setTabResourceInformation - old information:" + tr); + if (tabResource.getName() != null) { NameMetadata name = new NameMetadata(tabResource.getName()); tr.setMetadata(name); @@ -5508,8 +4209,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements tr.finalize(); } } - logger.debug("setTabResourceInformation - new information:"+tr); - + logger.debug("setTabResourceInformation - new information:" + tr); } catch (TDGWTSessionExpiredException e) { throw e; @@ -5636,7 +4336,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * {@inheritDoc} */ @Override - public void startTemplateApply(TemplateApplySession templateApplySession) + public String startTemplateApply(TemplateApplySession templateApplySession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -5652,10 +4352,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements .getTemplateData().getId()); TabularResourceId tabularResourceId = new TabularResourceId( new Long(templateApplySession.getTrId().getId())); - Task task = service.applyTemplate(templateId, tabularResourceId); + Task trTask = service.applyTemplate(templateId, tabularResourceId); logger.debug("startTemplateApply task start"); - SessionUtil.setTemplateApplyTask(session, task); + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.ApplyTemplate, + templateApplySession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); + } catch (TDGWTSessionExpiredException e) { throw e; } catch (SecurityException e) { @@ -5676,120 +4382,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * {@inheritDoc} */ @Override - public TemplateApplyMonitor getTemplateApplyMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - TemplateApplySession templateApplySession = SessionUtil - .getTemplateApplySession(session); - Task task = SessionUtil.getTemplateApplyTask(session); - TemplateApplyMonitor templateApplyMonitor = new TemplateApplyMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in TemplateApplyMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in TemplateApplyMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - templateApplyMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (templateApplyMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - templateApplyMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In TemplateApplyMonitor"); - templateApplyMonitor.setError(new Throwable( - "Error in operation applying template")); - } - templateApplyMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - templateApplyMonitor.setProgress(task.getProgress()); - - trId = new TRId(); - trId.setId(templateApplySession.getTrId().getId()); - - trId = retrieveTabularResourceBasicData(trId); - - templateApplyMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - templateApplyMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - templateApplyMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - templateApplyMonitor.setProgress(task.getProgress()); - - trId = new TRId(); - trId.setId(templateApplySession.getTrId().getId()); - - trId = retrieveTabularResourceBasicData(trId); - - templateApplyMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setTemplateApplyTask(session, task); - } - - logger.debug("TemplateApplyMonitor(): " + templateApplyMonitor); - return templateApplyMonitor; - - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (SecurityException e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); - } catch (Throwable e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in monitor DuplicatesMonitor: " - + e.getLocalizedMessage()); - } - } - - /** - * - * {@inheritDoc} - */ - @Override - public void startTemplateDelete(TemplateDeleteSession templateDeleteSession) + public void templateDelete(TemplateDeleteSession templateDeleteSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -5832,7 +4425,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * {@inheritDoc} */ @Override - public void startReplaceColumn(ReplaceColumnSession replaceColumnSession) + public String startReplaceColumn(ReplaceColumnSession replaceColumnSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -5860,8 +4453,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setReplaceColumnTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.ReplaceValue, replaceColumnSession + .getColumnData().getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -5883,120 +4481,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * {@inheritDoc} */ @Override - public ReplaceColumnMonitor getReplaceColumnMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - ReplaceColumnSession replaceColumnSession = SessionUtil - .getReplaceColumnSession(session); - - Task task = SessionUtil.getReplaceColumnTask(session); - ReplaceColumnMonitor replaceColumnMonitor = new ReplaceColumnMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in ReplaceColumnMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in ReplaceColumnMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - replaceColumnMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (replaceColumnMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - replaceColumnMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In ReplaceColumnMonitor"); - replaceColumnMonitor.setError(new Throwable( - "Error replacing the Column value")); - } - replaceColumnMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - replaceColumnMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(replaceColumnSession.getTrId().getId()); - - trId = retrieveTabularResourceBasicData(trId); - - replaceColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - replaceColumnMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - replaceColumnMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - replaceColumnMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(replaceColumnSession.getColumnData() - .getTrId().getId()); - - trId = retrieveTabularResourceBasicData(trId); - - replaceColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setReplaceColumnTask(session, task); - } - - logger.debug("ReplaceColumnMonitor(): " + replaceColumnMonitor); - return replaceColumnMonitor; - - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - logger.debug("Error in replace column monitor ReplaceColumnMonitor: " - + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException( - "Error in replace column monitor ReplaceColumnMonitor: " - + e.getLocalizedMessage()); - - } - - } - - /** - * - * {@inheritDoc} - */ - @Override - public void startReplaceBatchColumn( + public String startReplaceBatchColumn( ReplaceBatchColumnSession replaceBatchColumnSession) throws TDGWTServiceException { try { @@ -6030,8 +4515,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException("Task not started"); } logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setReplaceBatchColumnTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.ReplaceBatch, + replaceBatchColumnSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -6048,124 +4538,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - /** - * - * {@inheritDoc} - */ - @Override - public ReplaceBatchColumnMonitor getReplaceBatchColumnMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - ReplaceBatchColumnSession replaceBatchColumnSession = SessionUtil - .getReplaceBatchColumnSession(session); - - Task task = SessionUtil.getReplaceBatchColumnTask(session); - ReplaceBatchColumnMonitor replaceBatchColumnMonitor = new ReplaceBatchColumnMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in ReplaceBatchColumnMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in ReplaceBatchColumnMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - replaceBatchColumnMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (replaceBatchColumnMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - replaceBatchColumnMonitor.setError(new Throwable( - task.getErrorCause())); - } else { - logger.debug("Task exception: Error In ReplaceBatchColumnMonitor"); - replaceBatchColumnMonitor.setError(new Throwable( - "Error replacing the Column value")); - } - replaceBatchColumnMonitor.setProgress(task - .getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - replaceBatchColumnMonitor.setProgress(task - .getProgress()); - trId = new TRId(); - trId.setId(replaceBatchColumnSession.getTrId().getId()); - - trId = retrieveTabularResourceBasicData(trId); - - replaceBatchColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - replaceBatchColumnMonitor.setProgress(task - .getProgress()); - break; - case VALIDATING_RULES: - replaceBatchColumnMonitor.setProgress(task - .getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - replaceBatchColumnMonitor.setProgress(task - .getProgress()); - trId = new TRId(); - trId.setId(replaceBatchColumnSession.getColumnData() - .getTrId().getId()); - - trId = retrieveTabularResourceBasicData(trId); - - replaceBatchColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setReplaceBatchColumnTask(session, task); - } - - logger.debug("ReplaceBatchColumnMonitor(): " - + replaceBatchColumnMonitor); - return replaceBatchColumnMonitor; - - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - logger.debug("Error in ReplaceBatchColumnMonitor: " - + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException("Error in replace batch: " - + e.getLocalizedMessage()); - - } - - } - /** * * {@inheritDoc} @@ -6475,7 +4847,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements sdf.format(step.getExecutionDate().getTime())); logger.debug("Discard :" + op); rollBackSession = new RollBackSession(trId, historyId); - rollBack(rollBackSession); + startRollBack(rollBackSession); } else { logger.debug("Discard : step null"); @@ -6509,7 +4881,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * {@inheritDoc} */ @Override - public void rollBack(RollBackSession rollBackSession) + public String startRollBack(RollBackSession rollBackSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -6533,8 +4905,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException("Task not started"); } logger.debug("Start Task on service: " + trTask.getId()); - SessionUtil.setRollBackSessionTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.RollBack, rollBackSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -6550,117 +4926,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } - /** - * - * {@inheritDoc} - */ - @Override - public RollBackSessionMonitor getRollBackMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - RollBackSession rollBackSession = SessionUtil - .getRollBackSession(session); - - Task task = SessionUtil.getRollBackSessionTask(session); - RollBackSessionMonitor rollBackMonitor = new RollBackSessionMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in RollBackMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in RollBackSessionMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - rollBackMonitor - .setStatus(TaskStateMap.map(task.getStatus())); - - TRId trId; - TabResource tabResource; - switch (rollBackMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - rollBackMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In RollBackSessionMonitor"); - rollBackMonitor.setError(new Throwable( - "Error in roll back")); - } - rollBackMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - rollBackMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(rollBackSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - rollBackMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - rollBackMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - rollBackMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - rollBackMonitor.setProgress(task.getProgress()); - - trId = retrieveTabularResourceBasicData(rollBackSession - .getTrId()); - - rollBackMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setRollBackSessionTask(session, task); - } - - logger.debug("RollBackSessionMonitor(): " + rollBackMonitor); - return rollBackMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (SecurityException e) { - e.printStackTrace(); - throw new TDGWTServiceException( - "Security exception, you haven't rights!"); - } catch (Throwable e) { - logger.debug("Error in RollBackSessionMonitor: " - + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException("Error in rollback: " - + e.getLocalizedMessage()); - - } - - } - @Override public ValidationsTasksMetadata getValidationsTasksMetadata(TRId trId) throws TDGWTServiceException { @@ -6727,8 +4992,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } State state = TaskStateMap.map(task.getStatus()); TaskS taskS = new TaskS(task.getId().getValue(), - task.getProgress(), state, task.getSubmitter(), - task.getStartTime(), task.getEndTime(), jobSList); + task.getProgress(), state, task.getErrorCause(), + task.getSubmitter(), task.getStartTime(), + task.getEndTime(), jobSList); taskSList.add(taskS); } @@ -6755,7 +5021,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } @Override - public void startEditRow(EditRowSession editRowSession) + public String startEditRow(EditRowSession editRowSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -6783,8 +5049,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setEditRowTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.EditRow, editRowSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -6800,106 +5070,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - @Override - public EditRowMonitor getEditRowMonitor() throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - EditRowSession editRowSession = SessionUtil - .getEditRowSession(session); - - Task task = SessionUtil.getEditRowTask(session); - EditRowMonitor editRowMonitor = new EditRowMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in EditRowMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in EditRowMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - editRowMonitor - .setStatus(TaskStateMap.map(task.getStatus())); - - TRId trId; - TabResource tabResource; - switch (editRowMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - editRowMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In EditRowMonitor"); - editRowMonitor.setError(new Throwable( - "Error in edit row")); - } - editRowMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - editRowMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(editRowSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - editRowMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - editRowMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - editRowMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - editRowMonitor.setProgress(task.getProgress()); - - trId = retrieveTabularResourceBasicData(editRowSession - .getTrId()); - - editRowMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setEditRowTask(session, task); - } - - logger.debug("EditMonitor(): " + editRowMonitor); - return editRowMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - logger.debug("Error in EditRowMonitor: " + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); - - } - - } - /** * * @@ -6951,7 +5121,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } @Override - public void startTaskResubmit(TaskResubmitSession taskResubmitSession) + public String startTaskResubmit(TaskResubmitSession taskResubmitSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -6979,8 +5149,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements Task trTask = service.resubmit(taskId); logger.debug("Resubmit Task on service: TaskId " + trTask.getId()); - SessionUtil.setTaskResubmitTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.ResubmitTask, taskResubmitSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -6997,109 +5170,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } @Override - public TaskResubmitMonitor getTaskResubmitMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - TaskResubmitSession taskResubmitSession = SessionUtil - .getTaskResubmitSession(session); - - Task task = SessionUtil.getTaskResubmitTask(session); - TaskResubmitMonitor taskResubmitMonitor = new TaskResubmitMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in TaskResubmitMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in TaskResubmitMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - taskResubmitMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (taskResubmitMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - taskResubmitMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In TaskResubmitMonitor"); - taskResubmitMonitor.setError(new Throwable( - "Error task resubmit")); - } - taskResubmitMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - taskResubmitMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(taskResubmitSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - taskResubmitMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - taskResubmitMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - taskResubmitMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - taskResubmitMonitor.setProgress(task.getProgress()); - - trId = retrieveTabularResourceBasicData(taskResubmitSession - .getTrId()); - - taskResubmitMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setTaskResubmitTask(session, task); - } - - logger.debug("TaskResubmitMonitor(): " + taskResubmitMonitor); - return taskResubmitMonitor; - - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - logger.debug("Error in TaskResubmitMonitor: " - + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); - - } - } - - @Override - public void startTaskResume(TaskResumeSession taskResumeSession) + public String startTaskResume(TaskResumeSession taskResumeSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -7216,8 +5287,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - SessionUtil.setTaskResumeTask(session, trTask); - return; + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.ResumeTask, taskResumeSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -7234,108 +5308,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } @Override - public TaskResumeMonitor getTaskResumeMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - TaskResumeSession taskResumeSession = SessionUtil - .getTaskResumeSession(session); - - Task task = SessionUtil.getTaskResumeTask(session); - TaskResumeMonitor taskResumeMonitor = new TaskResumeMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in TaskResumeMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in TaskResumeMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - taskResumeMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (taskResumeMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - taskResumeMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In TaskResumeMonitor"); - taskResumeMonitor.setError(new Throwable( - "Error task resume")); - } - taskResumeMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - taskResumeMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(taskResumeSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - taskResumeMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - taskResumeMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - taskResumeMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - taskResumeMonitor.setProgress(task.getProgress()); - - trId = retrieveTabularResourceBasicData(taskResumeSession - .getTrId()); - - taskResumeMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setTaskResumeTask(session, task); - } - - logger.debug("TaskResumeMonitor(): " + taskResumeMonitor); - return taskResumeMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - logger.debug("Error in TaskResumeMonitor: " - + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); - - } - } - - @Override - public void startExtractCodelist( + public String startExtractCodelist( ExtractCodelistSession extractCodelistSession) throws TDGWTServiceException { try { @@ -7372,8 +5345,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements Task trTask = service.execute(invocation, serviceTR); logger.debug("Extract Codelist on service: TaskId " + trTask.getId()); - SessionUtil.setExtractCodelistTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.ExtractCodelist, + extractCodelistSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -7389,109 +5366,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - @Override - public ExtractCodelistMonitor getExtractCodelistMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - ExtractCodelistSession extractCodelistSession = SessionUtil - .getExtractCodelistSession(session); - - Task task = SessionUtil.getExtractCodelistTask(session); - ExtractCodelistMonitor extractCodelistMonitor = new ExtractCodelistMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in ExtractCodelistMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in ExtractCodelistMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - extractCodelistMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (extractCodelistMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - extractCodelistMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In ExtractCodelistMonitor"); - extractCodelistMonitor.setError(new Throwable( - "Error task resume")); - } - extractCodelistMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - extractCodelistMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(extractCodelistSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - extractCodelistMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - extractCodelistMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - extractCodelistMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - extractCodelistMonitor.setProgress(task.getProgress()); - - trId = retrieveTabularResourceBasicData(extractCodelistSession - .getTrId()); - - extractCodelistMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setExtractCodelistTask(session, task); - } - - logger.debug("ExtractCodelistMonitor(): " + extractCodelistMonitor); - return extractCodelistMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - logger.debug("Error in ExtractCodelistMonitor: " - + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); - - } - } - // TODO - public void startSplitColumn(SplitColumnSession splitColumnSession, + public String startSplitColumn(SplitColumnSession splitColumnSession, HttpSession session) throws TDGWTServiceException { try { // HttpSession session = this.getThreadLocalRequest().getSession(); @@ -7527,8 +5403,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocations.toString()); Task trTask = service.executeBatch(invocations, serviceTR); logger.debug("Split Column on service: TaskId " + trTask.getId()); - SessionUtil.setSplitColumnTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.SplitColumn, splitColumnSession + .getColumnData().getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -7544,110 +5424,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - @Override - public SplitColumnMonitor getSplitColumnMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - SplitColumnSession splitColumnSession = SessionUtil - .getSplitColumnSession(session); - - Task task = SessionUtil.getSplitColumnTask(session); - SplitColumnMonitor splitColumnMonitor = new SplitColumnMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in SplitColumnMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in SplitColumnMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - splitColumnMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (splitColumnMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - splitColumnMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In SplitColumnMonitor"); - splitColumnMonitor.setError(new Throwable( - "Error task resume")); - } - splitColumnMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - splitColumnMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(splitColumnSession.getColumnData().getTrId() - .getId()); - trId = retrieveTabularResourceBasicData(trId); - splitColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - splitColumnMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - splitColumnMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - splitColumnMonitor.setProgress(task.getProgress()); - - trId = retrieveTabularResourceBasicData(splitColumnSession - .getColumnData().getTrId()); - - splitColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setSplitColumnTask(session, task); - } - - logger.debug("SplitColumnMonitor(): " + splitColumnMonitor); - return splitColumnMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - logger.debug("Error in SplitColumnMonitor: " - + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); - - } - } - // TODO - public void startMergeColumn(MergeColumnSession mergeColumnSession, + public String startMergeColumn(MergeColumnSession mergeColumnSession, HttpSession session) throws TDGWTServiceException { try { // HttpSession session = this.getThreadLocalRequest().getSession(); @@ -7676,16 +5454,20 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error in invocation: Operation not supported"); } - - Long id = Long.valueOf(mergeColumnSession.getColumnDataSource1().getTrId() - .getId()); + + Long id = Long.valueOf(mergeColumnSession.getColumnDataSource1() + .getTrId().getId()); TabularResourceId serviceTR = new TabularResourceId(id); logger.debug("OperationInvocation: \n" + invocations.toString()); Task trTask = service.executeBatch(invocations, serviceTR); logger.debug("Merge Column on service: TaskId " + trTask.getId()); - SessionUtil.setMergeColumnTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.MergeColumn, mergeColumnSession + .getColumnDataSource1().getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -7701,107 +5483,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - @Override - public MergeColumnMonitor getMergeColumnMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - MergeColumnSession mergeColumnSession = SessionUtil - .getMergeColumnSession(session); - - Task task = SessionUtil.getMergeColumnTask(session); - MergeColumnMonitor mergeColumnMonitor = new MergeColumnMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in MergeColumnMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in MergeColumnMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - mergeColumnMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (mergeColumnMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - mergeColumnMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In MergeColumnMonitor"); - mergeColumnMonitor.setError(new Throwable( - "Error task resume")); - } - mergeColumnMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - mergeColumnMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(mergeColumnSession.getColumnDataSource1().getTrId() - .getId()); - trId = retrieveTabularResourceBasicData(trId); - mergeColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - mergeColumnMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - mergeColumnMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - mergeColumnMonitor.setProgress(task.getProgress()); - trId = retrieveTabularResourceBasicData(mergeColumnSession - .getColumnDataSource1().getTrId()); - - mergeColumnMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setMergeColumnTask(session, task); - } - - logger.debug("MergeColumnMonitor(): " + mergeColumnMonitor); - return mergeColumnMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - logger.debug("Error in MergeColumnMonitor: " - + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); - - } - } - @Override public void setCodelistMappingSession( CodelistMappingSession codelistMappingSession) @@ -7868,12 +5549,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } CodelistMappingFileUploadSession fileUploadSession = new CodelistMappingFileUploadSession(); - CodelistMappingMonitor codelistMappingMonitor = new CodelistMappingMonitor(); + // CodelistMappingMonitor codelistMappingMonitor = new + // CodelistMappingMonitor(); FileUploadMonitor fileUploadMonitor = new FileUploadMonitor(); fileUploadSession.setId(session.getId()); fileUploadSession.setFileUploadState(FileUploadState.STARTED); - fileUploadSession.setCodelistMappingMonitor(codelistMappingMonitor); + // fileUploadSession.setCodelistMappingMonitor(codelistMappingMonitor); SessionUtil.setFileUploadMonitor(session, fileUploadMonitor); SessionUtil.setCodelistMappingFileUploadSession(session, @@ -7911,7 +5593,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } @Override - public void startCodelistMappingImport( + public String startCodelistMappingImport( CodelistMappingSession codelistMappingSession) throws TDGWTServiceException { try { @@ -7923,9 +5605,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("Session:" + session.getId()); ASLSession aslSession = SessionUtil.getAslSession(session); - if (aslSession == null) { - throw new TDGWTServiceException("ASLSession is null"); - } + String user = aslSession.getUsername(); logger.debug("Session User:" + user); @@ -7940,116 +5620,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setCodelistMappingSession(session, codelistMappingSession); - importCodelistMappingFileOnService(session, aslSession, user, + String taskId=importCodelistMappingFileOnService(session, aslSession, user, codelistMappingSession); + return taskId; + } catch (TDGWTSessionExpiredException e) { throw e; - } catch (Throwable e) { + } catch (SecurityException e) { e.printStackTrace(); throw new TDGWTServiceException( - "Error in Codelist Mapping import: " - + e.getLocalizedMessage()); - } - } - - @Override - public CodelistMappingMonitor getCodelistMappingMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - CodelistMappingSession codelistMappingSession = SessionUtil - .getCodelistMappingSession(session); - - Task task = SessionUtil.getCodelistMappingTask(session); - CodelistMappingMonitor codelistMappingMonitor = new CodelistMappingMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in CodelistMappingMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in CodelistMappingMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - codelistMappingMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (codelistMappingMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - codelistMappingMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In CodelistMappingMonitor"); - codelistMappingMonitor.setError(new Throwable( - "Error task resume")); - } - codelistMappingMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - codelistMappingMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(codelistMappingSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - codelistMappingMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - codelistMappingMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - codelistMappingMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - codelistMappingMonitor.setProgress(task.getProgress()); - trId = retrieveTabularResourceBasicData(codelistMappingSession - .getTrId()); - - codelistMappingMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setCodelistMappingTask(session, task); - } - - logger.debug("CodelistMappingMonitor(): " + codelistMappingMonitor); - return codelistMappingMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; + "Security exception, you haven't rights!"); } catch (Throwable e) { - logger.debug("Error in CodelistMappingMonitor: " - + e.getLocalizedMessage()); e.printStackTrace(); - throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); - + throw new TDGWTServiceException("Error in Codelist Mapping import: " + + e.getLocalizedMessage()); } + } /** @@ -8059,7 +5645,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * @param codelistMappingSession * @throws TDGWTServiceException */ - protected void importCodelistMappingFileOnService(HttpSession session, + protected String importCodelistMappingFileOnService(HttpSession session, ASLSession aslSession, String user, CodelistMappingSession codelistMappingSession) throws Throwable { @@ -8113,24 +5699,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements Task trTask = service.execute(invocation, serviceTR); logger.debug("Codelist Mapping Import on service: TaskId " + trTask.getId()); - SessionUtil.setCodelistMappingTask(session, trTask); - return; + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.CodelistMappingImport, + codelistMappingSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + return trTask.getId().getValue(); } // TODO - public void startGroupBy(GroupBySession groupBySession, HttpSession session) + public String startGroupBy(GroupBySession groupBySession, HttpSession session) throws TDGWTServiceException { try { // HttpSession session = this.getThreadLocalRequest().getSession(); SessionUtil.setGroupBySession(session, groupBySession); ASLSession aslSession = SessionUtil.getAslSession(session); - if (groupBySession == null) { - logger.error("GroupBySession is null"); - throw new TDGWTServiceException( - "Error in groupby : GroupBySession is null"); - } - + logger.debug("StartGroupBy: " + groupBySession); AuthorizationProvider.instance.set(new AuthorizationToken( aslSession.getUsername(), aslSession.getScope())); @@ -8153,8 +5737,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR); logger.debug("GroupBy start on service: TaskId " + trTask.getId()); - SessionUtil.setGroupByTask(session, trTask); - return; + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.GroupBy, groupBySession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -8170,106 +5756,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } @Override - public GroupByMonitor getGroupByMonitor() throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - GroupBySession groupBySession = SessionUtil - .getGroupBySession(session); - - Task task = SessionUtil.getGroupByTask(session); - GroupByMonitor groupByMonitor = new GroupByMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in GroupByMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in GroupByMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - groupByMonitor - .setStatus(TaskStateMap.map(task.getStatus())); - - TRId trId; - TabResource tabResource; - switch (groupByMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - groupByMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In GroupByMonitor"); - groupByMonitor.setError(new Throwable( - "Error task resume")); - } - groupByMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - groupByMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(groupBySession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - groupByMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - groupByMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - groupByMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - groupByMonitor.setProgress(task.getProgress()); - - trId = retrieveTabularResourceBasicData(groupBySession - .getTrId()); - - groupByMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setGroupByTask(session, task); - } - - logger.debug("GroupByMonitor(): " + groupByMonitor); - return groupByMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - logger.debug("Error in GroupByMonitor: " + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); - - } - } - - @Override - public void startNormalization(NormalizationSession normalizationSession) + public String startNormalization(NormalizationSession normalizationSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -8304,8 +5791,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements Task trTask = service.execute(invocation, serviceTR); logger.debug("Normalization start on service: TaskId " + trTask.getId()); - SessionUtil.setNormalizationTask(session, trTask); - return; + + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.Normalize, normalizationSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -8322,108 +5812,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } @Override - public NormalizationMonitor getNormalizationMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - NormalizationSession normalizationSession = SessionUtil - .getNormalizationSession(session); - - Task task = SessionUtil.getNormalizationTask(session); - NormalizationMonitor normalizationMonitor = new NormalizationMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in NormalizationMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in NormalizationMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - normalizationMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (normalizationMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - normalizationMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In NormalizationMonitor"); - normalizationMonitor.setError(new Throwable( - "Error task resume")); - } - normalizationMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - normalizationMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(normalizationSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - normalizationMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - normalizationMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - normalizationMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - normalizationMonitor.setProgress(task.getProgress()); - - trId = retrieveTabularResourceBasicData(normalizationSession - .getTrId()); - - normalizationMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setNormalizationTask(session, task); - } - - logger.debug("NormalizationMonitor(): " + normalizationMonitor); - return normalizationMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - logger.debug("Error in NormalizationMonitor: " - + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); - - } - } - - @Override - public void startDenormalization( + public String startDenormalization( DenormalizationSession denormalizationSession) throws TDGWTServiceException { try { @@ -8460,8 +5849,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements Task trTask = service.execute(invocation, serviceTR); logger.debug("Denormalization start on service: TaskId " + trTask.getId()); - SessionUtil.setDenormalizationTask(session, trTask); - return; + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.Denormalize, + denormalizationSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -8477,113 +5869,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } - @Override - public DenormalizationMonitor getDenormalizationMonitor() - throws TDGWTServiceException { - try { - HttpSession session = this.getThreadLocalRequest().getSession(); - DenormalizationSession denormalizationSession = SessionUtil - .getDenormalizationSession(session); - - Task task = SessionUtil.getDenormalizationTask(session); - DenormalizationMonitor denormalizationMonitor = new DenormalizationMonitor(); - - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in DenormalizationMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in DenormalizationMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - denormalizationMonitor.setStatus(TaskStateMap.map(task - .getStatus())); - - TRId trId; - TabResource tabResource; - switch (denormalizationMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - denormalizationMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In DenormalizationMonitor"); - denormalizationMonitor.setError(new Throwable( - "Error task resume")); - } - denormalizationMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - denormalizationMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(denormalizationSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - denormalizationMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - denormalizationMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - denormalizationMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - denormalizationMonitor.setProgress(task.getProgress()); - - trId = retrieveTabularResourceBasicData(denormalizationSession - .getTrId()); - - denormalizationMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setDenormalizationTask(session, task); - } - - logger.debug("DenormalizationMonitor(): " + denormalizationMonitor); - return denormalizationMonitor; - } catch (TDGWTSessionExpiredException e) { - throw e; - } catch (Throwable e) { - logger.debug("Error in DenormalizationMonitor: " - + e.getLocalizedMessage()); - e.printStackTrace(); - throw new TDGWTServiceException("Error: " + e.getLocalizedMessage()); - - } - } - /** * * {@inheritDoc} */ @Override - public void startUnion(UnionSession unionSession) + public String startUnion(UnionSession unionSession) throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); @@ -8611,8 +5902,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements logger.debug("OperationInvocation: \n" + invocation.toString()); Task trTask = service.execute(invocation, serviceTR); logger.debug("Start Task on service: TaskId " + trTask.getId()); - SessionUtil.setUnionTask(session, trTask); - return; + TaskWrapper taskWrapper = new TaskWrapper(trTask, + UIOperationsId.Union, unionSession.getTrId()); + SessionUtil.setTaskStarted(session, taskWrapper); + return trTask.getId().getValue(); } catch (TDGWTSessionExpiredException e) { throw e; @@ -8633,105 +5926,33 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements * {@inheritDoc} */ @Override - public UnionMonitor getUnionMonitor() throws TDGWTServiceException { + public OperationMonitor getOperationMonitor( + OperationMonitorSession operationMonitorSession) + throws TDGWTServiceException { try { HttpSession session = this.getThreadLocalRequest().getSession(); - UnionSession unionSession = SessionUtil.getUnionSession(session); + ASLSession aslSession = SessionUtil.getAslSession(session); - Task task = SessionUtil.getUnionTask(session); - UnionMonitor unionMonitor = new UnionMonitor(); + TaskWrapper taskWrapper = SessionUtil.getTaskStarted(session, + operationMonitorSession.getTaskId()); - if (task == null) { - logger.debug("Task null"); - throw new TDGWTServiceException( - "Error in UnionMonitor task null"); - } else { - TaskStatus status = task.getStatus(); - if (status == null) { - logger.debug("Services TaskStatus : null"); - throw new TDGWTServiceException( - "Error in UnionMonitor Status null"); - } else { - logger.debug("Services TaskStatus: " + task.getStatus()); - - unionMonitor.setStatus(TaskStateMap.map(task.getStatus())); - - TRId trId; - TabResource tabResource; - switch (unionMonitor.getStatus()) { - case FAILED: - if (task.getResult() != null) { - logger.debug("Task exception:" - + task.getErrorCause()); - task.getErrorCause().printStackTrace(); - unionMonitor.setError(new Throwable(task - .getErrorCause())); - } else { - logger.debug("Task exception: Error In UnionMonitor"); - unionMonitor.setError(new Throwable( - "Error in the union of tabular resources")); - } - unionMonitor.setProgress(task.getProgress()); - break; - case SUCCEDED: - logger.debug("Task Result:" + task.getResult()); - unionMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(unionSession.getTrId().getId()); - - trId = retrieveTabularResourceBasicData(trId); - - unionMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case IN_PROGRESS: - unionMonitor.setProgress(task.getProgress()); - break; - case VALIDATING_RULES: - unionMonitor.setProgress(task.getProgress()); - break; - case GENERATING_VIEW: - break; - case ABORTED: - break; - case STOPPED: - logger.debug("Task Result:" + task.getResult()); - unionMonitor.setProgress(task.getProgress()); - trId = new TRId(); - trId.setId(unionSession.getTrId().getId()); - trId = retrieveTabularResourceBasicData(trId); - - unionMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); - SessionUtil.setTRId(session, trId); - break; - case INITIALIZING: - break; - default: - break; - } - } - SessionUtil.setUnionTask(session, task); - } - - logger.debug("UnionMonitor(): " + unionMonitor); - return unionMonitor; + OperationMonitorCreator operationMonitorCreator = new OperationMonitorCreator( + session, aslSession, taskWrapper, operationMonitorSession); + OperationMonitor operationMonitor = operationMonitorCreator + .create(); + logger.debug("OperationMonitor(): " + operationMonitor); + return operationMonitor; } catch (TDGWTSessionExpiredException e) { throw e; + } catch (TDGWTServiceException e) { + throw e; } catch (Throwable e) { - logger.debug("Error in UnionMonitor: " + e.getLocalizedMessage()); e.printStackTrace(); - throw new TDGWTServiceException("Error in union monitor: " + throw new TDGWTServiceException("Error in Operation Monitor: " + e.getLocalizedMessage()); } - } } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CSVFileUploadSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CSVFileUploadSession.java index 3d0c64b..a538e41 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CSVFileUploadSession.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CSVFileUploadSession.java @@ -3,7 +3,6 @@ package org.gcube.portlets.user.td.gwtservice.server.file; import java.io.File; import java.io.Serializable; -import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVParserConfiguration; import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState; @@ -26,7 +25,7 @@ public class CSVFileUploadSession implements Serializable { protected CSVParserConfiguration parserConfiguration; - protected CSVImportMonitor csvImportMonitor; + //protected CSVImportMonitor csvImportMonitor; public String getId() { @@ -69,23 +68,13 @@ public class CSVFileUploadSession implements Serializable { this.parserConfiguration = parserConfiguration; } - public CSVImportMonitor getCsvImportMonitor() { - return csvImportMonitor; - } - - public void setCsvImportMonitor(CSVImportMonitor csvImportMonitor) { - this.csvImportMonitor = csvImportMonitor; - } - @Override public String toString() { return "CSVFileUploadSession [id=" + id + ", fileUploadState=" + fileUploadState + ", csvFile=" + csvFile + ", csvName=" + csvName + ", parserConfiguration=" + parserConfiguration - + ", csvImportMonitor=" + csvImportMonitor + "]"; + + "]"; } - - } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CodelistMappingFileUploadSession.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CodelistMappingFileUploadSession.java index b586132..d61d482 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CodelistMappingFileUploadSession.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/file/CodelistMappingFileUploadSession.java @@ -4,7 +4,6 @@ import java.io.File; import java.io.Serializable; import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState; -import org.gcube.portlets.user.td.gwtservice.shared.monitor.CodelistMappingMonitor; /** * @@ -23,7 +22,7 @@ public class CodelistMappingFileUploadSession implements Serializable { protected File codelistMappingFile; protected String codelistMappingName; - protected CodelistMappingMonitor codelistMappingMonitor; + //protected CodelistMappingMonitor codelistMappingMonitor; public String getId() { return id; @@ -58,23 +57,16 @@ public class CodelistMappingFileUploadSession implements Serializable { this.codelistMappingName = codelistMappingName; } - public CodelistMappingMonitor getCodelistMappingMonitor() { - return codelistMappingMonitor; - } - - public void setCodelistMappingMonitor( - CodelistMappingMonitor codelistMappingMonitor) { - this.codelistMappingMonitor = codelistMappingMonitor; - } - @Override public String toString() { return "CodelistMappingFileUploadSession [id=" + id + ", fileUploadState=" + fileUploadState + ", codelistMappingFile=" + codelistMappingFile - + ", codelistMappingName=" + codelistMappingName - + ", codelistMappingMonitor=" + codelistMappingMonitor + "]"; + + ", codelistMappingName=" + codelistMappingName + "]"; } + + + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/AddColumnMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/AddColumnMonitor.java deleted file mode 100644 index 9b760c9..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/AddColumnMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class AddColumnMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = -7694151843138161474L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ChangeTableTypeMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ChangeTableTypeMonitor.java deleted file mode 100644 index 6918a4e..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ChangeTableTypeMonitor.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -public class ChangeTableTypeMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = 991656197616922469L; - - - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CloneMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CloneMonitor.java deleted file mode 100644 index 26f35fb..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CloneMonitor.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -public class CloneMonitor extends OperationMonitor implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 8626668361737808483L; - - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CodelistMappingMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CodelistMappingMonitor.java deleted file mode 100644 index ee0ce88..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/CodelistMappingMonitor.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * - */ -public class CodelistMappingMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = -9004720851025676043L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DeleteColumnMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DeleteColumnMonitor.java deleted file mode 100644 index ab17c72..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DeleteColumnMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class DeleteColumnMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = -7694151843138161474L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DeleteRowsMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DeleteRowsMonitor.java deleted file mode 100644 index f926fca..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DeleteRowsMonitor.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -public class DeleteRowsMonitor extends OperationMonitor implements Serializable { - /** - * - */ - private static final long serialVersionUID = -1547897501452634298L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DenormalizationMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DenormalizationMonitor.java deleted file mode 100644 index fb6bc11..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DenormalizationMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * email: g.panichi@isti.cnr.it - * - */ -public class DenormalizationMonitor extends OperationMonitor implements - Serializable { - - - private static final long serialVersionUID = -1943471748865606817L; - - - -} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DuplicatesMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DuplicatesMonitor.java deleted file mode 100644 index 44f0cd3..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/DuplicatesMonitor.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -public class DuplicatesMonitor extends OperationMonitor implements Serializable { - - private static final long serialVersionUID = 2329951047629617335L; - - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/EditRowMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/EditRowMonitor.java deleted file mode 100644 index 2c7a0d4..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/EditRowMonitor.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -public class EditRowMonitor extends OperationMonitor implements Serializable { - /** - * - */ - private static final long serialVersionUID = -1547897501452634298L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ExtractCodelistMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ExtractCodelistMonitor.java deleted file mode 100644 index 5fe78b0..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ExtractCodelistMonitor.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class ExtractCodelistMonitor extends OperationMonitor implements Serializable { - - private static final long serialVersionUID = -9042796707453619895L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/GroupByMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/GroupByMonitor.java deleted file mode 100644 index dc52463..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/GroupByMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class GroupByMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = -7694151843138161474L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/LabelColumnMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/LabelColumnMonitor.java deleted file mode 100644 index 3957b46..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/LabelColumnMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class LabelColumnMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = -7694151843138161474L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/MergeColumnMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/MergeColumnMonitor.java deleted file mode 100644 index 4a93585..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/MergeColumnMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class MergeColumnMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = -7694151843138161474L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/NormalizationMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/NormalizationMonitor.java deleted file mode 100644 index eee2f43..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/NormalizationMonitor.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * email: g.panichi@isti.cnr.it - * - */ -public class NormalizationMonitor extends OperationMonitor implements - Serializable { - - private static final long serialVersionUID = -7021715301225849091L; - -} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ReplaceBatchColumnMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ReplaceBatchColumnMonitor.java deleted file mode 100644 index a97aa79..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ReplaceBatchColumnMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class ReplaceBatchColumnMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = -7694151843138161474L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ReplaceColumnMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ReplaceColumnMonitor.java deleted file mode 100644 index d8cf3bd..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/ReplaceColumnMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class ReplaceColumnMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = -7694151843138161474L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/RollBackSessionMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/RollBackSessionMonitor.java deleted file mode 100644 index 1227005..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/RollBackSessionMonitor.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class RollBackSessionMonitor extends OperationMonitor implements Serializable { - - private static final long serialVersionUID = -4213157032725005579L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SplitColumnMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SplitColumnMonitor.java deleted file mode 100644 index 6f8475a..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/SplitColumnMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class SplitColumnMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = -7694151843138161474L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TaskResubmitMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TaskResubmitMonitor.java deleted file mode 100644 index 1dcaec7..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TaskResubmitMonitor.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * - */ -public class TaskResubmitMonitor extends OperationMonitor implements Serializable { - /** - * - */ - private static final long serialVersionUID = -1547897501452634298L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TaskResumeMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TaskResumeMonitor.java deleted file mode 100644 index 850586e..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TaskResumeMonitor.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * - */ -public class TaskResumeMonitor extends OperationMonitor implements Serializable { - /** - * - */ - private static final long serialVersionUID = -1547897501452634298L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TemplateApplyMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TemplateApplyMonitor.java deleted file mode 100644 index 0ec2601..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/TemplateApplyMonitor.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * Apply Template Monitor - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class TemplateApplyMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = 7429207202237589027L; - - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/UnionMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/UnionMonitor.java deleted file mode 100644 index afeab09..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/UnionMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.monitor; - -import java.io.Serializable; - - -/** - * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * - */ -public class UnionMonitor extends OperationMonitor implements Serializable { - - - private static final long serialVersionUID = -7694151843138161474L; - -} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/type/ChangeColumnTypeMonitor.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/type/ChangeColumnTypeMonitor.java deleted file mode 100644 index aff3856..0000000 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/column/type/ChangeColumnTypeMonitor.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * - */ -package org.gcube.portlets.user.td.gwtservice.shared.tr.column.type; - -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 ChangeColumnTypeMonitor implements Serializable { - - private static final long serialVersionUID = 5378053063599667767L; - - protected float progress; - protected State status; - protected String statusDescription; - protected Throwable error; - protected TRId trId; - protected String columnName; - - 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; - } - - public String getColumnName() { - return columnName; - } - - public void setColumnName(String columnName) { - this.columnName = columnName; - } - - @Override - public String toString() { - return "ChangeColumnTypeMonitor [progress=" + progress + ", status=" - + status + ", statusDescription=" + statusDescription - + ", error=" + error + ", trId=" + trId + ", columnName=" - + columnName + "]"; - } - - - -}