Skip to content

Commit

Permalink
task grid / alpha shape downloads are zipped too (#5487)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhatchl committed Nov 6, 2022
1 parent 8031d96 commit 7c42709
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ public Response export(ExportParams params,

//generates density tiles and alpha shape and clips the first with the second
} else if (params.getOutputType().startsWith("alpha.tiles")) {
String initialOutputType = params.getOutputType();
params.setOutputType("tiles.geojson");
workflow.add(getCommand(user, jobId, params, debugLevel));
params.setOutputType("alpha.shp");
Expand All @@ -238,7 +239,9 @@ public Response export(ExportParams params,
workflow.add(ogrFormatCommand);
Command sedSourceCommand = new SedSourceCommand(jobId, params, this.getClass());
workflow.add(sedSourceCommand);
Command zipCommand = new ZIPFileCommand(new File(workDir, params.getOutputName() + ".zip"), workDir, outputName + ".alpha.tiles.geojson", this.getClass());
params.setOutputType(initialOutputType);
String fileToZip = params.getOutputName() + "." + params.getOutputType();
Command zipCommand = new ZIPFileCommand(new File(workDir, fileToZip + ".zip"), workDir, fileToZip, this.getClass());
workflow.add(zipCommand);

} else if (inputType.equalsIgnoreCase("changesets")) {
Expand Down Expand Up @@ -322,15 +325,13 @@ public Response exportFile(@PathParam("id") String jobId,
//need to use job id to determine if this is changeset or export
File exportFile;
hoot.services.models.db.JobStatus jobStatus = jobStatusManager.getJobStatusObj(jobId);
//job status could be null
if (JobType.fromInteger(jobStatus.getJobType()) == JobType.DERIVE_CHANGESET) {
exportFile = getChangesetFile(jobId, outputname, fileExt);
} else {
exportFile = getExportFile(jobId, outputname, fileExt);
}
String outFileName = exportFile.getName();
if (! StringUtils.isBlank(outputname)) {
outFileName = outputname;
}
ResponseBuilder responseBuilder;
//Do some zipping if fileExt is not zip
if (!fileExt.equalsIgnoreCase("zip")) {
Expand Down
2 changes: 1 addition & 1 deletion hoot-ui-2x

0 comments on commit 7c42709

Please sign in to comment.