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 355d16c..c2bfe6e 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 @@ -17,6 +17,7 @@ import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession; import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession; import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager; +import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession; import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; @@ -75,17 +76,18 @@ public class SessionUtil { ASLSession session; if (username == null) { logger.warn("no user found in session, using test one"); - throw new TDGWTSessionExpiredException("Session Expired!"); + /* throw new TDGWTSessionExpiredException("Session Expired!"); */ // Remove comment for Test - /* - * username = Constants.DEFAULT_USER; String scope = - * Constants.DEFAULT_SCOPE; - * - * httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, - * username); session = SessionManager.getInstance().getASLSession( - * httpSession.getId(), username); session.setScope(scope); - */ + + username = Constants.DEFAULT_USER; + String scope = Constants.DEFAULT_SCOPE; + + httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, username); + session = SessionManager.getInstance().getASLSession( + httpSession.getId(), username); + session.setScope(scope); + } else { session = SessionManager.getInstance().getASLSession( httpSession.getId(), username); @@ -603,7 +605,7 @@ public class SessionUtil { deleteColumnSession); } - + // public static FilterColumnSession getFilterColumnSession( @@ -1270,7 +1272,8 @@ public class SessionUtil { if (tasksStarted == null) { tasksStarted = new HashMap(); } else { - httpSession.removeAttribute(SessionConstants.OPERATIONS_TASKS_STARTED); + httpSession + .removeAttribute(SessionConstants.OPERATIONS_TASKS_STARTED); } tasksStarted.put(taskWrapper.getTask().getId().getValue(), taskWrapper); httpSession.setAttribute(SessionConstants.OPERATIONS_TASKS_STARTED, diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java index f03eaee..5bdc428 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/OperationMonitorCreator.java @@ -194,12 +194,11 @@ public class OperationMonitorCreator { Table table; ExportMetadata exportMetadata; - switch(taskWrapper.getOperationId()){ + switch (taskWrapper.getOperationId()) { case CSVExport: table = taskWrapper.getTask().getResult().getPrimaryTable(); logger.debug("Table retrived: " + table.toString()); - exportMetadata = table - .getMetadata(ExportMetadata.class); + exportMetadata = table.getMetadata(ExportMetadata.class); logger.debug("ExportMetadata: " + exportMetadata); operationMonitor.setTrId(SessionUtil.getTRId(session)); @@ -217,8 +216,7 @@ public class OperationMonitorCreator { case SDMXExport: table = taskWrapper.getTask().getResult().getPrimaryTable(); logger.debug("Table retrived: " + table.toString()); - exportMetadata = table - .getMetadata(ExportMetadata.class); + exportMetadata = table.getMetadata(ExportMetadata.class); logger.debug("ExportMetadata: " + exportMetadata); operationMonitor.setTrId(SessionUtil.getTRId(session)); break; @@ -229,13 +227,20 @@ public class OperationMonitorCreator { operationMonitor.setTrId(trId); tabResource = SessionUtil.getTabResource(session); - tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); + logger.debug("CurrentTabResource :"+tabResource); + if (tabResource != null) { + tabResource.setTrId(trId); + SessionUtil.setTabResource(session, tabResource); + } else { + tabResource=new TabResource(); + tabResource.setTrId(trId); + SessionUtil.setTabResource(session, tabResource); + } SessionUtil.setTRId(session, trId); break; - + } - + } protected TRId retrieveTabularResourceBasicData(TRId trId)