Skip to content

Commit

Permalink
Exposing export folder name and file prefix as static & public
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhemSempere committed Apr 22, 2022
1 parent 39a7cec commit a82aa2b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/org/brapi/v2/api/VariantsetsApiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ public class VariantsetsApiController implements ServletContextAware, Variantset
@Autowired private MongoBrapiCache cache;

private ServletContext servletContext;
static final private String TMP_OUTPUT_FOLDER = "genofilt/brapiV2TmpOutput";

public static final String brapiV2ExportFilePrefix = "brapiV2export-";
public static final String TMP_OUTPUT_FOLDER = "genofilt/brapiV2TmpOutput";
static final private long EXPORT_FILE_EXPIRATION_DELAY_MILLIS = 1000*60*60*24; /* 1 day */

private static HashMap<String /*export id*/, Thread /*temporary file generation thread */> exportThreads = new HashMap<>();
Expand Down Expand Up @@ -353,7 +355,7 @@ public void variantsetsExportIntoFormat(HttpServletResponse response, String var
String[] splitId = variantSetDbId.split(GigwaGa4ghServiceImpl.ID_SEPARATOR);
MongoTemplate mongoTemplate = MongoTemplateManager.get(splitId[0]);
int projId = Integer.parseInt(splitId[1]);
String exportId = "brapiV2export-" + variantSetDbId;
String exportId = brapiV2ExportFilePrefix + variantSetDbId;

String relativeOutputFolder = File.separator + TMP_OUTPUT_FOLDER + File.separator;
File outputLocation = new File(servletContext.getRealPath(relativeOutputFolder));
Expand Down Expand Up @@ -416,7 +418,7 @@ else if (dataFormat.equalsIgnoreCase(DataFormatEnum.FLAPJACK.toString())) {
String[] splitId = variantSetDbId.split(GigwaGa4ghServiceImpl.ID_SEPARATOR);
MongoTemplate mongoTemplate = MongoTemplateManager.get(splitId[0]);
int projId = Integer.parseInt(splitId[1]);
String exportId = "brapiV2export-" + variantSetDbId;
String exportId = brapiV2ExportFilePrefix + variantSetDbId;

String relativeOutputFolder = File.separator + TMP_OUTPUT_FOLDER + File.separator;
File outputLocation = new File(servletContext.getRealPath(relativeOutputFolder));
Expand Down Expand Up @@ -484,7 +486,7 @@ else if (dataFormat.equalsIgnoreCase(DataFormatEnum.VCF.toString())) {
String[] splitId = variantSetDbId.split(GigwaGa4ghServiceImpl.ID_SEPARATOR);
MongoTemplate mongoTemplate = MongoTemplateManager.get(splitId[0]);
int projId = Integer.parseInt(splitId[1]);
String exportId = "brapiV2export-" + variantSetDbId;
String exportId = brapiV2ExportFilePrefix + variantSetDbId;

String relativeOutputFolder = File.separator + TMP_OUTPUT_FOLDER + File.separator;
File outputLocation = new File(servletContext.getRealPath(relativeOutputFolder));
Expand Down

0 comments on commit a82aa2b

Please sign in to comment.