Skip to content

Commit 94fa8c6

Browse files
authored
Merge branch 'develop' into cda-gui/review-and-improvements
2 parents 1ad9d7f + 20c6e77 commit 94fa8c6

78 files changed

Lines changed: 7668 additions & 157 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cwms-data-api/src/main/java/cwms/cda/api/BasinController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public void getOne(@NotNull Context ctx, @NotNull String name) {
193193

194194
String units =
195195
ctx.queryParamAsClass(UNIT, String.class).getOrDefault(UnitSystem.EN.value());
196-
String office = ctx.queryParam(OFFICE);
196+
String office = requiredParam(ctx, OFFICE);
197197
String formatHeader = ctx.header(Header.ACCEPT);
198198
ContentType contentType = Formats.parseHeader(formatHeader, Basin.class);
199199
ctx.contentType(contentType.toString());
@@ -303,7 +303,7 @@ public void delete(@NotNull Context ctx, @NotNull String name) {
303303
cwms.cda.data.dao.basin.BasinDao basinDao = new cwms.cda.data.dao.basin.BasinDao(dsl);
304304
CwmsId basinId = new CwmsId.Builder()
305305
.withName(name)
306-
.withOfficeId(ctx.queryParam(OFFICE))
306+
.withOfficeId(requiredParam(ctx, OFFICE))
307307
.build();
308308
basinDao.deleteBasin(basinId, deleteMethod.getRule());
309309
StatusResponse re = new StatusResponse(basinId.getOfficeId(), "Deleted CWMS Basin", basinId.getName());

cwms-data-api/src/main/java/cwms/cda/api/BinaryTimeSeriesValueController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public BinaryTimeSeriesValueController(MetricRegistry metrics) {
6464
@OpenApiParam(name = OFFICE, required = true, description = "Specifies the owning office of "
6565
+ "the Binary TimeSeries whose data is to be included in the response."),
6666
@OpenApiParam(name = BLOB_ID, description = "Will be removed in a schema update. " +
67-
"This is a placeholder for integration testing with schema 23.3.16", deprecated = true)
67+
"This is a placeholder for integration testing with schema 23.3.16", deprecated = true,
68+
required = true)
6869
},
6970
responses = {
7071
@OpenApiResponse(status = STATUS_200,

cwms-data-api/src/main/java/cwms/cda/api/Controllers.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ public final class Controllers {
223223
public static final String PREFIX = "prefix";
224224
public static final String PROJECT_LIKE = "project-like";
225225

226+
public static final String USERNAME_LIKE = "username-like";
226227
public static final String APPLICATION_ID = "application-id";
227228
public static final String REVOKE_EXISTING = "revoke-existing";
228229
public static final String REVOKE_TIMEOUT = "revoke-timeout";

cwms-data-api/src/main/java/cwms/cda/api/EmbankmentController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private Timer.Context markAndTime(String subject) {
9090
@Override
9191
public void getAll(Context ctx) {
9292
String office = ctx.queryParam(OFFICE);
93-
String projectId = ctx.queryParam(PROJECT_ID);
93+
String projectId = requiredParam(ctx, PROJECT_ID);
9494
try (Timer.Context ignored = markAndTime(GET_ALL)) {
9595
DSLContext dsl = getDslContext(ctx);
9696
EmbankmentDao dao = new EmbankmentDao(dsl);

cwms-data-api/src/main/java/cwms/cda/api/LevelsController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import cwms.cda.formatters.FormattingException;
5656
import cwms.cda.formatters.UnsupportedFormatException;
5757
import cwms.cda.helpers.DateUtils;
58+
import cwms.cda.helpers.annotations.IgnoreRequiredQueryParamMismatch;
5859
import io.javalin.apibuilder.CrudHandler;
5960
import io.javalin.core.util.Header;
6061
import io.javalin.http.Context;
@@ -378,6 +379,7 @@ public void getAll(@NotNull Context ctx) {
378379
description = "Retrieves requested Location Level",
379380
tags = TAG
380381
)
382+
@IgnoreRequiredQueryParamMismatch(parameterNames = {EFFECTIVE_DATE})
381383
@Override
382384
public void getOne(@NotNull Context ctx, @NotNull String levelId) {
383385
String office = requiredParam(ctx, OFFICE);

cwms-data-api/src/main/java/cwms/cda/api/LocationGroupController.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ private Timer.Context markAndTime(String subject) {
8686
+ " the assigned locations in the returned location groups. (default: false)"),
8787
@OpenApiParam(name = LOCATION_CATEGORY_LIKE, description = "Posix <a href=\"regexp.html\">regular expression</a> "
8888
+ "matching against the location category id"),
89-
@OpenApiParam(name = CATEGORY_OFFICE_ID, required = true, description = "Specifies the "
89+
@OpenApiParam(name = CATEGORY_OFFICE_ID, description = "Specifies the "
9090
+ "owning office of the category the location group belongs to "
9191
+ "whose data is to be included in the response."),
92-
@OpenApiParam(name = LOCATION_OFFICE_ID, required = true, description = "Specifies the "
92+
@OpenApiParam(name = LOCATION_OFFICE_ID, description = "Specifies the "
9393
+ "owning office of the location assigned to the location group whose data is to be included in the response."),
9494
},
9595
responses = {
@@ -108,8 +108,8 @@ public void getAll(@NotNull Context ctx) {
108108
DSLContext dsl = getDslContext(ctx);
109109
LocationGroupDao cdm = new LocationGroupDao(dsl);
110110

111-
String groupOfficeId = requiredParam(ctx, OFFICE);
112-
String categoryOfficeId = requiredParam(ctx, CATEGORY_OFFICE_ID);
111+
String groupOfficeId = ctx.queryParam(OFFICE);
112+
String categoryOfficeId = ctx.queryParam(CATEGORY_OFFICE_ID);
113113
String locationOfficeId = ctx.queryParam(LOCATION_OFFICE_ID);
114114

115115
boolean includeAssigned = queryParamAsClass(ctx, new String[]{INCLUDE_ASSIGNED},
@@ -152,11 +152,12 @@ Boolean.class, false, metrics, name(LocationGroupController.class.getName(),
152152
@OpenApiParam(name = OFFICE, required = true, description = "Specifies the "
153153
+ "owning office of the location group whose data is to be included "
154154
+ "in the response."),
155-
@OpenApiParam(name = GROUP_OFFICE_ID, required = true, description = "Specifies the "
156-
+ "owning office of the location group whose data is to be included in the response."),
157-
@OpenApiParam(name = CATEGORY_OFFICE_ID, required = true, description = "Specifies the "
155+
@OpenApiParam(name = GROUP_OFFICE_ID, description = "Specifies the "
156+
+ "owning office of the location group whose data is to be included in the response. "
157+
+ "Required for GEO JSON format."),
158+
@OpenApiParam(name = CATEGORY_OFFICE_ID, description = "Specifies the "
158159
+ "owning office of the category the location group belongs to "
159-
+ "whose data is to be included in the response."),
160+
+ "whose data is to be included in the response. Required for GEO JSON format."),
160161
@OpenApiParam(name = CATEGORY_ID, required = true, description = "Specifies"
161162
+ " the category containing the location group whose data is to be "
162163
+ "included in the response."),
@@ -325,8 +326,8 @@ public void delete(@NotNull Context ctx, @NotNull String groupId) {
325326
DSLContext dsl = getDslContext(ctx);
326327

327328
LocationGroupDao dao = new LocationGroupDao(dsl);
328-
String office = ctx.queryParam(OFFICE);
329-
String categoryId = ctx.queryParam(CATEGORY_ID);
329+
String office = requiredParam(ctx, OFFICE);
330+
String categoryId = requiredParam(ctx, CATEGORY_ID);
330331
boolean cascadeDelete = ctx.queryParamAsClass(CASCADE_DELETE, Boolean.class).getOrDefault(false);
331332
dao.delete(categoryId, groupId, cascadeDelete, office);
332333
ctx.status(HttpServletResponse.SC_NO_CONTENT);

cwms-data-api/src/main/java/cwms/cda/api/MeasurementController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ public void update(@NotNull Context ctx, @NotNull String locationId) {
216216
},
217217
queryParams = {
218218
@OpenApiParam(name = OFFICE, required = true, description = "Specifies the office of the measurements to delete"),
219-
@OpenApiParam(name = BEGIN, required = true, description = "The start of the time window to delete. " +
219+
@OpenApiParam(name = BEGIN, description = "The start of the time window to delete. " +
220220
TIME_FORMAT_DESC),
221-
@OpenApiParam(name = END, required = true, description = "The end of the time window to delete." +
221+
@OpenApiParam(name = END, description = "The end of the time window to delete." +
222222
TIME_FORMAT_DESC),
223223
@OpenApiParam(name = TIMEZONE, description = "This field specifies a default timezone "
224224
+ "to be used if the format of the " + BEGIN + "and " + END

cwms-data-api/src/main/java/cwms/cda/api/PoolController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import static cwms.cda.api.Controllers.OFFICE;
1515
import static cwms.cda.api.Controllers.PAGE;
1616
import static cwms.cda.api.Controllers.PAGE_SIZE;
17+
import static cwms.cda.api.Controllers.PARAMETER_ID;
1718
import static cwms.cda.api.Controllers.POOL_ID;
1819
import static cwms.cda.api.Controllers.PROJECT_ID;
1920
import static cwms.cda.api.Controllers.RESULTS;
@@ -23,6 +24,7 @@
2324
import static cwms.cda.api.Controllers.STATUS_501;
2425
import static cwms.cda.api.Controllers.TOP_MASK;
2526
import static cwms.cda.api.Controllers.queryParamAsClass;
27+
import static cwms.cda.api.Controllers.requiredParam;
2628
import static cwms.cda.data.dao.JooqDao.getDslContext;
2729

2830
import com.codahale.metrics.Histogram;
@@ -190,8 +192,8 @@ public void getOne(@NotNull Context ctx, @NotNull String poolId) {
190192
PoolDao dao = new PoolDao(dsl);
191193

192194
// These are required
193-
String office = ctx.queryParam(OFFICE);
194-
String projectId = ctx.queryParam(PROJECT_ID);
195+
String office = requiredParam(ctx, OFFICE);;
196+
String projectId = requiredParam(ctx, PROJECT_ID);
195197

196198
// These are optional
197199
String bottomMask =

cwms-data-api/src/main/java/cwms/cda/api/ProjectController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ public void create(@NotNull Context ctx) {
231231
@OpenApiParam(name = NAME, description = "The name of the project to be renamed"),
232232
},
233233
queryParams = {
234-
@OpenApiParam(name = NAME, description = "The new name of the project"),
235-
@OpenApiParam(name = OFFICE, description = "The office of the project to be renamed"),
234+
@OpenApiParam(name = NAME, required = true, description = "The new name of the project"),
235+
@OpenApiParam(name = OFFICE, required = true, description = "The office of the project to be renamed"),
236236
},
237237
requestBody = @OpenApiRequestBody(
238238
content = {

cwms-data-api/src/main/java/cwms/cda/api/SpecifiedLevelController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public void create(Context ctx) {
163163
queryParams = {
164164
@OpenApiParam(name = OFFICE, required = true, description = "Specifies the "
165165
+ "owning office of the specified level to be renamed"),
166-
@OpenApiParam(name = SPECIFIED_LEVEL_ID, description = "The new specified level id.")
166+
@OpenApiParam(name = SPECIFIED_LEVEL_ID, required = true, description = "The new specified level id.")
167167
},
168168
method = HttpMethod.PATCH,
169169
tags = {TAG}
@@ -174,8 +174,8 @@ public void update(Context ctx, @NotNull String oldSpecifiedLevelId) {
174174
DSLContext dsl = getDslContext(ctx);
175175

176176
SpecifiedLevelDao dao = getDao(dsl);
177-
String newSpecifiedLevelId = ctx.queryParam(SPECIFIED_LEVEL_ID);
178-
String office = ctx.queryParam(OFFICE);
177+
String newSpecifiedLevelId = requiredParam(ctx, SPECIFIED_LEVEL_ID);
178+
String office = requiredParam(ctx, OFFICE);
179179
dao.update(oldSpecifiedLevelId, newSpecifiedLevelId, office);
180180
ctx.status(HttpServletResponse.SC_NO_CONTENT);
181181
}
@@ -201,7 +201,7 @@ public void delete(Context ctx, String specifiedLevelId) {
201201
DSLContext dsl = getDslContext(ctx);
202202

203203
SpecifiedLevelDao dao = getDao(dsl);
204-
String office = ctx.queryParam(OFFICE);
204+
String office = requiredParam(ctx, OFFICE);
205205
dao.delete(specifiedLevelId, office);
206206
ctx.status(HttpServletResponse.SC_NO_CONTENT);
207207
}

0 commit comments

Comments
 (0)