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 @@ -35,7 +35,9 @@ public class DataLakeMeasure {
public static final String ASSERTION_ERROR_MESSAGE = "timestamp field requires a stream prefix (e.g. s0::timestamp)";
private static final String STREAM_PREFIX_DELIMITER = "::";

@JsonProperty("elementId")
protected @SerializedName("_id") String elementId;

@JsonProperty("_rev")
private @SerializedName("_rev") String rev;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;

import java.util.Objects;

@Path("/v4/datalake/measure")
public class DataLakeMeasureResourceV4 extends AbstractAuthGuardedRestResource {

Expand All @@ -58,7 +60,12 @@ public Response addDataLake(DataLakeMeasure dataLakeMeasure) {
@Produces(MediaType.APPLICATION_JSON)
@Path("{id}")
public Response getDataLakeMeasure(@PathParam("id") String elementId) {
return ok(this.dataLakeMeasureManagement.getById(elementId));
var measure = this.dataLakeMeasureManagement.getById(elementId);
if (Objects.nonNull(measure)) {
return ok(measure);
} else {
return notFound();
}
}

@PUT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ protected <T> Response notFound(T entity) {
return error(entity, 404);
}

protected <T> Response notFound() {
return Response.status(404).build();
}

protected <T> Response serverError(T entity) {
return error(entity, 500);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ public boolean storeDataLakeMeasure(DataLakeMeasure measure) {

@Override
public List<DataLakeMeasure> getAllDataLakeMeasures() {
List<DataLakeMeasure> dataLakeMeasures = findAll();
return dataLakeMeasures;
return findAll();
}

@Override
Expand Down