Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,28 @@
public class DatasetDownloadEnums {

@Getter
public enum Condition {
public enum Parameter {
UUID("uuid"),
START_DATE("start_date"),
END_DATE("end_date"),
MULTI_POLYGON("multi_polygon"),
RECIPIENT("recipient");
RECIPIENT("recipient"),
TYPE("type"),
;

private final String value;

Condition(String value) {
Parameter(String value) {
this.value = value;
}
}

@Getter
public enum Type {
SUB_SETTING("sub_setting"),
;
private final String value;
Type(String value) {
this.value = value;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ public ResponseEntity<InlineResponse200> execute(

try {

var uuid = (String) body.getInputs().get(DatasetDownloadEnums.Condition.UUID.getValue());
var startDate = (String) body.getInputs().get(DatasetDownloadEnums.Condition.START_DATE.getValue());
var endDate = (String) body.getInputs().get(DatasetDownloadEnums.Condition.END_DATE.getValue());
var multiPolygon = body.getInputs().get(DatasetDownloadEnums.Condition.MULTI_POLYGON.getValue());
var recipient = (String) body.getInputs().get(DatasetDownloadEnums.Condition.RECIPIENT.getValue());
var uuid = (String) body.getInputs().get(DatasetDownloadEnums.Parameter.UUID.getValue());
var startDate = (String) body.getInputs().get(DatasetDownloadEnums.Parameter.START_DATE.getValue());
var endDate = (String) body.getInputs().get(DatasetDownloadEnums.Parameter.END_DATE.getValue());
var multiPolygon = body.getInputs().get(DatasetDownloadEnums.Parameter.MULTI_POLYGON.getValue());
var recipient = (String) body.getInputs().get(DatasetDownloadEnums.Parameter.RECIPIENT.getValue());

// move the notify user email from data-access-service to here to make the first email faster
restServices.notifyUser(recipient, uuid, startDate, endDate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ public ResponseEntity<String> downloadData(
) throws JsonProcessingException {

Map<String, String> parameters = new HashMap<>();
parameters.put(DatasetDownloadEnums.Condition.UUID.getValue(), id);
parameters.put(DatasetDownloadEnums.Condition.START_DATE.getValue(), startDate);
parameters.put(DatasetDownloadEnums.Condition.END_DATE.getValue(), endDate);
parameters.put(DatasetDownloadEnums.Condition.MULTI_POLYGON.getValue(), objectMapper.writeValueAsString(polygons));
parameters.put(DatasetDownloadEnums.Condition.RECIPIENT.getValue(), recipient);

parameters.put(DatasetDownloadEnums.Parameter.UUID.getValue(), id);
parameters.put(DatasetDownloadEnums.Parameter.START_DATE.getValue(), startDate);
parameters.put(DatasetDownloadEnums.Parameter.END_DATE.getValue(), endDate);
parameters.put(DatasetDownloadEnums.Parameter.MULTI_POLYGON.getValue(), objectMapper.writeValueAsString(polygons));
parameters.put(DatasetDownloadEnums.Parameter.RECIPIENT.getValue(), recipient);

parameters.put(
DatasetDownloadEnums.Parameter.TYPE.getValue(),
DatasetDownloadEnums.Type.SUB_SETTING.getValue()
);

String jobId = submitJob(
"generating-data-file-for-" + recipient.replaceAll("[^a-zA-Z0-9-_]", "-"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ public class RestApiTest {
public void setUp() {
executeRequest = new Execute();
Map<String, Object> inputs = new HashMap<>();
inputs.put(DatasetDownloadEnums.Condition.UUID.getValue(), "test-uuid");
inputs.put(DatasetDownloadEnums.Condition.START_DATE.getValue(), "2023-01-01");
inputs.put(DatasetDownloadEnums.Condition.END_DATE.getValue(), "2023-01-31");
inputs.put(DatasetDownloadEnums.Condition.MULTI_POLYGON.getValue(), "test-multipolygon");
inputs.put(DatasetDownloadEnums.Condition.RECIPIENT.getValue(), "test@example.com");
inputs.put(DatasetDownloadEnums.Parameter.UUID.getValue(), "test-uuid");
inputs.put(DatasetDownloadEnums.Parameter.START_DATE.getValue(), "2023-01-01");
inputs.put(DatasetDownloadEnums.Parameter.END_DATE.getValue(), "2023-01-31");
inputs.put(DatasetDownloadEnums.Parameter.MULTI_POLYGON.getValue(), "test-multipolygon");
inputs.put(DatasetDownloadEnums.Parameter.RECIPIENT.getValue(), "test@example.com");
inputs.put(DatasetDownloadEnums.Parameter.TYPE.getValue(), DatasetDownloadEnums.Type.SUB_SETTING.getValue());
executeRequest.setInputs(inputs);
}

Expand Down