diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/BackgroundOperationMonitorCreator.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/BackgroundOperationMonitorCreator.java index cb497d4..1b93323 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/BackgroundOperationMonitorCreator.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/monitor/BackgroundOperationMonitorCreator.java @@ -4,7 +4,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; -import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpServletRequest; import org.gcube.data.analysis.tabulardata.commons.webservice.types.TaskStatus; import org.gcube.data.analysis.tabulardata.model.metadata.common.TableDescriptorMetadata; @@ -52,16 +52,16 @@ public class BackgroundOperationMonitorCreator { private static Logger logger = LoggerFactory .getLogger(BackgroundOperationMonitorCreator.class); - //private static SimpleDateFormat sdf = new SimpleDateFormat( - // "yyyy-MM-dd HH:mm"); + // private static SimpleDateFormat sdf = new SimpleDateFormat( + // "yyyy-MM-dd HH:mm"); @SuppressWarnings("unused") private static SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd"); - protected HttpSession session; - protected TaskWrapper taskWrapper; - protected OperationMonitorSession operationMonitorSession; - protected ServiceCredentials serviceCredentials; + private HttpServletRequest httpRequest; + private ServiceCredentials serviceCredentials; + private TaskWrapper taskWrapper; + private OperationMonitorSession operationMonitorSession; /** * @@ -69,10 +69,10 @@ public class BackgroundOperationMonitorCreator { * @param startTRId * @param operationMonitorSession */ - public BackgroundOperationMonitorCreator(HttpSession session, + public BackgroundOperationMonitorCreator(HttpServletRequest httpRequest, ServiceCredentials serviceCredentials, TaskWrapper taskWrapper, OperationMonitorSession operationMonitorSession) { - this.session = session; + this.httpRequest = httpRequest; this.serviceCredentials = serviceCredentials; this.taskWrapper = taskWrapper; this.operationMonitorSession = operationMonitorSession; @@ -108,24 +108,28 @@ public class BackgroundOperationMonitorCreator { // taskS.setState(State.ABORTED); operationMonitor.setTask(taskS); // operationMonitor.setAbort(true); - SessionUtil.setTaskInBackground(session, taskWrapper); + SessionUtil.setTaskInBackground(httpRequest, + serviceCredentials, taskWrapper); postOperation(operationMonitor); } else { if (operationMonitorSession.isHidden()) { TaskS taskS = createTaskS(); operationMonitor.setTask(taskS); operationMonitor.setHidden(true); - SessionUtil.removeTaskInBackground(session, taskWrapper); - SessionUtil.setHiddenTask(session, taskWrapper); + SessionUtil.removeTaskInBackground(httpRequest, + serviceCredentials, taskWrapper); + SessionUtil.setHiddenTask(httpRequest, serviceCredentials, + taskWrapper); postOperation(operationMonitor); } else { if (!operationMonitorSession.isInBackground()) { TaskS taskS = createTaskS(); operationMonitor.setTask(taskS); operationMonitor.setInBackground(false); - SessionUtil - .removeTaskInBackground(session, taskWrapper); - SessionUtil.setStartedTask(session, taskWrapper); + SessionUtil.removeTaskInBackground(httpRequest, + serviceCredentials, taskWrapper); + SessionUtil.setStartedTask(httpRequest, + serviceCredentials, taskWrapper); postOperation(operationMonitor); } else { TaskStatus status = taskWrapper.getTask().getStatus(); @@ -137,7 +141,8 @@ public class BackgroundOperationMonitorCreator { TaskS taskS = createTaskS(); operationMonitor.setTask(taskS); } - SessionUtil.setTaskInBackground(session, taskWrapper); + SessionUtil.setTaskInBackground(httpRequest, + serviceCredentials, taskWrapper); postOperation(operationMonitor); } } @@ -166,13 +171,14 @@ public class BackgroundOperationMonitorCreator { validationsJobS.add(validationJ); j++; } - - JobSClassifier jobClassifier=JobClassifierMap.map(job.getJobClassifier()); - + + JobSClassifier jobClassifier = JobClassifierMap.map(job + .getJobClassifier()); + JobS jobS = new JobS(String.valueOf(i), job.getProgress(), - job.getHumaReadableStatus(), jobClassifier, job.getDescription(), - WorkerStateMap.map(job.getStatus()), job.getErrorMessage(), - validationsJobS); + job.getHumaReadableStatus(), jobClassifier, + job.getDescription(), WorkerStateMap.map(job.getStatus()), + job.getErrorMessage(), validationsJobS); jobSList.add(jobS); i++; @@ -246,8 +252,10 @@ public class BackgroundOperationMonitorCreator { break; case ABORTED: operationMonitor.setAbort(true); - SessionUtil.removeTaskInBackground(session, taskWrapper); - SessionUtil.setAbortedTasks(session, taskWrapper); + SessionUtil.removeTaskInBackground(httpRequest, serviceCredentials, + taskWrapper); + SessionUtil.setAbortedTasks(httpRequest, serviceCredentials, + taskWrapper); break; case STOPPED: logger.debug("Task Result:" + taskWrapper.getTask().getResult()); @@ -275,24 +283,28 @@ public class BackgroundOperationMonitorCreator { exportMetadata = table.getMetadata(ExportMetadata.class); logger.debug("ExportMetadata: " + exportMetadata); - operationMonitor.setTrId(SessionUtil.getTRId(session)); + operationMonitor.setTrId(SessionUtil.getTRId(httpRequest, + serviceCredentials)); - /*TabExportMetadata trExportMetadata; - trExportMetadata = new TabExportMetadata(); - trExportMetadata.setUrl(exportMetadata.getUri()); - trExportMetadata.setDestinationType(exportMetadata - .getDestinationType()); - trExportMetadata.setExportDate(sdf.format(exportMetadata - .getExportDate()));*/ + /* + * TabExportMetadata trExportMetadata; trExportMetadata = new + * TabExportMetadata(); + * trExportMetadata.setUrl(exportMetadata.getUri()); + * trExportMetadata.setDestinationType(exportMetadata + * .getDestinationType()); + * trExportMetadata.setExportDate(sdf.format(exportMetadata + * .getExportDate())); + */ saveCSVExportInDestination(exportMetadata); break; case SDMXExport: table = taskWrapper.getTask().getResult().getPrimaryTable(); logger.debug("Table retrived: " + table.toString()); - //exportMetadata = table.getMetadata(ExportMetadata.class); - //logger.debug("ExportMetadata: " + exportMetadata); - operationMonitor.setTrId(SessionUtil.getTRId(session)); + // exportMetadata = table.getMetadata(ExportMetadata.class); + // logger.debug("ExportMetadata: " + exportMetadata); + operationMonitor.setTrId(SessionUtil.getTRId(httpRequest, + serviceCredentials)); break; case JSONExport: table = taskWrapper.getTask().getResult().getPrimaryTable(); @@ -300,14 +312,17 @@ public class BackgroundOperationMonitorCreator { exportMetadata = table.getMetadata(ExportMetadata.class); logger.debug("ExportMetadata: " + exportMetadata); - operationMonitor.setTrId(SessionUtil.getTRId(session)); + operationMonitor.setTrId(SessionUtil.getTRId(httpRequest, + serviceCredentials)); - /*trExportMetadata = new TabExportMetadata(); - trExportMetadata.setUrl(exportMetadata.getUri()); - trExportMetadata.setDestinationType(exportMetadata - .getDestinationType()); - trExportMetadata.setExportDate(sdf.format(exportMetadata - .getExportDate()));*/ + /* + * trExportMetadata = new TabExportMetadata(); + * trExportMetadata.setUrl(exportMetadata.getUri()); + * trExportMetadata.setDestinationType(exportMetadata + * .getDestinationType()); + * trExportMetadata.setExportDate(sdf.format(exportMetadata + * .getExportDate())); + */ saveJSONExportInDestination(exportMetadata); break; @@ -369,7 +384,6 @@ public class BackgroundOperationMonitorCreator { logger.debug("Retrieved TRId basic info:" + newTRId.toString()); return newTRId; - } catch (SecurityException e) { e.printStackTrace(); throw new TDGWTServiceException(SECURITY_EXCEPTION_RIGHTS); @@ -383,7 +397,7 @@ public class BackgroundOperationMonitorCreator { /** * Save export data on Workspace * - * @param session + * @param httpRequest * @param user * @param exportMetadata * @param exportSession @@ -391,8 +405,8 @@ public class BackgroundOperationMonitorCreator { */ protected void saveCSVExportInDestination(ExportMetadata exportMetadata) throws TDGWTServiceException { - CSVExportSession exportSession = SessionUtil - .getCSVExportSession(session); + CSVExportSession exportSession = SessionUtil.getCSVExportSession( + httpRequest, serviceCredentials); String user = serviceCredentials.getUserName(); logger.debug("Save Export In Destination"); @@ -400,9 +414,11 @@ public class BackgroundOperationMonitorCreator { if (exportSession.getDestination().getId().compareTo("Workspace") == 0) { logger.debug("Save on Workspace"); - boolean end = SessionUtil.getCSVExportEnd(session); + boolean end = SessionUtil.getCSVExportEnd(httpRequest, + serviceCredentials); if (end == false) { - SessionUtil.setCSVExportEnd(session, true); + SessionUtil.setCSVExportEnd(httpRequest, serviceCredentials, + true); logger.debug("Create Item On Workspace: [ storageId: " + exportMetadata.getUri() + " ,user: " + user + " ,fileName: " + exportSession.getFileName() @@ -410,11 +426,12 @@ public class BackgroundOperationMonitorCreator { + exportSession.getFileDescription() + " ,mimetype: text/csv" + " ,folder: " + exportSession.getItemId() + "]"); - + FilesStorage storage = new FilesStorage(); - - storage.createItemOnWorkspaceByStorageId(exportMetadata.getUri(), user, - exportSession.getFileName()+".csv", + + storage.createItemOnWorkspaceByStorageId( + exportMetadata.getUri(), user, + exportSession.getFileName() + ".csv", exportSession.getFileDescription(), "text/csv", exportSession.getItemId()); @@ -431,7 +448,7 @@ public class BackgroundOperationMonitorCreator { /** * Save export json data on Workspace * - * @param session + * @param httpRequest * @param user * @param exportMetadata * @param exportSession @@ -439,8 +456,8 @@ public class BackgroundOperationMonitorCreator { */ protected void saveJSONExportInDestination(ExportMetadata exportMetadata) throws TDGWTServiceException { - JSONExportSession exportSession = SessionUtil - .getJSONExportSession(session); + JSONExportSession exportSession = SessionUtil.getJSONExportSession( + httpRequest, serviceCredentials); String user = serviceCredentials.getUserName(); logger.debug("Save Export In Destination"); @@ -448,10 +465,12 @@ public class BackgroundOperationMonitorCreator { if (exportSession.getDestination().getId().compareTo("Workspace") == 0) { logger.debug("Save on Workspace"); - boolean end = SessionUtil.getJSONExportEnd(session); + boolean end = SessionUtil.getJSONExportEnd(httpRequest, + serviceCredentials); if (end == false) { - SessionUtil.setJSONExportEnd(session, true); - + SessionUtil.setJSONExportEnd(httpRequest, serviceCredentials, + true); + logger.debug("Create Item On Workspace: [ storageId: " + exportMetadata.getUri() + " ,user: " + user + " ,fileName: " + exportSession.getFileName() @@ -459,11 +478,12 @@ public class BackgroundOperationMonitorCreator { + exportSession.getFileDescription() + " ,mimetype: application/json" + " ,folder: " + exportSession.getItemId() + "]"); - + FilesStorage storage = new FilesStorage(); - - storage.createItemOnWorkspaceByStorageId(exportMetadata.getUri(), user, - exportSession.getFileName()+".json", + + storage.createItemOnWorkspaceByStorageId( + exportMetadata.getUri(), user, + exportSession.getFileName() + ".json", exportSession.getFileDescription(), "application/json", exportSession.getItemId()); @@ -534,7 +554,7 @@ public class BackgroundOperationMonitorCreator { operationMonitor.setTabularResourceName("NoName"); return; } - + logger.debug("retrieveNameOfTabularResourceOnWhicWasLaunchedTheTask(): on TabularResourceId " + tabIdL); 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 c60605c..7ce6c25 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 @@ -4,7 +4,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; -import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpServletRequest; import org.gcube.data.analysis.tabulardata.commons.webservice.types.TaskStatus; import org.gcube.data.analysis.tabulardata.model.metadata.common.TableDescriptorMetadata; @@ -53,16 +53,16 @@ public class OperationMonitorCreator { private static Logger logger = LoggerFactory .getLogger(OperationMonitorCreator.class); - //private static SimpleDateFormat sdf = new SimpleDateFormat( - // "yyyy-MM-dd HH:mm"); + // private static SimpleDateFormat sdf = new SimpleDateFormat( + // "yyyy-MM-dd HH:mm"); @SuppressWarnings("unused") private static SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd"); - private HttpSession session; + private HttpServletRequest httpRequest; + private ServiceCredentials serviceCredentials; private TaskWrapper taskWrapper; private OperationMonitorSession operationMonitorSession; - private ServiceCredentials serviceCredentials; /** * @@ -70,10 +70,10 @@ public class OperationMonitorCreator { * @param startTRId * @param operationMonitorSession */ - public OperationMonitorCreator(HttpSession session, ServiceCredentials serviceCredentials, - TaskWrapper taskWrapper, + public OperationMonitorCreator(HttpServletRequest httpRequest, + ServiceCredentials serviceCredentials, TaskWrapper taskWrapper, OperationMonitorSession operationMonitorSession) { - this.session=session; + this.httpRequest = httpRequest; this.serviceCredentials = serviceCredentials; this.taskWrapper = taskWrapper; this.operationMonitorSession = operationMonitorSession; @@ -105,18 +105,21 @@ public class OperationMonitorCreator { Task task = taskWrapper.getTask(); task.abort(); TaskS taskS = createTaskS(); - //taskS.setState(State.ABORTED); + // taskS.setState(State.ABORTED); operationMonitor.setTask(taskS); - //operationMonitor.setAbort(true); - SessionUtil.setStartedTask(session, taskWrapper); + // operationMonitor.setAbort(true); + SessionUtil.setStartedTask(httpRequest, serviceCredentials, + taskWrapper); postOperation(operationMonitor); } else { if (operationMonitorSession.isInBackground()) { TaskS taskS = createTaskS(); operationMonitor.setTask(taskS); operationMonitor.setInBackground(true); - SessionUtil.setTaskInBackground(session, taskWrapper); - SessionUtil.removeStartedTask(session, taskWrapper); + SessionUtil.setTaskInBackground(httpRequest, + serviceCredentials, taskWrapper); + SessionUtil.removeStartedTask(httpRequest, + serviceCredentials, taskWrapper); postOperation(operationMonitor); } else { @@ -137,7 +140,8 @@ public class OperationMonitorCreator { TaskS taskS = createTaskS(); operationMonitor.setTask(taskS); } - SessionUtil.setStartedTask(session, taskWrapper); + SessionUtil.setStartedTask(httpRequest, serviceCredentials, + taskWrapper); postOperation(operationMonitor); } } @@ -165,14 +169,14 @@ public class OperationMonitorCreator { validationsJobS.add(validationJ); j++; } - - JobSClassifier jobClassifier=JobClassifierMap.map(job.getJobClassifier()); - + + JobSClassifier jobClassifier = JobClassifierMap.map(job + .getJobClassifier()); JobS jobS = new JobS(String.valueOf(i), job.getProgress(), - job.getHumaReadableStatus(), jobClassifier, job.getDescription(), - WorkerStateMap.map(job.getStatus()), job.getErrorMessage(), - validationsJobS); + job.getHumaReadableStatus(), jobClassifier, + job.getDescription(), WorkerStateMap.map(job.getStatus()), + job.getErrorMessage(), validationsJobS); jobSList.add(jobS); i++; @@ -259,7 +263,7 @@ public class OperationMonitorCreator { TRId trId; TabResource tabResource; Table table; - //TabExportMetadata trExportMetadata; + // TabExportMetadata trExportMetadata; ExportMetadata exportMetadata; switch (taskWrapper.getOperationId()) { @@ -269,23 +273,27 @@ public class OperationMonitorCreator { exportMetadata = table.getMetadata(ExportMetadata.class); logger.debug("ExportMetadata: " + exportMetadata); - operationMonitor.setTrId(SessionUtil.getTRId(session)); + operationMonitor.setTrId(SessionUtil.getTRId(httpRequest, + serviceCredentials)); - /*trExportMetadata = new TabExportMetadata(); - trExportMetadata.setUrl(exportMetadata.getUri()); - trExportMetadata.setDestinationType(exportMetadata - .getDestinationType()); - trExportMetadata.setExportDate(sdf.format(exportMetadata - .getExportDate()));*/ + /* + * trExportMetadata = new TabExportMetadata(); + * trExportMetadata.setUrl(exportMetadata.getUri()); + * trExportMetadata.setDestinationType(exportMetadata + * .getDestinationType()); + * trExportMetadata.setExportDate(sdf.format(exportMetadata + * .getExportDate())); + */ saveCSVExportInDestination(exportMetadata); break; case SDMXExport: table = taskWrapper.getTask().getResult().getPrimaryTable(); logger.debug("Table retrived: " + table.toString()); - //exportMetadata = table.getMetadata(ExportMetadata.class); - //logger.debug("ExportMetadata: " + exportMetadata); - operationMonitor.setTrId(SessionUtil.getTRId(session)); + // exportMetadata = table.getMetadata(ExportMetadata.class); + // logger.debug("ExportMetadata: " + exportMetadata); + operationMonitor.setTrId(SessionUtil.getTRId(httpRequest, + serviceCredentials)); break; case JSONExport: table = taskWrapper.getTask().getResult().getPrimaryTable(); @@ -293,14 +301,17 @@ public class OperationMonitorCreator { exportMetadata = table.getMetadata(ExportMetadata.class); logger.debug("ExportMetadata: " + exportMetadata); - operationMonitor.setTrId(SessionUtil.getTRId(session)); + operationMonitor.setTrId(SessionUtil.getTRId(httpRequest, + serviceCredentials)); - /*trExportMetadata = new TabExportMetadata(); - trExportMetadata.setUrl(exportMetadata.getUri()); - trExportMetadata.setDestinationType(exportMetadata - .getDestinationType()); - trExportMetadata.setExportDate(sdf.format(exportMetadata - .getExportDate()));*/ + /* + * trExportMetadata = new TabExportMetadata(); + * trExportMetadata.setUrl(exportMetadata.getUri()); + * trExportMetadata.setDestinationType(exportMetadata + * .getDestinationType()); + * trExportMetadata.setExportDate(sdf.format(exportMetadata + * .getExportDate())); + */ saveJSONExportInDestination(exportMetadata); break; @@ -310,18 +321,22 @@ public class OperationMonitorCreator { trId = retrieveTabularResourceBasicData(trId); operationMonitor.setTrId(trId); - tabResource = SessionUtil.getCSVImportTabResource(session); + tabResource = SessionUtil.getCSVImportTabResource(httpRequest, + serviceCredentials); if (tabResource != null) { tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); + SessionUtil.setTabResource(httpRequest, serviceCredentials, + tabResource); } else { tabResource = new TabResource(); tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); + SessionUtil.setTabResource(httpRequest, serviceCredentials, + tabResource); } logger.debug("CurrentTabResource set:" + tabResource); - SessionUtil.setTRId(session, trId); - SessionUtil.addToCurrentTabularResourcesOpen(session, tabResource); + SessionUtil.setTRId(httpRequest, serviceCredentials, trId); + SessionUtil.addToCurrentTabularResourcesOpen(httpRequest, + serviceCredentials, tabResource); break; case SDMXImport: trId = new TRId(); @@ -329,18 +344,22 @@ public class OperationMonitorCreator { trId = retrieveTabularResourceBasicData(trId); operationMonitor.setTrId(trId); - tabResource = SessionUtil.getSDMXImportTabResource(session); + tabResource = SessionUtil.getSDMXImportTabResource(httpRequest, + serviceCredentials); if (tabResource != null) { tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); + SessionUtil.setTabResource(httpRequest, serviceCredentials, + tabResource); } else { tabResource = new TabResource(); tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); + SessionUtil.setTabResource(httpRequest, serviceCredentials, + tabResource); } logger.debug("CurrentTabResource set:" + tabResource); - SessionUtil.setTRId(session, trId); - SessionUtil.addToCurrentTabularResourcesOpen(session, tabResource); + SessionUtil.setTRId(httpRequest, serviceCredentials, trId); + SessionUtil.addToCurrentTabularResourcesOpen(httpRequest, + serviceCredentials, tabResource); break; case Clone: trId = new TRId(); @@ -352,17 +371,20 @@ public class OperationMonitorCreator { trId = new TRId(taskWrapper.getTrId().getId()); trId = retrieveTabularResourceBasicData(trId); operationMonitor.setTrId(trId); - tabResource = SessionUtil.getTabResource(session); + tabResource = SessionUtil.getTabResource(httpRequest, + serviceCredentials); if (tabResource != null) { tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); + SessionUtil.setTabResource(httpRequest, serviceCredentials, + tabResource); } else { tabResource = new TabResource(); tabResource.setTrId(trId); - SessionUtil.setTabResource(session, tabResource); + SessionUtil.setTabResource(httpRequest, serviceCredentials, + tabResource); } logger.debug("CurrentTabResource set:" + tabResource); - SessionUtil.setTRId(session, trId); + SessionUtil.setTRId(httpRequest, serviceCredentials, trId); break; } @@ -372,7 +394,7 @@ public class OperationMonitorCreator { protected TRId retrieveTabularResourceBasicData(TRId trId) throws TDGWTServiceException { try { - + TabularDataService service = TabularDataServiceFactory.getService(); TabularResourceId tabularResourceId = new TabularResourceId( new Long(trId.getId())); @@ -384,7 +406,6 @@ public class OperationMonitorCreator { } // logger.debug("Retrieve Tabular Resource Basic Data: "+tr); - Table table = service.getLastTable(tabularResourceId); if (table == null) { logger.error("Last Table Null"); @@ -441,7 +462,7 @@ public class OperationMonitorCreator { /** * Save export csv data on Workspace * - * @param session + * @param httpRequest * @param user * @param exportMetadata * @param exportSession @@ -449,8 +470,8 @@ public class OperationMonitorCreator { */ protected void saveCSVExportInDestination(ExportMetadata exportMetadata) throws TDGWTServiceException { - CSVExportSession exportSession = SessionUtil - .getCSVExportSession(session); + CSVExportSession exportSession = SessionUtil.getCSVExportSession( + httpRequest, serviceCredentials); String user = serviceCredentials.getUserName(); logger.debug("Save Export In Destination"); @@ -458,10 +479,12 @@ public class OperationMonitorCreator { if (exportSession.getDestination().getId().compareTo("Workspace") == 0) { logger.debug("Save on Workspace"); - boolean end = SessionUtil.getCSVExportEnd(session); + boolean end = SessionUtil.getCSVExportEnd(httpRequest, + serviceCredentials); if (end == false) { - SessionUtil.setCSVExportEnd(session, true); - + SessionUtil.setCSVExportEnd(httpRequest, serviceCredentials, + true); + logger.debug("Create Item On Workspace: [ storageId: " + exportMetadata.getUri() + " ,user: " + user + " ,fileName: " + exportSession.getFileName() @@ -469,10 +492,11 @@ public class OperationMonitorCreator { + exportSession.getFileDescription() + " ,mimetype: text/csv" + " ,folder: " + exportSession.getItemId() + "]"); - + FilesStorage storage = new FilesStorage(); - storage.createItemOnWorkspaceByStorageId(exportMetadata.getUri(), user, - exportSession.getFileName()+".csv", + storage.createItemOnWorkspaceByStorageId( + exportMetadata.getUri(), user, + exportSession.getFileName() + ".csv", exportSession.getFileDescription(), "text/csv", exportSession.getItemId()); @@ -489,7 +513,7 @@ public class OperationMonitorCreator { /** * Save export json data on Workspace * - * @param session + * @param httpRequest * @param user * @param exportMetadata * @param exportSession @@ -497,8 +521,8 @@ public class OperationMonitorCreator { */ protected void saveJSONExportInDestination(ExportMetadata exportMetadata) throws TDGWTServiceException { - JSONExportSession exportSession = SessionUtil - .getJSONExportSession(session); + JSONExportSession exportSession = SessionUtil.getJSONExportSession( + httpRequest, serviceCredentials); String user = serviceCredentials.getUserName(); logger.debug("Save Export In Destination"); @@ -506,10 +530,12 @@ public class OperationMonitorCreator { if (exportSession.getDestination().getId().compareTo("Workspace") == 0) { logger.debug("Save on Workspace"); - boolean end = SessionUtil.getJSONExportEnd(session); + boolean end = SessionUtil.getJSONExportEnd(httpRequest, + serviceCredentials); if (end == false) { - SessionUtil.setJSONExportEnd(session, true); - + SessionUtil.setJSONExportEnd(httpRequest, serviceCredentials, + true); + logger.debug("Create Item On Workspace: [ storageId: " + exportMetadata.getUri() + " ,user: " + user + " ,fileName: " + exportSession.getFileName() @@ -517,11 +543,12 @@ public class OperationMonitorCreator { + exportSession.getFileDescription() + " ,mimetype: application/json" + " ,folder: " + exportSession.getItemId() + "]"); - + FilesStorage storage = new FilesStorage(); - - storage.createItemOnWorkspaceByStorageId(exportMetadata.getUri(), user, - exportSession.getFileName()+".json", + + storage.createItemOnWorkspaceByStorageId( + exportMetadata.getUri(), user, + exportSession.getFileName() + ".json", exportSession.getFileDescription(), "application/json", exportSession.getItemId());