From ec7de0c4577fc9789b2c9e4765517064fdc792bc Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Wed, 1 Jun 2016 13:10:40 +0000 Subject: [PATCH] SSDM-3092 : Export functionality, ongoing work SVN: 36610 --- .../reporting-plugins/exports-api/exports-api.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py index 9586907aa7a..0108d9d2539 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py @@ -192,8 +192,10 @@ def addToZipFile(path, file, zos): fis.close(); def export(sessionToken, entities): + #Services used during the export process v3 = HttpInvokerUtils.createServiceStub(IApplicationServerApi, OPENBISURL + IApplicationServerApi.SERVICE_URL, 30 * 1000); v3d = ServiceProvider.getApplicationContext().getBean(V3_DSS_BEAN); + dssComponent = DssComponentFactory.tryCreate(sessionToken, OPENBISURL); objectCache = {}; objectMapper = GenericObjectMapper(); @@ -205,10 +207,10 @@ def export(sessionToken, entities): tempDirPathFile.delete(); tempDirPathFile.mkdir(); tempDirPath = tempDirPathFile.getCanonicalPath(); - tempZipFileName = tempDirName + ".zip"; - tempZipFilePath = tempDirPath + ".zip"; #Create Zip File + tempZipFileName = tempDirName + ".zip"; + tempZipFilePath = tempDirPath + ".zip"; fos = FileOutputStream(tempZipFilePath); zos = ZipOutputStream(fos); @@ -294,7 +296,10 @@ def export(sessionToken, entities): fos.close(); #Store on workspace to be able to generate a download link - dssComponent = DssComponentFactory.tryCreate(sessionToken, OPENBISURL); + print "Zip file can be found on the temperal directory: " + tempZipFilePath; dssComponent.putFileToSessionWorkspace(tempZipFileName, FileInputStream(File(tempZipFilePath))); - print "Zip file found at: " + tempZipFilePath; + tempZipFileNameWorkspaceURL = DataStoreServer.getConfigParameters().getDownloadURL() + "/datastore_server/session_workspace_file_download?sessionID=" + sessionToken + "&filePath=" + tempZipFileName; + print "Zip file can be downloaded from the workspace: " + tempZipFileNameWorkspaceURL; + #Send Email + #Remove temporal folder and zip return True \ No newline at end of file -- GitLab