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 0bd9c7d..e7e74b9 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 @@ -52,6 +52,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession; +import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabMetadata; @@ -587,6 +589,26 @@ public interface TDGWTService extends RemoteService { 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 * 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 72e533b..f8f0020 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 @@ -51,6 +51,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession; +import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabMetadata; @@ -175,6 +177,9 @@ public interface TDGWTServiceAsync { void startChangeTableType(ChangeTableTypeSession changeTableTypeSession,AsyncCallback callback); //Rows Operation + void getEditRowMonitor(AsyncCallback callback); + void startEditRow(EditRowSession editRowSession,AsyncCallback callback); + void getDeleteRowsMonitor(AsyncCallback callback); void startDeleteRows(DeleteRowsSession deleteRowsSession,AsyncCallback callback); 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 new file mode 100644 index 0000000..a6a9f08 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/SessionConstants.java @@ -0,0 +1,81 @@ +package org.gcube.portlets.user.td.gwtservice.server; + +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 TR_TASK_MANAGER = "TR_TASK_MANAGER"; + + protected static final String SDMX_REGISTRY_SOURCE = "SDMX_REGISTRY_SOURCE"; + + protected static final String CLONE_TABULAR_RESOURCE_SESSION = "CLONE_TABULAR_RESOURCE_SESSION"; + + 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 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 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 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 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"; + +} 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 7479cd3..56a54b3 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 @@ -43,6 +43,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession; +import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Agencies; @@ -60,79 +62,7 @@ import org.slf4j.LoggerFactory; */ public class SessionUtil { - 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 TR_TASK_MANAGER = "TR_TASK_MANAGER"; - - protected static final String SDMX_REGISTRY_SOURCE = "SDMX_REGISTRY_SOURCE"; - - protected static final String CLONE_TABULAR_RESOURCE_SESSION = "CLONE_TABULAR_RESOURCE_SESSION"; - - 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 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 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 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 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 Logger logger = LoggerFactory.getLogger(SessionUtil.class); @@ -169,10 +99,10 @@ public class SessionUtil { public static void setTDOpenSession(HttpSession httpSession, TDOpenSession s) throws TDGWTSessionExpiredException { TDOpenSession session = (TDOpenSession) httpSession - .getAttribute(TDOPEN_SESSION); + .getAttribute(SessionConstants.TDOPEN_SESSION); if (session != null) - httpSession.removeAttribute(TDOPEN_SESSION); - httpSession.setAttribute(TDOPEN_SESSION, s); + httpSession.removeAttribute(SessionConstants.TDOPEN_SESSION); + httpSession.setAttribute(SessionConstants.TDOPEN_SESSION, s); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); @@ -191,16 +121,16 @@ public class SessionUtil { @SuppressWarnings("unchecked") List tabularResources = (List) httpSession - .getAttribute(TABULAR_RESOURCE_LIST); + .getAttribute(SessionConstants.TABULAR_RESOURCE_LIST); if (tabularResources != null) - httpSession.removeAttribute(TABULAR_RESOURCE_LIST); - httpSession.setAttribute(TABULAR_RESOURCE_LIST, trs); + httpSession.removeAttribute(SessionConstants.TABULAR_RESOURCE_LIST); + httpSession.setAttribute(SessionConstants.TABULAR_RESOURCE_LIST, trs); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } public static TRId getTRId(HttpSession httpSession) { - TRId id = (TRId) httpSession.getAttribute(CURRENT_TR_ID); + TRId id = (TRId) httpSession.getAttribute(SessionConstants.CURRENT_TR_ID); if (id == null) { logger.error("TR_ID was not acquired"); } @@ -208,17 +138,17 @@ public class SessionUtil { } public static void setTRId(HttpSession httpSession, TRId trId) throws TDGWTSessionExpiredException { - TRId id = (TRId) httpSession.getAttribute(CURRENT_TR_ID); + TRId id = (TRId) httpSession.getAttribute(SessionConstants.CURRENT_TR_ID); if (id != null) - httpSession.removeAttribute(CURRENT_TR_ID); - httpSession.setAttribute(CURRENT_TR_ID, trId); + httpSession.removeAttribute(SessionConstants.CURRENT_TR_ID); + httpSession.setAttribute(SessionConstants.CURRENT_TR_ID, trId); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } public static TabResource getTabResource(HttpSession httpSession) { TabResource tabResource = (TabResource) httpSession - .getAttribute(CURRENT_TABULAR_RESOURCE); + .getAttribute(SessionConstants.CURRENT_TABULAR_RESOURCE); if (tabResource == null) { logger.error("CURRENT_TABULAR_RESOURCE was not acquired"); } @@ -228,17 +158,17 @@ public class SessionUtil { public static void setTabResource(HttpSession httpSession, TabResource tabResource) throws TDGWTSessionExpiredException { TabResource t = (TabResource) httpSession - .getAttribute(CURRENT_TABULAR_RESOURCE); + .getAttribute(SessionConstants.CURRENT_TABULAR_RESOURCE); if (t != null) - httpSession.removeAttribute(CURRENT_TABULAR_RESOURCE); - httpSession.setAttribute(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()); } public static TabResource getSDMXImportTabResource(HttpSession httpSession) { TabResource tabResource = (TabResource) httpSession - .getAttribute(SDMX_IMPORT_TABULAR_RESOURCE); + .getAttribute(SessionConstants.SDMX_IMPORT_TABULAR_RESOURCE); if (tabResource == null) { logger.error("SDMX_IMPORT_TABULAR_RESOURCE was not acquired"); } @@ -248,10 +178,10 @@ public class SessionUtil { public static void setSDMXImportTabResource(HttpSession httpSession, TabResource tabResource) throws TDGWTSessionExpiredException { TabResource t = (TabResource) httpSession - .getAttribute(SDMX_IMPORT_TABULAR_RESOURCE); + .getAttribute(SessionConstants.SDMX_IMPORT_TABULAR_RESOURCE); if (t != null) - httpSession.removeAttribute(SDMX_IMPORT_TABULAR_RESOURCE); - httpSession.setAttribute(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()); } @@ -259,7 +189,7 @@ public class SessionUtil { // // public static TabResource getCSVImportTabResource(HttpSession httpSession) { TabResource tabResource = (TabResource) httpSession - .getAttribute(CSV_IMPORT_TABULAR_RESOURCE); + .getAttribute(SessionConstants.CSV_IMPORT_TABULAR_RESOURCE); if (tabResource == null) { logger.error("CSV_IMPORT_TABULAR_RESOURCE was not acquired"); } @@ -269,10 +199,10 @@ public class SessionUtil { public static void setCSVImportTabResource(HttpSession httpSession, TabResource tabResource) throws TDGWTSessionExpiredException { TabResource t = (TabResource) httpSession - .getAttribute(CSV_IMPORT_TABULAR_RESOURCE); + .getAttribute(SessionConstants.CSV_IMPORT_TABULAR_RESOURCE); if (t != null) - httpSession.removeAttribute(CSV_IMPORT_TABULAR_RESOURCE); - httpSession.setAttribute(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()); } @@ -283,17 +213,17 @@ public class SessionUtil { SDMXImportSession s) throws TDGWTSessionExpiredException { SDMXImportSession session = (SDMXImportSession) httpSession - .getAttribute(SDMX_IMPORT_SESSION); + .getAttribute(SessionConstants.SDMX_IMPORT_SESSION); if (session != null) - httpSession.removeAttribute(SDMX_IMPORT_SESSION); - httpSession.setAttribute(SDMX_IMPORT_SESSION, s); + httpSession.removeAttribute(SessionConstants.SDMX_IMPORT_SESSION); + httpSession.setAttribute(SessionConstants.SDMX_IMPORT_SESSION, s); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } public static SDMXImportSession getSDMXImportSession(HttpSession httpSession) { SDMXImportSession importSession = (SDMXImportSession) httpSession - .getAttribute(SDMX_IMPORT_SESSION); + .getAttribute(SessionConstants.SDMX_IMPORT_SESSION); if (importSession == null) { logger.error("SDMXImportSession was not acquired"); } @@ -304,17 +234,17 @@ public class SessionUtil { CSVImportSession s) throws TDGWTSessionExpiredException { CSVImportSession session = (CSVImportSession) httpSession - .getAttribute(CSV_IMPORT_SESSION); + .getAttribute(SessionConstants.CSV_IMPORT_SESSION); if (session != null) - httpSession.removeAttribute(CSV_IMPORT_SESSION); - httpSession.setAttribute(CSV_IMPORT_SESSION, s); + httpSession.removeAttribute(SessionConstants.CSV_IMPORT_SESSION); + httpSession.setAttribute(SessionConstants.CSV_IMPORT_SESSION, s); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } public static CSVImportSession getCSVImportSession(HttpSession httpSession) { CSVImportSession importSession = (CSVImportSession) httpSession - .getAttribute(CSV_IMPORT_SESSION); + .getAttribute(SessionConstants.CSV_IMPORT_SESSION); if (importSession == null) { logger.error("CSVImportSession was not acquired"); } @@ -325,17 +255,17 @@ public class SessionUtil { CSVExportSession s) throws TDGWTSessionExpiredException { CSVExportSession session = (CSVExportSession) httpSession - .getAttribute(CSV_EXPORT_SESSION); + .getAttribute(SessionConstants.CSV_EXPORT_SESSION); if (session != null) - httpSession.removeAttribute(CSV_EXPORT_SESSION); - httpSession.setAttribute(CSV_EXPORT_SESSION, s); + httpSession.removeAttribute(SessionConstants.CSV_EXPORT_SESSION); + httpSession.setAttribute(SessionConstants.CSV_EXPORT_SESSION, s); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } public static CSVExportSession getCSVExportSession(HttpSession httpSession) { CSVExportSession exportSession = (CSVExportSession) httpSession - .getAttribute(CSV_EXPORT_SESSION); + .getAttribute(SessionConstants.CSV_EXPORT_SESSION); if (exportSession == null) { logger.error("CSVExportSession was not acquired"); } @@ -346,17 +276,17 @@ public class SessionUtil { SDMXExportSession s) throws TDGWTSessionExpiredException { SDMXExportSession session = (SDMXExportSession) httpSession - .getAttribute(SDMX_EXPORT_SESSION); + .getAttribute(SessionConstants.SDMX_EXPORT_SESSION); if (session != null) - httpSession.removeAttribute(SDMX_EXPORT_SESSION); - httpSession.setAttribute(SDMX_EXPORT_SESSION, s); + httpSession.removeAttribute(SessionConstants.SDMX_EXPORT_SESSION); + httpSession.setAttribute(SessionConstants.SDMX_EXPORT_SESSION, s); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } public static SDMXExportSession getSDMXExportSession(HttpSession httpSession) { SDMXExportSession exportSession = (SDMXExportSession) httpSession - .getAttribute(SDMX_EXPORT_SESSION); + .getAttribute(SessionConstants.SDMX_EXPORT_SESSION); if (exportSession == null) { logger.error("SDMXExportSession was not acquired"); } @@ -367,17 +297,17 @@ public class SessionUtil { FileUploadSession s) throws TDGWTSessionExpiredException { FileUploadSession session = (FileUploadSession) httpSession - .getAttribute(CSV_IMPORT_FILE_UPLOAD_SESSION); + .getAttribute(SessionConstants.CSV_IMPORT_FILE_UPLOAD_SESSION); if (session != null) - httpSession.removeAttribute(CSV_IMPORT_FILE_UPLOAD_SESSION); - httpSession.setAttribute(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 FileUploadSession getFileUploadSession(HttpSession httpSession) { FileUploadSession fileUploadSession = (FileUploadSession) httpSession - .getAttribute(CSV_IMPORT_FILE_UPLOAD_SESSION); + .getAttribute(SessionConstants.CSV_IMPORT_FILE_UPLOAD_SESSION); if (fileUploadSession == null) { logger.error("FileUploadSession was not acquired"); } @@ -415,10 +345,10 @@ public class SessionUtil { SDMXRegistrySource sdmxRegistrySource) throws TDGWTSessionExpiredException { SDMXRegistrySource source = (SDMXRegistrySource) httpSession - .getAttribute(SDMX_REGISTRY_SOURCE); + .getAttribute(SessionConstants.SDMX_REGISTRY_SOURCE); if (source != null) - httpSession.removeAttribute(SDMX_REGISTRY_SOURCE); - httpSession.setAttribute(SDMX_REGISTRY_SOURCE, sdmxRegistrySource); + httpSession.removeAttribute(SessionConstants.SDMX_REGISTRY_SOURCE); + httpSession.setAttribute(SessionConstants.SDMX_REGISTRY_SOURCE, sdmxRegistrySource); ASLSession aslSession = getAslSession(httpSession); ScopeProvider.instance.set(aslSession.getScope().toString()); } @@ -426,7 +356,7 @@ public class SessionUtil { public static SDMXRegistrySource getSDMXRegistrySource( HttpSession httpSession) { SDMXRegistrySource sdmxRegistrySource = (SDMXRegistrySource) httpSession - .getAttribute(SDMX_REGISTRY_SOURCE); + .getAttribute(SessionConstants.SDMX_REGISTRY_SOURCE); if (sdmxRegistrySource == null) { logger.error("SDMXRegistrySource was not acquired"); } @@ -435,9 +365,9 @@ public class SessionUtil { public static SDMXClient getSdmxClient(HttpSession httpSession) { SDMXClient sdmxClient = (SDMXClient) httpSession - .getAttribute(SDMX_CLIENT_ATTRIBUTE); + .getAttribute(SessionConstants.SDMX_CLIENT_ATTRIBUTE); SDMXRegistrySource sdmxRegistrySource = (SDMXRegistrySource) httpSession - .getAttribute(SDMX_REGISTRY_SOURCE); + .getAttribute(SessionConstants.SDMX_REGISTRY_SOURCE); if (sdmxRegistrySource == null) { logger.error("SDMXRegistrySource was not acquired"); } else { @@ -463,7 +393,7 @@ public class SessionUtil { } } } - httpSession.setAttribute(SDMX_CLIENT_ATTRIBUTE, sdmxClient); + httpSession.setAttribute(SessionConstants.SDMX_CLIENT_ATTRIBUTE, sdmxClient); } @@ -471,7 +401,7 @@ public class SessionUtil { } public static Task getSDMXImportTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SDMX_IMPORT_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.SDMX_IMPORT_TASK); if (monitor == null) { logger.error("SDMX_IMPORT_TASK was not acquired"); } @@ -479,14 +409,14 @@ public class SessionUtil { } public static void setSDMXImportTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SDMX_IMPORT_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.SDMX_IMPORT_TASK); if (monitor != null) - httpSession.removeAttribute(SDMX_IMPORT_TASK); - httpSession.setAttribute(SDMX_IMPORT_TASK, task); + httpSession.removeAttribute(SessionConstants.SDMX_IMPORT_TASK); + httpSession.setAttribute(SessionConstants.SDMX_IMPORT_TASK, task); } public static Task getCSVImportFileTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(CSV_IMPORT_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.CSV_IMPORT_TASK); if (monitor == null) { logger.error("CSV_IMPORT_TASK was not acquired"); } @@ -494,14 +424,14 @@ public class SessionUtil { } public static void setCSVImportFileTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(CSV_IMPORT_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.CSV_IMPORT_TASK); if (monitor != null) - httpSession.removeAttribute(CSV_IMPORT_TASK); - httpSession.setAttribute(CSV_IMPORT_TASK, task); + httpSession.removeAttribute(SessionConstants.CSV_IMPORT_TASK); + httpSession.setAttribute(SessionConstants.CSV_IMPORT_TASK, task); } public static Task getCSVExportTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(CSV_EXPORT_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.CSV_EXPORT_TASK); if (monitor == null) { logger.error("CSV_EXPORT_TASK was not acquired"); } @@ -509,21 +439,21 @@ public class SessionUtil { } public static void setCSVExportTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(CSV_EXPORT_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.CSV_EXPORT_TASK); if (monitor != null) - httpSession.removeAttribute(CSV_EXPORT_TASK); - httpSession.setAttribute(CSV_EXPORT_TASK, task); + 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(CSV_EXPORT_END); + Boolean fin = (Boolean) httpSession.getAttribute(SessionConstants.CSV_EXPORT_END); if (fin != null) - httpSession.removeAttribute(CSV_EXPORT_END); - httpSession.setAttribute(CSV_EXPORT_END, end); + httpSession.removeAttribute(SessionConstants.CSV_EXPORT_END); + httpSession.setAttribute(SessionConstants.CSV_EXPORT_END, end); } public static Boolean getCSVExportEnd(HttpSession httpSession) { - Boolean end = (Boolean) httpSession.getAttribute(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"); @@ -533,7 +463,7 @@ public class SessionUtil { } public static Task getSDMXExportTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(SDMX_EXPORT_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.SDMX_EXPORT_TASK); if (monitor == null) { logger.error("SDMX_EXPORT_TASK was not acquired"); } @@ -541,20 +471,20 @@ public class SessionUtil { } public static void setSDMXExportTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(SDMX_EXPORT_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.SDMX_EXPORT_TASK); if (monitor != null) - httpSession.removeAttribute(SDMX_EXPORT_TASK); - httpSession.setAttribute(SDMX_EXPORT_TASK, task); + httpSession.removeAttribute(SessionConstants.SDMX_EXPORT_TASK); + httpSession.setAttribute(SessionConstants.SDMX_EXPORT_TASK, task); } public static TRTasksManager getTRTasksManager(HttpSession httpSession) { TRTasksManager tasksManager = (TRTasksManager) httpSession - .getAttribute(TR_TASK_MANAGER); + .getAttribute(SessionConstants.TR_TASK_MANAGER); if (tasksManager != null) { return tasksManager; } else { tasksManager = new TRTasksManager(); - httpSession.setAttribute(TR_TASK_MANAGER, tasksManager); + httpSession.setAttribute(SessionConstants.TR_TASK_MANAGER, tasksManager); return tasksManager; } } @@ -562,11 +492,11 @@ public class SessionUtil { public static void setTRTasksManager(HttpSession httpSession, TRTasksManager trTasksManager) { TRTasksManager tm = (TRTasksManager) httpSession - .getAttribute(TR_TASK_MANAGER); + .getAttribute(SessionConstants.TR_TASK_MANAGER); if (tm != null) { - httpSession.removeAttribute(TR_TASK_MANAGER); + httpSession.removeAttribute(SessionConstants.TR_TASK_MANAGER); } - httpSession.setAttribute(TR_TASK_MANAGER, trTasksManager); + httpSession.setAttribute(SessionConstants.TR_TASK_MANAGER, trTasksManager); } @@ -574,12 +504,12 @@ public class SessionUtil { public static ChangeColumnTypeSession getChangeColumnTypeSession( HttpSession httpSession) { ChangeColumnTypeSession changeColumnTypeSession = (ChangeColumnTypeSession) httpSession - .getAttribute(CHANGE_COLUMN_TYPE_SESSION); + .getAttribute(SessionConstants.CHANGE_COLUMN_TYPE_SESSION); if (changeColumnTypeSession != null) { return changeColumnTypeSession; } else { changeColumnTypeSession = new ChangeColumnTypeSession(); - httpSession.setAttribute(CHANGE_COLUMN_TYPE_SESSION, + httpSession.setAttribute(SessionConstants.CHANGE_COLUMN_TYPE_SESSION, changeColumnTypeSession); return changeColumnTypeSession; } @@ -588,11 +518,11 @@ public class SessionUtil { public static void setChangeColumnTypeSession(HttpSession httpSession, ChangeColumnTypeSession changeColumnTypeSession) { ChangeColumnTypeSession ct = (ChangeColumnTypeSession) httpSession - .getAttribute(CHANGE_COLUMN_TYPE_SESSION); + .getAttribute(SessionConstants.CHANGE_COLUMN_TYPE_SESSION); if (ct != null) { - httpSession.removeAttribute(CHANGE_COLUMN_TYPE_SESSION); + httpSession.removeAttribute(SessionConstants.CHANGE_COLUMN_TYPE_SESSION); } - httpSession.setAttribute(CHANGE_COLUMN_TYPE_SESSION, + httpSession.setAttribute(SessionConstants.CHANGE_COLUMN_TYPE_SESSION, changeColumnTypeSession); } @@ -600,12 +530,12 @@ public class SessionUtil { public static ChangeColumnTypeMonitor getChangeColumnTypeMonitor( HttpSession httpSession) { ChangeColumnTypeMonitor changeColumnTypeMonitor = (ChangeColumnTypeMonitor) httpSession - .getAttribute(CHANGE_COLUMN_TYPE_MONITOR); + .getAttribute(SessionConstants.CHANGE_COLUMN_TYPE_MONITOR); if (changeColumnTypeMonitor != null) { return changeColumnTypeMonitor; } else { changeColumnTypeMonitor = new ChangeColumnTypeMonitor(); - httpSession.setAttribute(CHANGE_COLUMN_TYPE_MONITOR, + httpSession.setAttribute(SessionConstants.CHANGE_COLUMN_TYPE_MONITOR, changeColumnTypeMonitor); return changeColumnTypeMonitor; } @@ -614,17 +544,17 @@ public class SessionUtil { public static void setChangeColumnTypeMonitor(HttpSession httpSession, ChangeColumnTypeMonitor changeColumnTypeMonitor) { ChangeColumnTypeMonitor cm = (ChangeColumnTypeMonitor) httpSession - .getAttribute(CHANGE_COLUMN_TYPE_MONITOR); + .getAttribute(SessionConstants.CHANGE_COLUMN_TYPE_MONITOR); if (cm != null) { - httpSession.removeAttribute(CHANGE_COLUMN_TYPE_MONITOR); + httpSession.removeAttribute(SessionConstants.CHANGE_COLUMN_TYPE_MONITOR); } - httpSession.setAttribute(CHANGE_COLUMN_TYPE_MONITOR, + httpSession.setAttribute(SessionConstants.CHANGE_COLUMN_TYPE_MONITOR, changeColumnTypeMonitor); } public static Task getChangeColumnTypeTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(CHANGE_COLUMN_TYPE_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.CHANGE_COLUMN_TYPE_TASK); if (monitor == null) { logger.error("CHANGE_COLUMN_TYPE_TASK was not acquired"); } @@ -633,10 +563,10 @@ public class SessionUtil { public static void setChangeColumnTypeTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(CHANGE_COLUMN_TYPE_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.CHANGE_COLUMN_TYPE_TASK); if (monitor != null) - httpSession.removeAttribute(CHANGE_COLUMN_TYPE_TASK); - httpSession.setAttribute(CHANGE_COLUMN_TYPE_TASK, task); + httpSession.removeAttribute(SessionConstants.CHANGE_COLUMN_TYPE_TASK); + httpSession.setAttribute(SessionConstants.CHANGE_COLUMN_TYPE_TASK, task); } // / @@ -644,12 +574,12 @@ public class SessionUtil { public static LabelColumnSession getLabelColumnSession( HttpSession httpSession) { LabelColumnSession labelColumnSession = (LabelColumnSession) httpSession - .getAttribute(CHANGE_THE_COLUMN_LABEL_SESSION); + .getAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION); if (labelColumnSession != null) { return labelColumnSession; } else { labelColumnSession = new LabelColumnSession(); - httpSession.setAttribute(CHANGE_THE_COLUMN_LABEL_SESSION, + httpSession.setAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION, labelColumnSession); return labelColumnSession; } @@ -658,11 +588,11 @@ public class SessionUtil { public static void setLabelColumnSession(HttpSession httpSession, LabelColumnSession labelColumnSession) { LabelColumnSession lc = (LabelColumnSession) httpSession - .getAttribute(CHANGE_THE_COLUMN_LABEL_SESSION); + .getAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION); if (lc != null) { - httpSession.removeAttribute(CHANGE_THE_COLUMN_LABEL_SESSION); + httpSession.removeAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION); } - httpSession.setAttribute(CHANGE_THE_COLUMN_LABEL_SESSION, + httpSession.setAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_SESSION, labelColumnSession); } @@ -670,12 +600,12 @@ public class SessionUtil { public static LabelColumnMonitor getLabelColumnMonitor( HttpSession httpSession) { LabelColumnMonitor labelColumnMonitor = (LabelColumnMonitor) httpSession - .getAttribute(CHANGE_THE_COLUMN_LABEL_MONITOR); + .getAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_MONITOR); if (labelColumnMonitor != null) { return labelColumnMonitor; } else { labelColumnMonitor = new LabelColumnMonitor(); - httpSession.setAttribute(CHANGE_THE_COLUMN_LABEL_MONITOR, + httpSession.setAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_MONITOR, labelColumnMonitor); return labelColumnMonitor; } @@ -684,18 +614,18 @@ public class SessionUtil { public static void setLabelColumnMonitor(HttpSession httpSession, LabelColumnMonitor labelColumnMonitor) { LabelColumnMonitor lc = (LabelColumnMonitor) httpSession - .getAttribute(CHANGE_THE_COLUMN_LABEL_MONITOR); + .getAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_MONITOR); if (lc != null) { - httpSession.removeAttribute(CHANGE_THE_COLUMN_LABEL_MONITOR); + httpSession.removeAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_MONITOR); } - httpSession.setAttribute(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(CHANGE_THE_COLUMN_LABEL_TASK); + .getAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_TASK); if (monitor == null) { logger.error("CHANGE_THE_COLUMN_LABEL_TASK was not acquired"); } @@ -704,10 +634,10 @@ public class SessionUtil { public static void setLabelColumnTask(HttpSession httpSession, Task task) { Task monitor = (Task) httpSession - .getAttribute(CHANGE_THE_COLUMN_LABEL_TASK); + .getAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_TASK); if (monitor != null) - httpSession.removeAttribute(CHANGE_THE_COLUMN_LABEL_TASK); - httpSession.setAttribute(CHANGE_THE_COLUMN_LABEL_TASK, task); + httpSession.removeAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_TASK); + httpSession.setAttribute(SessionConstants.CHANGE_THE_COLUMN_LABEL_TASK, task); } // @@ -715,13 +645,13 @@ public class SessionUtil { public static DeleteColumnSession getDeleteColumnSession( HttpSession httpSession) { DeleteColumnSession deleteColumnSession = (DeleteColumnSession) httpSession - .getAttribute(DELETE_COLUMN_SESSION); + .getAttribute(SessionConstants.DELETE_COLUMN_SESSION); if (deleteColumnSession != null) { return deleteColumnSession; } else { deleteColumnSession = new DeleteColumnSession(); httpSession - .setAttribute(DELETE_COLUMN_SESSION, deleteColumnSession); + .setAttribute(SessionConstants.DELETE_COLUMN_SESSION, deleteColumnSession); return deleteColumnSession; } } @@ -729,24 +659,24 @@ public class SessionUtil { public static void setDeleteColumnSession(HttpSession httpSession, DeleteColumnSession deleteColumnSession) { DeleteColumnSession dc = (DeleteColumnSession) httpSession - .getAttribute(DELETE_COLUMN_SESSION); + .getAttribute(SessionConstants.DELETE_COLUMN_SESSION); if (dc != null) { - httpSession.removeAttribute(DELETE_COLUMN_SESSION); + httpSession.removeAttribute(SessionConstants.DELETE_COLUMN_SESSION); } - httpSession.setAttribute(DELETE_COLUMN_SESSION, deleteColumnSession); + httpSession.setAttribute(SessionConstants.DELETE_COLUMN_SESSION, deleteColumnSession); } public static DeleteColumnMonitor getDeleteColumnMonitor( HttpSession httpSession) { DeleteColumnMonitor deleteColumnMonitor = (DeleteColumnMonitor) httpSession - .getAttribute(DELETE_COLUMN_MONITOR); + .getAttribute(SessionConstants.DELETE_COLUMN_MONITOR); if (deleteColumnMonitor != null) { return deleteColumnMonitor; } else { deleteColumnMonitor = new DeleteColumnMonitor(); httpSession - .setAttribute(DELETE_COLUMN_MONITOR, deleteColumnMonitor); + .setAttribute(SessionConstants.DELETE_COLUMN_MONITOR, deleteColumnMonitor); return deleteColumnMonitor; } } @@ -754,16 +684,16 @@ public class SessionUtil { public static void setDeleteColumnMonitor(HttpSession httpSession, DeleteColumnMonitor deleteColumnMonitor) { DeleteColumnMonitor cm = (DeleteColumnMonitor) httpSession - .getAttribute(DELETE_COLUMN_MONITOR); + .getAttribute(SessionConstants.DELETE_COLUMN_MONITOR); if (cm != null) { - httpSession.removeAttribute(DELETE_COLUMN_MONITOR); + httpSession.removeAttribute(SessionConstants.DELETE_COLUMN_MONITOR); } - httpSession.setAttribute(DELETE_COLUMN_MONITOR, deleteColumnMonitor); + httpSession.setAttribute(SessionConstants.DELETE_COLUMN_MONITOR, deleteColumnMonitor); } public static Task getDeleteColumnTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(DELETE_COLUMN_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.DELETE_COLUMN_TASK); if (monitor == null) { logger.error("DELETE_COLUMN_TASK was not acquired"); } @@ -771,23 +701,90 @@ public class SessionUtil { } public static void setDeleteColumnTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(DELETE_COLUMN_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.DELETE_COLUMN_TASK); if (monitor != null) - httpSession.removeAttribute(DELETE_COLUMN_TASK); - httpSession.setAttribute(DELETE_COLUMN_TASK, task); + httpSession.removeAttribute(SessionConstants.DELETE_COLUMN_TASK); + httpSession.setAttribute(SessionConstants.DELETE_COLUMN_TASK, task); + } + + // + public static EditRowSession getEditRowSession( + HttpSession httpSession) { + EditRowSession editRowSession = (EditRowSession) httpSession + .getAttribute(SessionConstants.EDIT_ROW_SESSION); + if (editRowSession != null) { + return editRowSession; + } else { + editRowSession = new EditRowSession(); + httpSession.setAttribute(SessionConstants.EDIT_ROW_SESSION, + editRowSession); + return editRowSession; + } } + public static void setEditRowSession(HttpSession httpSession, + EditRowSession editRowSession) { + EditRowSession er = (EditRowSession) httpSession + .getAttribute(SessionConstants.EDIT_ROW_SESSION); + if (er != null) { + httpSession.removeAttribute(SessionConstants.EDIT_ROW_SESSION); + } + 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( HttpSession httpSession) { ReplaceColumnSession replaceColumnSession = (ReplaceColumnSession) httpSession - .getAttribute(REPLACE_COLUMN_SESSION); + .getAttribute(SessionConstants.REPLACE_COLUMN_SESSION); if (replaceColumnSession != null) { return replaceColumnSession; } else { replaceColumnSession = new ReplaceColumnSession(); - httpSession.setAttribute(REPLACE_COLUMN_SESSION, + httpSession.setAttribute(SessionConstants.REPLACE_COLUMN_SESSION, replaceColumnSession); return replaceColumnSession; } @@ -796,23 +793,23 @@ public class SessionUtil { public static void setReplaceColumnSession(HttpSession httpSession, ReplaceColumnSession replaceColumnSession) { ReplaceColumnSession rc = (ReplaceColumnSession) httpSession - .getAttribute(REPLACE_COLUMN_SESSION); + .getAttribute(SessionConstants.REPLACE_COLUMN_SESSION); if (rc != null) { - httpSession.removeAttribute(REPLACE_COLUMN_SESSION); + httpSession.removeAttribute(SessionConstants.REPLACE_COLUMN_SESSION); } - httpSession.setAttribute(REPLACE_COLUMN_SESSION, replaceColumnSession); + httpSession.setAttribute(SessionConstants.REPLACE_COLUMN_SESSION, replaceColumnSession); } public static ReplaceColumnMonitor getReplaceColumnMonitor( HttpSession httpSession) { ReplaceColumnMonitor replaceColumnMonitor = (ReplaceColumnMonitor) httpSession - .getAttribute(REPLACE_COLUMN_MONITOR); + .getAttribute(SessionConstants.REPLACE_COLUMN_MONITOR); if (replaceColumnMonitor != null) { return replaceColumnMonitor; } else { replaceColumnMonitor = new ReplaceColumnMonitor(); - httpSession.setAttribute(REPLACE_COLUMN_MONITOR, + httpSession.setAttribute(SessionConstants.REPLACE_COLUMN_MONITOR, replaceColumnMonitor); return replaceColumnMonitor; } @@ -821,16 +818,16 @@ public class SessionUtil { public static void setReplaceColumnMonitor(HttpSession httpSession, ReplaceColumnMonitor replaceColumnMonitor) { ReplaceColumnMonitor rc = (ReplaceColumnMonitor) httpSession - .getAttribute(REPLACE_COLUMN_MONITOR); + .getAttribute(SessionConstants.REPLACE_COLUMN_MONITOR); if (rc != null) { - httpSession.removeAttribute(REPLACE_COLUMN_MONITOR); + httpSession.removeAttribute(SessionConstants.REPLACE_COLUMN_MONITOR); } - httpSession.setAttribute(REPLACE_COLUMN_MONITOR, replaceColumnMonitor); + httpSession.setAttribute(SessionConstants.REPLACE_COLUMN_MONITOR, replaceColumnMonitor); } public static Task getReplaceColumnTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(REPLACE_COLUMN_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.REPLACE_COLUMN_TASK); if (monitor == null) { logger.error("REPLACE_COLUMN_TASK was not acquired"); } @@ -838,10 +835,10 @@ public class SessionUtil { } public static void setReplaceColumnTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(REPLACE_COLUMN_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.REPLACE_COLUMN_TASK); if (monitor != null) - httpSession.removeAttribute(REPLACE_COLUMN_TASK); - httpSession.setAttribute(REPLACE_COLUMN_TASK, task); + httpSession.removeAttribute(SessionConstants.REPLACE_COLUMN_TASK); + httpSession.setAttribute(SessionConstants.REPLACE_COLUMN_TASK, task); } @@ -849,12 +846,12 @@ public class SessionUtil { public static ReplaceBatchColumnSession getReplaceBatchColumnSession( HttpSession httpSession) { ReplaceBatchColumnSession replaceBatchColumnSession = (ReplaceBatchColumnSession) httpSession - .getAttribute(REPLACE_BATCH_COLUMN_SESSION); + .getAttribute(SessionConstants.REPLACE_BATCH_COLUMN_SESSION); if (replaceBatchColumnSession != null) { return replaceBatchColumnSession; } else { replaceBatchColumnSession = new ReplaceBatchColumnSession(); - httpSession.setAttribute(REPLACE_BATCH_COLUMN_SESSION, + httpSession.setAttribute(SessionConstants.REPLACE_BATCH_COLUMN_SESSION, replaceBatchColumnSession); return replaceBatchColumnSession; } @@ -863,23 +860,23 @@ public class SessionUtil { public static void setReplaceBatchColumnSession(HttpSession httpSession, ReplaceBatchColumnSession replaceBatchColumnSession) { ReplaceBatchColumnSession rbc = (ReplaceBatchColumnSession) httpSession - .getAttribute(REPLACE_BATCH_COLUMN_SESSION); + .getAttribute(SessionConstants.REPLACE_BATCH_COLUMN_SESSION); if (rbc != null) { - httpSession.removeAttribute(REPLACE_BATCH_COLUMN_SESSION); + httpSession.removeAttribute(SessionConstants.REPLACE_BATCH_COLUMN_SESSION); } - httpSession.setAttribute(REPLACE_BATCH_COLUMN_SESSION, replaceBatchColumnSession); + httpSession.setAttribute(SessionConstants.REPLACE_BATCH_COLUMN_SESSION, replaceBatchColumnSession); } public static ReplaceBatchColumnMonitor getReplaceBatchColumnMonitor( HttpSession httpSession) { ReplaceBatchColumnMonitor replaceBatchColumnMonitor = (ReplaceBatchColumnMonitor) httpSession - .getAttribute(REPLACE_BATCH_COLUMN_MONITOR); + .getAttribute(SessionConstants.REPLACE_BATCH_COLUMN_MONITOR); if (replaceBatchColumnMonitor != null) { return replaceBatchColumnMonitor; } else { replaceBatchColumnMonitor = new ReplaceBatchColumnMonitor(); - httpSession.setAttribute(REPLACE_BATCH_COLUMN_MONITOR, + httpSession.setAttribute(SessionConstants.REPLACE_BATCH_COLUMN_MONITOR, replaceBatchColumnMonitor); return replaceBatchColumnMonitor; } @@ -888,16 +885,16 @@ public class SessionUtil { public static void setReplaceBatchColumnMonitor(HttpSession httpSession, ReplaceBatchColumnMonitor replaceBatchColumnMonitor) { ReplaceBatchColumnMonitor rbc = (ReplaceBatchColumnMonitor) httpSession - .getAttribute(REPLACE_BATCH_COLUMN_MONITOR); + .getAttribute(SessionConstants.REPLACE_BATCH_COLUMN_MONITOR); if (rbc != null) { - httpSession.removeAttribute(REPLACE_BATCH_COLUMN_MONITOR); + httpSession.removeAttribute(SessionConstants.REPLACE_BATCH_COLUMN_MONITOR); } - httpSession.setAttribute(REPLACE_BATCH_COLUMN_MONITOR, replaceBatchColumnMonitor); + httpSession.setAttribute(SessionConstants.REPLACE_BATCH_COLUMN_MONITOR, replaceBatchColumnMonitor); } public static Task getReplaceBatchColumnTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(REPLACE_BATCH_COLUMN_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.REPLACE_BATCH_COLUMN_TASK); if (monitor == null) { logger.error("REPLACE_BATCH_COLUMN_TASK was not acquired"); } @@ -905,10 +902,10 @@ public class SessionUtil { } public static void setReplaceBatchColumnTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(REPLACE_BATCH_COLUMN_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.REPLACE_BATCH_COLUMN_TASK); if (monitor != null) - httpSession.removeAttribute(REPLACE_BATCH_COLUMN_TASK); - httpSession.setAttribute(REPLACE_BATCH_COLUMN_TASK, task); + httpSession.removeAttribute(SessionConstants.REPLACE_BATCH_COLUMN_TASK); + httpSession.setAttribute(SessionConstants.REPLACE_BATCH_COLUMN_TASK, task); } @@ -917,12 +914,12 @@ public class SessionUtil { public static ChangeTableTypeSession getChangeTableTypeSession( HttpSession httpSession) { ChangeTableTypeSession changeTableTypeSession = (ChangeTableTypeSession) httpSession - .getAttribute(CHANGE_TABLE_TYPE_SESSION); + .getAttribute(SessionConstants.CHANGE_TABLE_TYPE_SESSION); if (changeTableTypeSession != null) { return changeTableTypeSession; } else { changeTableTypeSession = new ChangeTableTypeSession(); - httpSession.setAttribute(CHANGE_TABLE_TYPE_SESSION, + httpSession.setAttribute(SessionConstants.CHANGE_TABLE_TYPE_SESSION, changeTableTypeSession); return changeTableTypeSession; } @@ -931,11 +928,11 @@ public class SessionUtil { public static void setChangeTableTypeSession(HttpSession httpSession, ChangeTableTypeSession changeTableTypeSession) { ChangeTableTypeSession ctts = (ChangeTableTypeSession) httpSession - .getAttribute(CHANGE_TABLE_TYPE_SESSION); + .getAttribute(SessionConstants.CHANGE_TABLE_TYPE_SESSION); if (ctts != null) { - httpSession.removeAttribute(CHANGE_TABLE_TYPE_SESSION); + httpSession.removeAttribute(SessionConstants.CHANGE_TABLE_TYPE_SESSION); } - httpSession.setAttribute(CHANGE_TABLE_TYPE_SESSION, + httpSession.setAttribute(SessionConstants.CHANGE_TABLE_TYPE_SESSION, changeTableTypeSession); } @@ -943,12 +940,12 @@ public class SessionUtil { public static ChangeTableTypeMonitor getChangeTableTypeMonitor( HttpSession httpSession) { ChangeTableTypeMonitor changeTableTypeMonitor = (ChangeTableTypeMonitor) httpSession - .getAttribute(CHANGE_TABLE_TYPE_MONITOR); + .getAttribute(SessionConstants.CHANGE_TABLE_TYPE_MONITOR); if (changeTableTypeMonitor != null) { return changeTableTypeMonitor; } else { changeTableTypeMonitor = new ChangeTableTypeMonitor(); - httpSession.setAttribute(CHANGE_TABLE_TYPE_MONITOR, + httpSession.setAttribute(SessionConstants.CHANGE_TABLE_TYPE_MONITOR, changeTableTypeMonitor); return changeTableTypeMonitor; } @@ -957,17 +954,17 @@ public class SessionUtil { public static void setChangeTableTypeMonitor(HttpSession httpSession, ChangeTableTypeMonitor changeTableTypeMonitor) { ChangeTableTypeMonitor ctt = (ChangeTableTypeMonitor) httpSession - .getAttribute(CHANGE_TABLE_TYPE_MONITOR); + .getAttribute(SessionConstants.CHANGE_TABLE_TYPE_MONITOR); if (ctt != null) { - httpSession.removeAttribute(CHANGE_TABLE_TYPE_MONITOR); + httpSession.removeAttribute(SessionConstants.CHANGE_TABLE_TYPE_MONITOR); } - httpSession.setAttribute(CHANGE_TABLE_TYPE_MONITOR, + httpSession.setAttribute(SessionConstants.CHANGE_TABLE_TYPE_MONITOR, changeTableTypeMonitor); } public static Task getChangeTableTypeTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(CHANGE_TABLE_TYPE_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.CHANGE_TABLE_TYPE_TASK); if (monitor == null) { logger.error("CHANGE_TABLE_TYPE_TASK was not acquired"); } @@ -975,10 +972,10 @@ public class SessionUtil { } public static void setChangeTableTypeTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(CHANGE_TABLE_TYPE_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.CHANGE_TABLE_TYPE_TASK); if (monitor != null) - httpSession.removeAttribute(CHANGE_TABLE_TYPE_TASK); - httpSession.setAttribute(CHANGE_TABLE_TYPE_TASK, task); + httpSession.removeAttribute(SessionConstants.CHANGE_TABLE_TYPE_TASK); + httpSession.setAttribute(SessionConstants.CHANGE_TABLE_TYPE_TASK, task); } // / @@ -986,12 +983,12 @@ public class SessionUtil { public static CloneTabularResourceSession getCloneTabularResourceSession( HttpSession httpSession) { CloneTabularResourceSession cloneTabularResourceSession = (CloneTabularResourceSession) httpSession - .getAttribute(CLONE_TABULAR_RESOURCE_SESSION); + .getAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_SESSION); if (cloneTabularResourceSession != null) { return cloneTabularResourceSession; } else { cloneTabularResourceSession = new CloneTabularResourceSession(); - httpSession.setAttribute(CLONE_TABULAR_RESOURCE_SESSION, + httpSession.setAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_SESSION, cloneTabularResourceSession); return cloneTabularResourceSession; } @@ -1000,11 +997,11 @@ public class SessionUtil { public static void setCloneTabularResourceSession(HttpSession httpSession, CloneTabularResourceSession cloneTabularResourceSession) { CloneTabularResourceSession c = (CloneTabularResourceSession) httpSession - .getAttribute(CLONE_TABULAR_RESOURCE_SESSION); + .getAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_SESSION); if (c != null) { - httpSession.removeAttribute(CLONE_TABULAR_RESOURCE_SESSION); + httpSession.removeAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_SESSION); } - httpSession.setAttribute(CLONE_TABULAR_RESOURCE_SESSION, + httpSession.setAttribute(SessionConstants.CLONE_TABULAR_RESOURCE_SESSION, cloneTabularResourceSession); } @@ -1013,12 +1010,12 @@ public class SessionUtil { public static DeleteRowsSession getDeleteRowsSession(HttpSession httpSession) { DeleteRowsSession deleteRowsSession = (DeleteRowsSession) httpSession - .getAttribute(DELETE_ROWS_SESSION); + .getAttribute(SessionConstants.DELETE_ROWS_SESSION); if (deleteRowsSession != null) { return deleteRowsSession; } else { deleteRowsSession = new DeleteRowsSession(); - httpSession.setAttribute(DELETE_ROWS_SESSION, deleteRowsSession); + httpSession.setAttribute(SessionConstants.DELETE_ROWS_SESSION, deleteRowsSession); return deleteRowsSession; } } @@ -1026,22 +1023,22 @@ public class SessionUtil { public static void setDeleteRowsSession(HttpSession httpSession, DeleteRowsSession deleteRowsSession) { DeleteRowsSession dr = (DeleteRowsSession) httpSession - .getAttribute(DELETE_ROWS_SESSION); + .getAttribute(SessionConstants.DELETE_ROWS_SESSION); if (dr != null) { - httpSession.removeAttribute(DELETE_ROWS_SESSION); + httpSession.removeAttribute(SessionConstants.DELETE_ROWS_SESSION); } - httpSession.setAttribute(DELETE_ROWS_SESSION, deleteRowsSession); + httpSession.setAttribute(SessionConstants.DELETE_ROWS_SESSION, deleteRowsSession); } public static DeleteRowsMonitor getDeleteRowsMonitor(HttpSession httpSession) { DeleteRowsMonitor deleteRowsMonitor = (DeleteRowsMonitor) httpSession - .getAttribute(DELETE_ROWS_MONITOR); + .getAttribute(SessionConstants.DELETE_ROWS_MONITOR); if (deleteRowsMonitor != null) { return deleteRowsMonitor; } else { deleteRowsMonitor = new DeleteRowsMonitor(); - httpSession.setAttribute(DELETE_ROWS_MONITOR, deleteRowsMonitor); + httpSession.setAttribute(SessionConstants.DELETE_ROWS_MONITOR, deleteRowsMonitor); return deleteRowsMonitor; } } @@ -1049,16 +1046,16 @@ public class SessionUtil { public static void setDeleteRowsMonitor(HttpSession httpSession, DeleteRowsMonitor deleteRowsMonitor) { DeleteRowsMonitor ctt = (DeleteRowsMonitor) httpSession - .getAttribute(DELETE_ROWS_MONITOR); + .getAttribute(SessionConstants.DELETE_ROWS_MONITOR); if (ctt != null) { - httpSession.removeAttribute(DELETE_ROWS_MONITOR); + httpSession.removeAttribute(SessionConstants.DELETE_ROWS_MONITOR); } - httpSession.setAttribute(DELETE_ROWS_MONITOR, deleteRowsMonitor); + httpSession.setAttribute(SessionConstants.DELETE_ROWS_MONITOR, deleteRowsMonitor); } public static Task getDeleteRowsTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(DELETE_ROWS_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.DELETE_ROWS_TASK); if (monitor == null) { logger.error("DELETE_ROWS_TASK was not acquired"); } @@ -1066,10 +1063,10 @@ public class SessionUtil { } public static void setDeleteRowsTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(DELETE_ROWS_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.DELETE_ROWS_TASK); if (monitor != null) - httpSession.removeAttribute(DELETE_ROWS_TASK); - httpSession.setAttribute(DELETE_ROWS_TASK, task); + httpSession.removeAttribute(SessionConstants.DELETE_ROWS_TASK); + httpSession.setAttribute(SessionConstants.DELETE_ROWS_TASK, task); } // @@ -1077,12 +1074,12 @@ public class SessionUtil { public static TemplateApplySession getTemplateApplySession( HttpSession httpSession) { TemplateApplySession templateApplySession = (TemplateApplySession) httpSession - .getAttribute(TEMPLATE_APPLY_SESSION); + .getAttribute(SessionConstants.TEMPLATE_APPLY_SESSION); if (templateApplySession != null) { return templateApplySession; } else { templateApplySession = new TemplateApplySession(); - httpSession.setAttribute(TEMPLATE_APPLY_SESSION, + httpSession.setAttribute(SessionConstants.TEMPLATE_APPLY_SESSION, templateApplySession); return templateApplySession; } @@ -1091,23 +1088,23 @@ public class SessionUtil { public static void setTemplateApplySession(HttpSession httpSession, TemplateApplySession templateApplySession) { TemplateApplySession dr = (TemplateApplySession) httpSession - .getAttribute(TEMPLATE_APPLY_SESSION); + .getAttribute(SessionConstants.TEMPLATE_APPLY_SESSION); if (dr != null) { - httpSession.removeAttribute(TEMPLATE_APPLY_SESSION); + httpSession.removeAttribute(SessionConstants.TEMPLATE_APPLY_SESSION); } - httpSession.setAttribute(TEMPLATE_APPLY_SESSION, templateApplySession); + httpSession.setAttribute(SessionConstants.TEMPLATE_APPLY_SESSION, templateApplySession); } public static TemplateApplyMonitor getTemplateApplyMonitor( HttpSession httpSession) { TemplateApplyMonitor templateApplyMonitor = (TemplateApplyMonitor) httpSession - .getAttribute(TEMPLATE_APPLY_MONITOR); + .getAttribute(SessionConstants.TEMPLATE_APPLY_MONITOR); if (templateApplyMonitor != null) { return templateApplyMonitor; } else { templateApplyMonitor = new TemplateApplyMonitor(); - httpSession.setAttribute(TEMPLATE_APPLY_MONITOR, + httpSession.setAttribute(SessionConstants.TEMPLATE_APPLY_MONITOR, templateApplyMonitor); return templateApplyMonitor; } @@ -1116,16 +1113,16 @@ public class SessionUtil { public static void setTemplateApplyMonitor(HttpSession httpSession, TemplateApplyMonitor templateApplyMonitor) { TemplateApplyMonitor d = (TemplateApplyMonitor) httpSession - .getAttribute(TEMPLATE_APPLY_MONITOR); + .getAttribute(SessionConstants.TEMPLATE_APPLY_MONITOR); if (d != null) { - httpSession.removeAttribute(TEMPLATE_APPLY_MONITOR); + httpSession.removeAttribute(SessionConstants.TEMPLATE_APPLY_MONITOR); } - httpSession.setAttribute(TEMPLATE_APPLY_MONITOR, templateApplyMonitor); + httpSession.setAttribute(SessionConstants.TEMPLATE_APPLY_MONITOR, templateApplyMonitor); } public static Task getTemplateApplyTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(TEMPLATE_APPLY_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.TEMPLATE_APPLY_TASK); if (monitor == null) { logger.error("TEMPLATE_APPLY_TASK was not acquired"); } @@ -1133,23 +1130,23 @@ public class SessionUtil { } public static void setTemplateApplyTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(TEMPLATE_APPLY_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.TEMPLATE_APPLY_TASK); if (monitor != null) - httpSession.removeAttribute(TEMPLATE_APPLY_TASK); - httpSession.setAttribute(TEMPLATE_APPLY_TASK, task); + httpSession.removeAttribute(SessionConstants.TEMPLATE_APPLY_TASK); + httpSession.setAttribute(SessionConstants.TEMPLATE_APPLY_TASK, task); } // public static DuplicatesSession getDuplicatesSession(HttpSession httpSession) { DuplicatesSession duplicatesSession = (DuplicatesSession) httpSession - .getAttribute(DUPLICATES_ROWS_SESSION); + .getAttribute(SessionConstants.DUPLICATES_ROWS_SESSION); if (duplicatesSession != null) { return duplicatesSession; } else { duplicatesSession = new DuplicatesSession(); httpSession - .setAttribute(DUPLICATES_ROWS_SESSION, duplicatesSession); + .setAttribute(SessionConstants.DUPLICATES_ROWS_SESSION, duplicatesSession); return duplicatesSession; } } @@ -1157,23 +1154,23 @@ public class SessionUtil { public static void setDuplicatesSession(HttpSession httpSession, DuplicatesSession duplicatesSession) { DuplicatesSession dr = (DuplicatesSession) httpSession - .getAttribute(DUPLICATES_ROWS_SESSION); + .getAttribute(SessionConstants.DUPLICATES_ROWS_SESSION); if (dr != null) { - httpSession.removeAttribute(DUPLICATES_ROWS_SESSION); + httpSession.removeAttribute(SessionConstants.DUPLICATES_ROWS_SESSION); } - httpSession.setAttribute(DUPLICATES_ROWS_SESSION, duplicatesSession); + httpSession.setAttribute(SessionConstants.DUPLICATES_ROWS_SESSION, duplicatesSession); } public static DuplicatesMonitor getDuplicatesMonitor(HttpSession httpSession) { DuplicatesMonitor duplicatesMonitor = (DuplicatesMonitor) httpSession - .getAttribute(DUPLICATES_ROWS_MONITOR); + .getAttribute(SessionConstants.DUPLICATES_ROWS_MONITOR); if (duplicatesMonitor != null) { return duplicatesMonitor; } else { duplicatesMonitor = new DuplicatesMonitor(); httpSession - .setAttribute(DUPLICATES_ROWS_MONITOR, duplicatesMonitor); + .setAttribute(SessionConstants.DUPLICATES_ROWS_MONITOR, duplicatesMonitor); return duplicatesMonitor; } } @@ -1181,16 +1178,16 @@ public class SessionUtil { public static void setDuplicatesMonitor(HttpSession httpSession, DuplicatesMonitor duplicateMonitor) { DuplicatesMonitor d = (DuplicatesMonitor) httpSession - .getAttribute(DUPLICATES_ROWS_MONITOR); + .getAttribute(SessionConstants.DUPLICATES_ROWS_MONITOR); if (d != null) { - httpSession.removeAttribute(DUPLICATES_ROWS_MONITOR); + httpSession.removeAttribute(SessionConstants.DUPLICATES_ROWS_MONITOR); } - httpSession.setAttribute(DUPLICATES_ROWS_MONITOR, duplicateMonitor); + httpSession.setAttribute(SessionConstants.DUPLICATES_ROWS_MONITOR, duplicateMonitor); } public static Task getDuplicatesTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(DUPLICATES_ROWS_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.DUPLICATES_ROWS_TASK); if (monitor == null) { logger.error("DUPLICATES_ROWS_TASK was not acquired"); } @@ -1198,10 +1195,10 @@ public class SessionUtil { } public static void setDuplicatesTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(DUPLICATES_ROWS_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.DUPLICATES_ROWS_TASK); if (monitor != null) - httpSession.removeAttribute(DUPLICATES_ROWS_TASK); - httpSession.setAttribute(DUPLICATES_ROWS_TASK, task); + httpSession.removeAttribute(SessionConstants.DUPLICATES_ROWS_TASK); + httpSession.setAttribute(SessionConstants.DUPLICATES_ROWS_TASK, task); } // @@ -1210,7 +1207,7 @@ public class SessionUtil { HttpSession httpSession) { @SuppressWarnings("unchecked") ArrayList ltr = ((ArrayList) httpSession - .getAttribute(CODELISTS_PAGING_LOADED)); + .getAttribute(SessionConstants.CODELISTS_PAGING_LOADED)); if (ltr == null) { logger.error("CODELISTS_PAGING_LOADED was not acquired"); } @@ -1221,17 +1218,17 @@ public class SessionUtil { ArrayList listCodelists) { @SuppressWarnings("unchecked") ArrayList ltr = ((ArrayList) httpSession - .getAttribute(CODELISTS_PAGING_LOADED)); + .getAttribute(SessionConstants.CODELISTS_PAGING_LOADED)); if (ltr != null) - httpSession.removeAttribute(CODELISTS_PAGING_LOADED); - httpSession.setAttribute(CODELISTS_PAGING_LOADED, listCodelists); + httpSession.removeAttribute(SessionConstants.CODELISTS_PAGING_LOADED); + httpSession.setAttribute(SessionConstants.CODELISTS_PAGING_LOADED, listCodelists); } public static ArrayList getCodelistsPagingLoadedFilteredCopy( HttpSession httpSession) { @SuppressWarnings("unchecked") ArrayList ltrFilteredCopy = ((ArrayList) httpSession - .getAttribute(CODELISTS_PAGING_LOADED_FILTERED_COPY)); + .getAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTERED_COPY)); if (ltrFilteredCopy == null) { logger.error("CODELISTS_PAGING_LOADED_FILTERED_COPY was not acquired"); } @@ -1243,16 +1240,16 @@ public class SessionUtil { ArrayList listCodelistsFilteredCopy) { @SuppressWarnings("unchecked") ArrayList ltrFilteredCopy = ((ArrayList) httpSession - .getAttribute(CODELISTS_PAGING_LOADED_FILTERED_COPY)); + .getAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTERED_COPY)); if (ltrFilteredCopy != null) - httpSession.removeAttribute(CODELISTS_PAGING_LOADED_FILTERED_COPY); - httpSession.setAttribute(CODELISTS_PAGING_LOADED_FILTERED_COPY, + httpSession.removeAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTERED_COPY); + httpSession.setAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTERED_COPY, listCodelistsFilteredCopy); } public static String getCodelistsPagingLoadedFilter(HttpSession httpSession) { String filter = (String) httpSession - .getAttribute(CODELISTS_PAGING_LOADED_FILTER); + .getAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTER); if (filter == null) { logger.error("CODELISTS_PAGING_LOADED_FILTER was not acquired"); } @@ -1263,10 +1260,10 @@ public class SessionUtil { String filter) { String fil = ((String) httpSession - .getAttribute(CODELISTS_PAGING_LOADED_FILTER)); + .getAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTER)); if (fil != null) - httpSession.removeAttribute(CODELISTS_PAGING_LOADED_FILTER); - httpSession.setAttribute(CODELISTS_PAGING_LOADED_FILTER, filter); + httpSession.removeAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTER); + httpSession.setAttribute(SessionConstants.CODELISTS_PAGING_LOADED_FILTER, filter); } // @@ -1274,13 +1271,13 @@ public class SessionUtil { public static RollBackSession getRollBackSession( HttpSession httpSession) { RollBackSession rollBackSession = (RollBackSession) httpSession - .getAttribute(ROLLBACK_SESSION); + .getAttribute(SessionConstants.ROLLBACK_SESSION); if (rollBackSession != null) { return rollBackSession; } else { rollBackSession = new RollBackSession(); httpSession - .setAttribute(ROLLBACK_SESSION, rollBackSession); + .setAttribute(SessionConstants.ROLLBACK_SESSION, rollBackSession); return rollBackSession; } } @@ -1288,24 +1285,24 @@ public class SessionUtil { public static void setRollBackSession(HttpSession httpSession, RollBackSession rollBackSession) { RollBackSession rb = (RollBackSession) httpSession - .getAttribute(ROLLBACK_SESSION); + .getAttribute(SessionConstants.ROLLBACK_SESSION); if (rb != null) { - httpSession.removeAttribute(ROLLBACK_SESSION); + httpSession.removeAttribute(SessionConstants.ROLLBACK_SESSION); } - httpSession.setAttribute(ROLLBACK_SESSION, rollBackSession); + httpSession.setAttribute(SessionConstants.ROLLBACK_SESSION, rollBackSession); } public static RollBackSessionMonitor getRollBackSessionMonitor( HttpSession httpSession) { RollBackSessionMonitor rollBackMonitor = (RollBackSessionMonitor) httpSession - .getAttribute(ROLLBACK_MONITOR); + .getAttribute(SessionConstants.ROLLBACK_MONITOR); if (rollBackMonitor != null) { return rollBackMonitor; } else { rollBackMonitor = new RollBackSessionMonitor(); httpSession - .setAttribute(ROLLBACK_MONITOR, rollBackMonitor); + .setAttribute(SessionConstants.ROLLBACK_MONITOR, rollBackMonitor); return rollBackMonitor; } } @@ -1313,16 +1310,16 @@ public class SessionUtil { public static void setRollBackSessionMonitor(HttpSession httpSession, RollBackSessionMonitor rollBackMonitor) { RollBackSessionMonitor rb = (RollBackSessionMonitor) httpSession - .getAttribute(ROLLBACK_MONITOR); + .getAttribute(SessionConstants.ROLLBACK_MONITOR); if (rb != null) { - httpSession.removeAttribute(ROLLBACK_MONITOR); + httpSession.removeAttribute(SessionConstants.ROLLBACK_MONITOR); } - httpSession.setAttribute(ROLLBACK_MONITOR, rollBackMonitor); + httpSession.setAttribute(SessionConstants.ROLLBACK_MONITOR, rollBackMonitor); } public static Task getRollBackSessionTask(HttpSession httpSession) { - Task monitor = (Task) httpSession.getAttribute(ROLLBACK_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.ROLLBACK_TASK); if (monitor == null) { logger.error("ROLLBACK_TASK was not acquired"); } @@ -1330,10 +1327,10 @@ public class SessionUtil { } public static void setRollBackSessionTask(HttpSession httpSession, Task task) { - Task monitor = (Task) httpSession.getAttribute(ROLLBACK_TASK); + Task monitor = (Task) httpSession.getAttribute(SessionConstants.ROLLBACK_TASK); if (monitor != null) - httpSession.removeAttribute(ROLLBACK_TASK); - httpSession.setAttribute(ROLLBACK_TASK, task); + httpSession.removeAttribute(SessionConstants.ROLLBACK_TASK); + httpSession.setAttribute(SessionConstants.ROLLBACK_TASK, task); } 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 8712183..33aeec8 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 @@ -102,6 +102,7 @@ import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitio import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationsId; import org.gcube.portlets.user.td.gwtservice.server.trservice.QueryService; import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap; +import org.gcube.portlets.user.td.gwtservice.server.trservice.ValueMap; import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor; @@ -168,6 +169,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession; +import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowMonitor; +import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeMonitor; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.Validations; @@ -2482,8 +2485,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error retrieving the session: null"); } - logger.info("Session:" + session.getId()); - logger.info("configureCSVParser encoding: " + encoding + logger.debug("Session:" + session.getId()); + logger.debug("configureCSVParser encoding: " + encoding + " headerPresence: " + headerPresence + " delimiter: " + delimiter + " comment: " + comment); @@ -2527,7 +2530,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error retrieving the session: null"); } - logger.info("Session:" + session.getId()); + logger.debug("Session:" + session.getId()); FileUploadSession fileUploadSession = SessionUtil .getFileUploadSession(session); if (fileUploadSession == null) { @@ -2556,7 +2559,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error retrieving the session: null"); } - logger.info("Session:" + session.getId()); + logger.debug("Session:" + session.getId()); ASLSession aslSession = SessionUtil.getAslSession(session); if (aslSession == null) { @@ -2564,7 +2567,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error retrieving the asl session: null"); } String user = aslSession.getUsername(); - logger.info("Session User:" + user); + logger.debug("Session User:" + user); logger.debug("StartCSVImport: " + csvImportSession.toString()); @@ -2793,7 +2796,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements importMonitor.setTrId(trId); } - logger.info("getImportMonitor(): " + importMonitor); + logger.debug("getImportMonitor(): " + importMonitor); return importMonitor; } catch (TDGWTSessionExpiredException e) { @@ -3308,7 +3311,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error retrieving the session: null"); } - logger.info("Session:" + session.getId()); + logger.debug("Session:" + session.getId()); ASLSession aslSession = SessionUtil.getAslSession(session); if (aslSession == null) { @@ -3316,7 +3319,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error retrieving the asl session: null"); } String user = aslSession.getUsername(); - logger.info("Session User:" + user); + logger.debug("Session User:" + user); TRId trId = SessionUtil.getTRId(session); if (trId == null) { @@ -3461,7 +3464,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setSDMXExportTask(session, task); } - logger.info("getExportMonitor(): " + exportMonitor); + logger.debug("getExportMonitor(): " + exportMonitor); return exportMonitor; } catch (TDGWTSessionExpiredException e) { @@ -3488,7 +3491,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements throw new TDGWTServiceException( "Error retrieving the session: null"); } - logger.info("Session:" + session.getId()); + logger.debug("Session:" + session.getId()); ASLSession aslSession = SessionUtil.getAslSession(session); if (aslSession == null) { @@ -3496,7 +3499,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements "Error retrieving the asl session: null"); } String user = aslSession.getUsername(); - logger.info("Session User:" + user); + logger.debug("Session User:" + user); TRId trId = SessionUtil.getTRId(session); if (trId == null) { @@ -3649,7 +3652,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setCSVExportTask(session, task); } - logger.info("getExportMonitor(): " + exportMonitor); + logger.debug("getExportMonitor(): " + exportMonitor); return exportMonitor; } catch (TDGWTSessionExpiredException e) { @@ -3883,6 +3886,57 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements return invocation; } + + + /** + * Retrieve OperationExecution for change column type + * + * @param replaceColumnSession + * @return + */ + //TODO + protected OperationExecution retrieveOperationExecution( + TabularDataService service, + EditRowSession editRowSession) + throws TDGWTServiceException { + + OperationExecution invocation = null; + List capabilities = service.getCapabilities(); + + logger.debug(editRowSession.toString()); + OperationDefinition operationDefinition; + + Map map = new HashMap(); + ValueMap valueMap=new ValueMap(); + ArrayList> compositeValue=valueMap.genValueMap(editRowSession); + + if (editRowSession.isNewRow()) { + logger.debug("Is a add row"); + operationDefinition = OperationDefinitionMap.map( + OperationsId.AddRow.toString(), + capabilities); + + map.put(Constants.PARAMETER_ADD_ROW_COMPOSITE, + compositeValue); + + invocation = new OperationExecution(operationDefinition.getOperationId(), map); + + } else { + logger.debug("Is a edit row"); + + operationDefinition = OperationDefinitionMap.map( + OperationsId.AddRow.toString(), + capabilities); + + map.put(Constants.PARAMETER_ADD_ROW_COMPOSITE, + compositeValue); + + invocation = new OperationExecution(operationDefinition.getOperationId(), map); + } + + return invocation; + } + /** * Retrieve OperationExecution for change column type @@ -4289,7 +4343,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setChangeColumnTypeTask(session, task); } - logger.info("ChangeColumnTypeMonitor(): " + changeColumnTypeMonitor); + logger.debug("ChangeColumnTypeMonitor(): " + changeColumnTypeMonitor); return changeColumnTypeMonitor; } catch (TDGWTSessionExpiredException e) { @@ -4439,7 +4493,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setDeleteColumnTask(session, task); } - logger.info("DeleteColumnMonitor(): " + deleteColumnMonitor); + logger.debug("DeleteColumnMonitor(): " + deleteColumnMonitor); return deleteColumnMonitor; } catch (TDGWTSessionExpiredException e) { @@ -4588,7 +4642,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setLabelColumnTask(session, task); } - logger.info("LabelColumnMonitor(): " + labelColumnMonitor); + logger.debug("LabelColumnMonitor(): " + labelColumnMonitor); return labelColumnMonitor; } catch (TDGWTSessionExpiredException e) { throw e; @@ -4742,7 +4796,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setChangeTableTypeTask(session, task); } - logger.info("ChangeTableTypeMonitor(): " + changeTableTypeMonitor); + logger.debug("ChangeTableTypeMonitor(): " + changeTableTypeMonitor); return changeTableTypeMonitor; } catch (TDGWTSessionExpiredException e) { throw e; @@ -5002,7 +5056,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setDeleteRowsTask(session, task); } - logger.info("DeleteRowsMonitor(): " + deleteRowsMonitor); + logger.debug("DeleteRowsMonitor(): " + deleteRowsMonitor); return deleteRowsMonitor; } catch (TDGWTSessionExpiredException e) { throw e; @@ -5222,7 +5276,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setDuplicatesTask(session, task); } - logger.info("DuplicatesMonitor(): " + duplicatesMonitor); + logger.debug("DuplicatesMonitor(): " + duplicatesMonitor); return duplicatesMonitor; } catch (TDGWTSessionExpiredException e) { throw e; @@ -5595,7 +5649,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setTemplateApplyTask(session, task); } - logger.info("TemplateApplyMonitor(): " + templateApplyMonitor); + logger.debug("TemplateApplyMonitor(): " + templateApplyMonitor); return templateApplyMonitor; } catch (TDGWTSessionExpiredException e) { @@ -5785,7 +5839,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setReplaceColumnTask(session, task); } - logger.info("ReplaceColumnMonitor(): " + replaceColumnMonitor); + logger.debug("ReplaceColumnMonitor(): " + replaceColumnMonitor); return replaceColumnMonitor; } catch (TDGWTSessionExpiredException e) { @@ -5949,7 +6003,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setReplaceBatchColumnTask(session, task); } - logger.info("ReplaceBatchColumnMonitor(): " + logger.debug("ReplaceBatchColumnMonitor(): " + replaceBatchColumnMonitor); return replaceBatchColumnMonitor; @@ -6418,7 +6472,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements SessionUtil.setRollBackSessionTask(session, task); } - logger.info("RollBackSessionMonitor(): " + rollBackMonitor); + logger.debug("RollBackSessionMonitor(): " + rollBackMonitor); return rollBackMonitor; } catch (TDGWTSessionExpiredException e) { throw e; @@ -6493,4 +6547,152 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements } } + + @Override + public void startEditRow(EditRowSession editRowSession) + throws TDGWTServiceException { + try { + HttpSession session = this.getThreadLocalRequest().getSession(); + SessionUtil.setEditRowSession(session, editRowSession); + ASLSession aslSession = SessionUtil.getAslSession(session); + + AuthorizationProvider.instance.set(new AuthorizationToken( + aslSession.getUsername())); + TabularDataService service = TabularDataServiceFactory.getService(); + + OperationExecution invocation = retrieveOperationExecution(service, + editRowSession); + if (invocation == null) { + throw new TDGWTServiceException( + "Error in invocation: Operation not supported"); + } + Long id; + if(editRowSession.getTrId().isViewTable()){ + id=Long.valueOf(editRowSession.getTrId().getReferenceTargetTableId()); + } else { + id=Long.valueOf(editRowSession.getTrId().getId()); + } + + TabularResourceId serviceTR = new TabularResourceId( + id); + 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; + + } catch (TDGWTSessionExpiredException e) { + throw e; + } catch (Throwable e) { + e.printStackTrace(); + throw new TDGWTServiceException( + "Error in operation: " + + e.getLocalizedMessage()); + } + + } + + @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()); + + } + + } + + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/OperationsId.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/OperationsId.java index 383381f..92b8cb2 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/OperationsId.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/OperationsId.java @@ -67,8 +67,11 @@ public enum OperationsId { ChangeTableType("1002"), CreateDatasetView("1003"), RemoveColumn("1004"), + AddsAColumn("1005"), ColumnNameAdd("1006"), - ColumnNameRemove("1007"), + ColumnNameRemove("1007"), + TableNameAdd("1008"), + TableNameRemove("1009"), ChangeToAnnotationColumn("2000"), ChangeToAttributeColumn("2001"), ChangeToMeasureColumn("2002"), @@ -77,20 +80,27 @@ public enum OperationsId { ChangeToCodeDescription("2005"), ChangeToDimensionColumn("2006"), ChangeToTimeDimensionColumn("2007"), + AddRow("3004"), + Denormalize("3005"), + GroupBy("3006"), RemoveDuplicateTuples("3007"), ReplaceColumnByExpression("3101"), ReplaceById("3102"), FilterByExpression("3201"), RemoveRowById("3202"), - Union("3004"), - Denormalize("3005"), - Aggregation("3006"), + Union("3208"), CodelistValidation("5001"), ColumnTypeCastCheck("5002"), DuplicateTupleValidation("5003"), + DuplicateValuesInColumnValidator("5004"), PeriodFormatCheck("5005"), ExpressionValidation("5006"), - DimensionColumnValidator("5010"); + AmbiguousExternalReferenceCheck("5007"), + DimensionColumnValidator("5010"), + ValidateTable("5011"), + ValidateDataSet("5012"), + ValidateGeneric("5013"), + ExtractCodelist("11001"); /** * @param text diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/ValueMap.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/ValueMap.java new file mode 100644 index 0000000..9e9c960 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/ValueMap.java @@ -0,0 +1,176 @@ +package org.gcube.portlets.user.td.gwtservice.server.trservice; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import org.gcube.data.analysis.tabulardata.model.column.ColumnLocalId; +import org.gcube.data.analysis.tabulardata.model.column.ColumnReference; +import org.gcube.data.analysis.tabulardata.model.datatype.value.TDBoolean; +import org.gcube.data.analysis.tabulardata.model.datatype.value.TDDate; +import org.gcube.data.analysis.tabulardata.model.datatype.value.TDInteger; +import org.gcube.data.analysis.tabulardata.model.datatype.value.TDNumeric; +import org.gcube.data.analysis.tabulardata.model.datatype.value.TDText; +import org.gcube.data.analysis.tabulardata.model.table.TableId; +import org.gcube.portlets.user.td.gwtservice.shared.Constants; +import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; +import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowSession; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; +import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType; +import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gwt.i18n.client.DateTimeFormat; + +/** + * + * @author "Giancarlo Panichi" + * + */ +public class ValueMap { + protected static Logger logger = LoggerFactory + .getLogger(ValueMap.class); + + public ValueMap(){ + + } + + protected DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd"); + + public ArrayList> genValueMap(EditRowSession editRowSession){ + ArrayList> composit=new ArrayList>(); + + if(editRowSession.getMaps()==null){ + return composit; + } + TRId trId=editRowSession.getTrId(); + TableId tableId; + if(trId.isViewTable()){ + tableId=new TableId(new Long(trId.getReferenceTargetTableId())); + } else { + tableId=new TableId(new Long(trId.getTableId())); + } + Map parametersValue=editRowSession.getMaps(); + Set keys=parametersValue.keySet(); + Iterator iterator=keys.iterator(); + String key; + while(iterator.hasNext()){ + key=iterator.next(); + String value=parametersValue.get(key); + for(ColumnData col:editRowSession.getColumns()){ + if(col.getColumnId().compareTo(key)==0){ + if (col.getTypeCode().compareTo( + ColumnTypeCode.DIMENSION.toString()) == 0 + || col.getTypeCode().compareTo( + ColumnTypeCode.TIMEDIMENSION.toString()) == 0) { + TDInteger tdDim=new TDInteger(new Integer(value)); + ColumnLocalId columnId=new ColumnLocalId(key); + ColumnReference colRef=new ColumnReference(tableId, columnId); + Map valueMap=new HashMap(); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_FIELD,colRef); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_TOSETVALUE,tdDim); + composit.add(valueMap); + + } else { + if (col.getDataTypeName().compareTo( + ColumnDataType.Boolean.toString()) == 0) { + TDBoolean tdBoolean=new TDBoolean(new Boolean(value)); + ColumnLocalId columnId=new ColumnLocalId(key); + ColumnReference colRef=new ColumnReference(tableId, columnId); + Map valueMap=new HashMap(); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_FIELD,colRef); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_TOSETVALUE,tdBoolean); + composit.add(valueMap); + } else { + if (col.getDataTypeName().compareTo( + ColumnDataType.Date.toString()) == 0) { + Date d; + try{ + d=sdf.parse(value); + }catch(IllegalArgumentException e){ + continue; + } + TDDate tdDate=new TDDate(d); + ColumnLocalId columnId=new ColumnLocalId(key); + ColumnReference colRef=new ColumnReference(tableId, columnId); + Map valueMap=new HashMap(); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_FIELD,colRef); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_TOSETVALUE,tdDate); + composit.add(valueMap); + } else { + if (col.getDataTypeName().compareTo( + ColumnDataType.Text.toString()) == 0) { + TDText tdText=new TDText(value); + ColumnLocalId columnId=new ColumnLocalId(key); + ColumnReference colRef=new ColumnReference(tableId, columnId); + Map valueMap=new HashMap(); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_FIELD,colRef); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_TOSETVALUE,tdText); + composit.add(valueMap); + } else { + if (col.getDataTypeName().compareTo( + ColumnDataType.Geometry.toString()) == 0) { + TDText tdGeometry=new TDText(value); + ColumnLocalId columnId=new ColumnLocalId(key); + ColumnReference colRef=new ColumnReference(tableId, columnId); + Map valueMap=new HashMap(); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_FIELD,colRef); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_TOSETVALUE,tdGeometry); + composit.add(valueMap); + } else { + if (col.getDataTypeName().compareTo( + ColumnDataType.Integer.toString()) == 0) { + Integer integ; + try{ + integ=new Integer(value); + } catch(NumberFormatException e){ + continue; + } + TDInteger tdInteger=new TDInteger(integ); + ColumnLocalId columnId=new ColumnLocalId(key); + ColumnReference colRef=new ColumnReference(tableId, columnId); + Map valueMap=new HashMap(); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_FIELD,colRef); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_TOSETVALUE,tdInteger); + composit.add(valueMap); + } else { + if (col.getDataTypeName().compareTo( + ColumnDataType.Numeric.toString()) == 0) { + Float numeric; + try{ + numeric=new Float(value); + } catch(NumberFormatException e){ + continue; + } + TDNumeric tdNumeric=new TDNumeric(numeric); + ColumnLocalId columnId=new ColumnLocalId(key); + ColumnReference colRef=new ColumnReference(tableId, columnId); + Map valueMap=new HashMap(); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_FIELD,colRef); + valueMap.put(Constants.PARAMETER_ADD_ROW_COMPOSITE_TOSETVALUE,tdNumeric); + composit.add(valueMap); + } else { + + } + } + } + } + } + } + + } + break; + } + } + } + + return composit; + } + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java index 98fd131..ecf5155 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/Constants.java @@ -39,6 +39,9 @@ public class Constants { public static final String PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_CONDITION="condition"; public static final String PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_VALUE="value"; + public static final String PARAMETER_ADD_ROW_COMPOSITE_FIELD="field"; + public static final String PARAMETER_ADD_ROW_COMPOSITE_TOSETVALUE="toSetValue"; + public static final String PARAMETER_ADD_ROW_COMPOSITE="mapping"; public static final String NAME_PARAMETER_ID="NAME_PARAMETER_ID"; public static final String PARAMETER_KEY="key"; @@ -49,5 +52,5 @@ public class Constants { public static final String PARAMETER_TABLE_TYPE="tableType"; public static final String PARAMETER_ROW_ID="rowId"; - + }