Add temp folder for downloading DMP exported files

This commit is contained in:
George Kalampokis 2020-03-30 18:24:19 +03:00
parent 2c16e1c376
commit 78753404b5
2 changed files with 7 additions and 4 deletions

View File

@ -358,7 +358,7 @@ public class DataManagementPlanManager {
fileName = dmpEntity.getLabel();
}
fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "");
File exportFile = new File(fileName + ".docx");
File exportFile = new File(this.environment.getProperty("temp.temp") + fileName + ".docx");
FileOutputStream out = new FileOutputStream(exportFile);
document.write(out);
out.close();
@ -1001,7 +1001,7 @@ public class DataManagementPlanManager {
List<Dataset> datasets = dmp.getDataset().stream().collect(Collectors.toList());
String fileName = dmp.getLabel();
fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "");
File xmlFile = new File(fileName + ".xml");
File xmlFile = new File(this.environment.getProperty("temp.temp") + fileName + ".xml");
BufferedWriter writer = new BufferedWriter(new FileWriter(xmlFile, true));
Document xmlDoc = XmlBuilder.getDocument();
Element dmpElement = xmlDoc.createElement("dmp");
@ -1138,7 +1138,7 @@ public class DataManagementPlanManager {
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
String fileName = dmp.getLabel();
fileName = fileName.replaceAll("[^a-zA-Z0-9+ ]", "");
File file = new File(fileName + ".json");
File file = new File(this.environment.getProperty("temp.temp") + fileName + ".json");
OutputStream output = new FileOutputStream(file);
try {
// mapper.writeValue(file, rdaExportModel);

View File

@ -90,4 +90,7 @@ notification.finalised.subject=[OpenDMP] The {name} has been finalised
notification.modifiedFinalised.subject=[OpenDMP] The {name} has been modified and finalised
#############LOGGING#########
logging.config=classpath:logging/logback-${spring.profiles.active}.xml
logging.config=classpath:logging/logback-${spring.profiles.active}.xml
#############TEMP#########
temp.temp=tmp/