Skip to content
Draft
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 @@ -179,7 +179,7 @@ public void getAll(@NotNull Context ctx) {
@OpenApi(ignore = true)
@Override
public void getOne(@NotNull Context ctx, @NotNull String templateId) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(
Expand Down Expand Up @@ -232,7 +232,7 @@ public void create(@NotNull Context ctx) {
tags = {TAG}
)
@Override
public void update(@NotNull Context ctx, @NotNull String oldBinaryTimeSeriesId) {
public void update(@NotNull Context ctx, @NotNull String name) {

try (Timer.Context ignored = markAndTime(UPDATE)) {
boolean maxVersion = true;
Expand Down Expand Up @@ -276,7 +276,7 @@ public void update(@NotNull Context ctx, @NotNull String oldBinaryTimeSeriesId)
tags = {TAG}
)
@Override
public void delete(@NotNull Context ctx, @NotNull String binaryTimeSeriesId) {
public void delete(@NotNull Context ctx, @NotNull String name) {
try (Timer.Context ignored = markAndTime(DELETE)) {
DSLContext dsl = getDslContext(ctx);
String office = requiredParam(ctx, OFFICE);
Expand All @@ -289,7 +289,7 @@ public void delete(@NotNull Context ctx, @NotNull String binaryTimeSeriesId) {

TimeSeriesBinaryDao dao = getDao(dsl);

dao.delete(office, binaryTimeSeriesId, mask, begin, end, version);
dao.delete(office, name, mask, begin, end, version);

ctx.status(HttpServletResponse.SC_NO_CONTENT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ private Timer.Context markAndTime(String subject) {
queryParams = {
@OpenApiParam(name = OFFICE, required = true, description = "Specifies the owning office of "
+ "the Binary TimeSeries whose data is to be included in the response."),
@OpenApiParam(name = TIMEZONE, description = "Specifies "
+ "the time zone of the values of the begin and end fields (unless "
+ "otherwise specified). If this field is not specified, "
+ "the default time zone of UTC shall be used."),
@OpenApiParam(name = DATE, required = true, description = "The date of the binary value to retrieve"),
@OpenApiParam(name = VERSION_DATE, description = "The version date for the value to retrieve."),
@OpenApiParam(name = BLOB_ID, description = "Will be removed in a schema update. " +
"This is a placeholder for integration testing with schema 23.3.16", deprecated = true)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.Map;
import java.util.Set;
import com.google.common.flogger.FluentLogger;
import javax.servlet.http.HttpServletResponse;
import org.jetbrains.annotations.NotNull;
import org.jooq.DSLContext;
import org.owasp.html.PolicyFactory;
Expand Down Expand Up @@ -63,19 +64,19 @@ private Timer.Context markAndTime(String subject) {
@OpenApi(tags = {TAG}, ignore = true)
@Override
public void create(Context ctx) {
ctx.status(HttpCode.NOT_IMPLEMENTED).result("cannot perform this action");
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(tags = {"Catalog"}, ignore = true)
@Override
public void delete(Context ctx, @NotNull String entry) {
ctx.status(HttpCode.NOT_IMPLEMENTED).result("cannot perform this action");
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(tags = {"Catalog"}, ignore = true)
@Override
public void getAll(Context ctx) {
ctx.status(HttpCode.NOT_IMPLEMENTED).result("cannot perform this action");
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(
Expand Down Expand Up @@ -311,7 +312,7 @@ private static void warnAboutNotSupported(@NotNull Context ctx, String[] warnAbo
@OpenApi(tags = {"Catalog"}, ignore = true)
@Override
public void update(Context ctx, @NotNull String entry) {
ctx.status(HttpCode.NOT_IMPLEMENTED).json(CdaError.notImplemented());
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

}
1 change: 1 addition & 0 deletions cwms-data-api/src/main/java/cwms/cda/api/Controllers.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ public final class Controllers {
private static final String DEPRECATED_CSV = "2024-11-01 CSV is not used often.";

public static final String QUERY = "query";
public static final String INCLUDE_ROLES = "include-roles";


static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private Timer.Context markAndTime(String subject) {
tags = {ForecastSpecController.TAG}
)
public void handle(Context ctx) {
String specId = requiredParam(ctx, NAME);
String specId = ctx.pathParam(NAME);
String office = requiredParam(ctx, OFFICE);
String designator = ctx.queryParamAsClass(DESIGNATOR, String.class).allowNullable().get();
String forecastDate = requiredParam(ctx, FORECAST_DATE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.codahale.metrics.Histogram;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer;
import cwms.cda.api.errors.CdaError;
import cwms.cda.data.dao.JooqDao;
import cwms.cda.data.dto.TimeSeries;
import cwms.cda.formatters.Formats;
Expand All @@ -13,6 +14,7 @@
import io.javalin.plugin.openapi.annotations.OpenApiContent;
import io.javalin.plugin.openapi.annotations.OpenApiParam;
import io.javalin.plugin.openapi.annotations.OpenApiRequestBody;
import javax.servlet.http.HttpServletResponse;
import org.jetbrains.annotations.NotNull;
import org.jooq.DSLContext;

Expand Down Expand Up @@ -45,40 +47,10 @@ private Timer.Context markAndTime(String subject) {
return Controllers.markAndTime(metrics, getClass().getName(), subject);
}

@OpenApi(
description = "Used to create and save a forecast timeseries",
requestBody = @OpenApiRequestBody(
content = {
@OpenApiContent(from = TimeSeries.class, type = Formats.JSONV2)
},
required = true
),
queryParams = {
@OpenApiParam(name = FORECAST_DATE, required = true, description = "Specifies the " +
"forecast date time of the forecast instance to be associated with the created" +
"forecast timeseries."),
@OpenApiParam(name = ISSUE_DATE, required = true, description = "Specifies the " +
"issue date time of the forecast instance to be associated with the created " +
"forecast timeseries."),
@OpenApiParam(name = OFFICE, required = true, description = "Specifies the " +
"owning office of the forecast spec whose forecast instance will be " +
"associated with the created forecast timeseries."),
@OpenApiParam(name = NAME, required = true, description = "Specifies the " +
"spec id of the forecast spec whose forecast instance will be " +
"associated with the created forecast timeseries."),
@OpenApiParam(name = LOCATION_ID, required = true, description = "Specifies the " +
"location of the forecast spec whose forecast instance will be" +
"associated with the created forecast timeseries."),
@OpenApiParam(name = TIMESERIES_ID, required = true, description = "Id of timeseries " +
"that will be created.")
},
method = HttpMethod.POST,
path = "/forecast-timeseries",
tags = TAG
)
@OpenApi(ignore = true)
@Override
public void create(@NotNull Context ctx) {

ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

protected DSLContext getDslContext(Context ctx) {
Expand All @@ -88,34 +60,25 @@ protected DSLContext getDslContext(Context ctx) {
@OpenApi(ignore = true)
@Override
public void delete(@NotNull Context ctx, @NotNull String forecastSpecId) {
try (final Timer.Context ignored = markAndTime(GET_ONE)) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(ignore = true)
@Override
public void getAll(@NotNull Context ctx) {
try (final Timer.Context ignored = markAndTime(GET_ONE)) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(ignore = true)
@Override
public void getOne(@NotNull Context ctx, @NotNull String id) {
try (final Timer.Context ignored = markAndTime(GET_ONE)) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(ignore = true)
@Override
public void update(@NotNull Context ctx, @NotNull String id) {
try (final Timer.Context ignored = markAndTime(GET_ONE)) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}

ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,8 @@ public void update(@NotNull Context ctx, @NotNull String locationId) {
+ "the location whose data is to be deleted. If this field is not "
+ "specified, matching location information will be deleted from all "
+ "offices."),
//Keeping hidden from the API docs for now as this call is particularly destructive
//@OpenApiParam(name = CASCADE_DELETE, type = Boolean.class,
//description = "Specifies whether to specifies whether to delete associated data " +
//"for this location before deleting the location itself. Default: false")
@OpenApiParam(name = CASCADE_DELETE, type = Boolean.class, description = "Specifies whether to delete"
+ " associated data for this location before deleting the location itself. Default: false")
},
description = "Delete CWMS Location",
method = HttpMethod.DELETE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ public void handle(@NotNull Context ctx) {
String kindRegexMask = ctx.queryParam(LOCATION_KIND_LIKE);
String office = ctx.queryParam(OFFICE);

String formatParm = ctx.queryParamAsClass(Formats.JSONV1, String.class).getOrDefault("");
String formatHeader = ctx.header(Header.ACCEPT);
ContentType contentType = Formats.parseHeaderAndQueryParm(formatHeader, formatParm, CwmsIdLocationKind.class);
ContentType contentType = Formats.parseHeader(formatHeader, CwmsIdLocationKind.class);

String results;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.codahale.metrics.Histogram;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer;
import cwms.cda.api.errors.CdaError;
import cwms.cda.data.dao.LookupTypeDao;
import cwms.cda.data.dto.LookupType;
import cwms.cda.data.dto.StatusResponse;
Expand Down Expand Up @@ -106,9 +107,7 @@ public void getAll(Context ctx) {
@OpenApi(ignore = true)
@Override
public void getOne(@NotNull Context context, @NotNull String s) {
try (final Timer.Context ignored = markAndTime(GET_ONE)) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
context.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import static cwms.cda.api.Controllers.queryParamAsInstant;
import static cwms.cda.api.Controllers.requiredParam;
import cwms.cda.api.enums.UnitSystem;
import cwms.cda.api.errors.CdaError;
import cwms.cda.data.dao.MeasurementDao;
import cwms.cda.data.dto.StatusResponse;
import cwms.cda.data.dto.measurement.Measurement;
Expand Down Expand Up @@ -165,10 +166,7 @@ public void getAll(@NotNull Context ctx) {
@OpenApi(ignore = true)
@Override
public void getOne(@NotNull Context ctx, @NotNull String locationId) {
try (final Timer.Context ignored = markAndTime(GET_ONE)) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}

ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(
Expand Down Expand Up @@ -208,9 +206,7 @@ public void create(Context ctx) {
@OpenApi(ignore = true)
@Override
public void update(@NotNull Context ctx, @NotNull String locationId) {
try (final Timer.Context ignored = markAndTime(GET_ONE)) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
}
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ private Timer.Context markAndTime(String subject) {
@OpenApi(ignore = true)
@Override
public void create(Context ctx) {
ctx.status(HttpServletResponse.SC_NOT_FOUND);
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(ignore = true)
@Override
public void delete(Context ctx, String id) {
ctx.status(HttpServletResponse.SC_NOT_FOUND);
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());

}

Expand Down Expand Up @@ -131,16 +131,13 @@ public void getAll(Context ctx) {
@OpenApi(ignore = true)
@Override
public void getOne(Context ctx, String id) {
try (final Timer.Context timeContext = markAndTime(GET_ONE)) {
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(ignore = true)
@Override
public void update(Context ctx, String id) {
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());

}

}
6 changes: 3 additions & 3 deletions cwms-data-api/src/main/java/cwms/cda/api/PoolController.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,18 @@ public void getOne(@NotNull Context ctx, @NotNull String poolId) {
@OpenApi(ignore = true)
@Override
public void create(@NotNull Context ctx) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(ignore = true)
@Override
public void update(@NotNull Context ctx, @NotNull String locationCode) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(ignore = true)
@Override
public void delete(@NotNull Context ctx, @NotNull String locationCode) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private Timer.Context markAndTime(String subject) {
},
queryParams = {
@OpenApiParam(name = OFFICE_MASK, description = "Filters properties to the specified office mask"),
@OpenApiParam(name = CATEGORY_ID, description = "Filters properties to the specified category mask"),
@OpenApiParam(name = CATEGORY_ID_MASK, description = "Filters properties to the specified category mask"),
@OpenApiParam(name = NAME_MASK, description = "Filters properties to the specified name mask"),
},
responses = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ public void getAll(Context ctx) {
@OpenApi(ignore = true)
@Override
public void getOne(Context ctx, String templateId) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET); //To change body of
// generated methods, choose Tools | Specs.
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer;
import cwms.cda.api.errors.CdaError;
import cwms.cda.data.dao.DeleteRule;
import cwms.cda.data.dao.JooqDao;
import cwms.cda.data.dao.texttimeseries.StandardTextDao;
Expand Down Expand Up @@ -94,10 +95,7 @@ public void getAll(Context ctx) {
if (officeMask == null) {
officeMask = "*";
}
String idMask = ctx.queryParam(NAME_MASK);
if (idMask == null) {
idMask = "*";
}
String idMask = queryParamAsClass(ctx, new String[]{STANDARD_TEXT_ID_MASK, TEXT_MASK}, String.class, "*");
String formatHeader = ctx.header(Header.ACCEPT);
ContentType contentType = Formats.parseHeader(formatHeader, StandardTextCatalog.class);
DSLContext dsl = getDslContext(ctx);
Expand Down Expand Up @@ -182,7 +180,7 @@ public void create(@NotNull Context ctx) {
@OpenApi(ignore = true)
@Override
public void update(@NotNull Context ctx, @NotNull String oldTextTimeSeriesId) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ private Timer.Context markAndTime(String subject) {
+ "the time zone of the values of the begin and end fields (unless "
+ "otherwise specified). If this field is not specified, "
+ "the default time zone of UTC shall be used."),
@OpenApiParam(name = VERSION_DATE, description = "Specifies the version date of the "
+ "text timeseries. If not specified, the latest version will be used."),
@OpenApiParam(name = BEGIN, required = true, description = "The start of the time window"),
@OpenApiParam(name = END, required = true, description = "The end of the time window.")
},
Expand Down Expand Up @@ -162,7 +164,7 @@ public void getAll(@NotNull Context ctx) {
@OpenApi(ignore = true)
@Override
public void getOne(@NotNull Context ctx, @NotNull String templateId) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented());
}

@OpenApi(
Expand Down
Loading
Loading