Skip to content

Commit

Permalink
Merge branch 'develop' into devops/build_tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeNeilson committed Dec 2, 2024
2 parents ef15b73 + c103012 commit c6f746d
Show file tree
Hide file tree
Showing 120 changed files with 16,677 additions and 306 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
run: echo ${VERSION}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2.0.9
uses: softprops/action-gh-release@v2.1.0
with:
files: warfile/${{ needs.build.outputs.thewar}}
tag_name: ${{env.VERSION}}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/[email protected]

- name: Initialize CodeQL
uses: github/codeql-action/[email protected].0
uses: github/codeql-action/[email protected].4
with:
languages: 'java'
- name: setup java
Expand All @@ -34,4 +34,4 @@ jobs:
id: build
run: ./gradlew build --info --init-script init.gradle
- name: Perform CodeQL Analysis
uses: github/codeql-action/[email protected].0
uses: github/codeql-action/[email protected].4
58 changes: 55 additions & 3 deletions cwms-data-api/src/main/java/cwms/cda/ApiServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

package cwms.cda;


import static cwms.cda.api.Controllers.CONTRACT_NAME;
import static cwms.cda.api.Controllers.LOCATION_ID;
import static cwms.cda.api.Controllers.NAME;
Expand Down Expand Up @@ -105,9 +104,11 @@
import cwms.cda.api.errors.JsonFieldsException;
import cwms.cda.api.errors.NotFoundException;
import cwms.cda.api.errors.RequiredQueryParameterException;
import cwms.cda.api.location.kind.GateChangeCreateController;
import cwms.cda.api.location.kind.GateChangeDeleteController;
import cwms.cda.api.location.kind.GateChangeGetAllController;
import cwms.cda.api.location.kind.GateChangeCreateController;
import cwms.cda.api.location.kind.LockController;
import cwms.cda.api.location.kind.OutletController;
import cwms.cda.api.location.kind.VirtualOutletController;
import cwms.cda.api.location.kind.VirtualOutletCreateController;
Expand All @@ -122,6 +123,20 @@
import cwms.cda.api.project.ProjectPublishStatusUpdate;
import cwms.cda.api.project.RemoveAllLockRevokerRights;
import cwms.cda.api.project.UpdateLockRevokerRights;
import cwms.cda.api.watersupply.AccountingCatalogController;
import cwms.cda.api.watersupply.AccountingCreateController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileCatalogController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileCreateController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileDeleteController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileInstanceCatalogController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileInstanceController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileInstanceCreateController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileInstanceDeleteController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileParserCatalogController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileParserController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileParserCreateController;
import cwms.cda.api.timeseriesprofile.TimeSeriesProfileParserDeleteController;
import cwms.cda.api.watersupply.WaterContractCatalogController;
import cwms.cda.api.watersupply.WaterContractController;
import cwms.cda.api.watersupply.WaterContractCreateController;
Expand Down Expand Up @@ -504,6 +519,35 @@ protected void configureRoutes() {
get(textBinaryValuePath, new BinaryTimeSeriesValueController(metrics));
addCacheControl(textBinaryValuePath, 1, TimeUnit.DAYS);

String timeSeriesProfilePath = "/timeseries/profile/";
get(format(timeSeriesProfilePath + "{%s}/{%s}", Controllers.LOCATION_ID, Controllers.PARAMETER_ID),
new TimeSeriesProfileController(metrics));
delete(format(timeSeriesProfilePath + "/{%s}/{%s}", Controllers.LOCATION_ID,
Controllers.PARAMETER_ID), new TimeSeriesProfileDeleteController(metrics),
requiredRoles);
get(format(timeSeriesProfilePath, Controllers.LOCATION_ID, Controllers.PARAMETER_ID),
new TimeSeriesProfileCatalogController(metrics));
post(timeSeriesProfilePath, new TimeSeriesProfileCreateController(metrics), requiredRoles);

String timeSeriesProfileParserPath = "/timeseries/profile-parser/";
get(format(timeSeriesProfileParserPath + "{%s}/{%s}/", Controllers.LOCATION_ID,
Controllers.PARAMETER_ID), new TimeSeriesProfileParserController(metrics));
post(timeSeriesProfileParserPath, new TimeSeriesProfileParserCreateController(metrics), requiredRoles);
delete(format(timeSeriesProfileParserPath + "{%s}/{%s}/", Controllers.LOCATION_ID,
Controllers.PARAMETER_ID), new TimeSeriesProfileParserDeleteController(metrics),
requiredRoles);
get(timeSeriesProfileParserPath, new TimeSeriesProfileParserCatalogController(metrics));

String timeSeriesProfileInstancePath = "/timeseries/profile-instance/";
get(format(timeSeriesProfileInstancePath + "{%s}/{%s}/{%s}/", Controllers.LOCATION_ID,
Controllers.PARAMETER_ID, Controllers.VERSION),
new TimeSeriesProfileInstanceController(metrics));
post(timeSeriesProfileInstancePath, new TimeSeriesProfileInstanceCreateController(metrics), requiredRoles);
delete(format(timeSeriesProfileInstancePath + "{%s}/{%s}/{%s}/", Controllers.LOCATION_ID,
Controllers.PARAMETER_ID, Controllers.VERSION),
new TimeSeriesProfileInstanceDeleteController(metrics), requiredRoles);
get(timeSeriesProfileInstancePath, new TimeSeriesProfileInstanceCatalogController(metrics));

cdaCrudCache("/timeseries/category/{category-id}",
new TimeSeriesCategoryController(metrics), requiredRoles,5, TimeUnit.MINUTES);
cdaCrudCache("/timeseries/identifier-descriptor/{name}",
Expand Down Expand Up @@ -565,6 +609,8 @@ protected void configureRoutes() {
addWaterUserHandlers(format("/projects/{%s}/{%s}/water-user", OFFICE, PROJECT_ID), requiredRoles);
addWaterContractHandlers(format("/projects/{%s}/{%s}/water-user/{%s}/contracts", OFFICE, PROJECT_ID,
WATER_USER), requiredRoles);
addAccountingHandlers(format("/projects/{%s}/{%s}/water-user/{%s}"
+ "/contracts/{%s}/accounting", OFFICE, PROJECT_ID, WATER_USER, CONTRACT_NAME), requiredRoles);
delete(format("/projects/{%s}/{%s}/water-user/{%s}/contracts/{%s}/pumps/{%s}", OFFICE, PROJECT_ID,
WATER_USER, CONTRACT_NAME, NAME), new WaterPumpDisassociateController(metrics), requiredRoles);
addWaterContractTypeHandlers(format("/projects/{%s}/contract-types", OFFICE), requiredRoles);
Expand All @@ -573,7 +619,9 @@ protected void configureRoutes() {
new EmbankmentController(metrics), requiredRoles,1, TimeUnit.DAYS);
cdaCrudCache(format("/projects/turbines/{%s}", Controllers.NAME),
new TurbineController(metrics), requiredRoles,1, TimeUnit.DAYS);
String turbineChanges = format("/projects/{%s}/{%s}/turbine-changes", OFFICE, Controllers.NAME);
cdaCrudCache(format("/projects/locks/{%s}", Controllers.NAME),
new LockController(metrics), requiredRoles,1, TimeUnit.DAYS);
String turbineChanges = format("/projects/{%s}/{%s}/turbine-changes", Controllers.OFFICE, Controllers.NAME);
get(turbineChanges,new TurbineChangesGetController(metrics));
addCacheControl(turbineChanges, 5, TimeUnit.MINUTES);
post(turbineChanges, new TurbineChangesPostController(metrics), requiredRoles);
Expand Down Expand Up @@ -605,6 +653,10 @@ protected void configureRoutes() {
addProjectLockRightsHandlers("/project-lock-rights/{project-id}", requiredRoles);
}

private void addAccountingHandlers(String path, RouteRole[] requiredRoles) {
get(path, new AccountingCatalogController(metrics));
post(path, new AccountingCreateController(metrics), requiredRoles);
}

private void addProjectLocksHandlers(String path, RouteRole[] requiredRoles) {
String pathWithoutResource = path.replace(getResourceId(path), "");
Expand Down Expand Up @@ -873,7 +925,7 @@ private static String getAccessManagerName() {

@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
throws IOException {
totalRequests.mark();
try {
String office = officeFromContext(req.getContextPath());
Expand Down
9 changes: 9 additions & 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 @@ -63,6 +63,8 @@ public final class Controllers {
public static final String SIZE = "size";

public static final String OFFICE = "office";
public static final String CATEGORY_OFFICE_ID = "category-office-id";
public static final String GROUP_OFFICE_ID = "group-office-id";
public static final String UNIT = "unit";
public static final String COUNT = "count";
public static final String TIME = "time";
Expand All @@ -88,6 +90,7 @@ public final class Controllers {
public static final String DATE = "date";
public static final String LEVEL_ID = "level-id";
public static final String LEVEL_ID_MASK = "level-id-mask";
public static final String LOCATION_MASK = "location-mask";
public static final String NAME = "name";
public static final String CASCADE_DELETE = "cascade-delete";
public static final String DATUM = "datum";
Expand Down Expand Up @@ -127,6 +130,12 @@ public final class Controllers {
public static final String LOCATIONS = "locations";
public static final String WATER_USER = "water-user";
public static final String CONTRACT_NAME = "contract-name";
public static final String PARAMETER_ID = "parameter-id";
public static final String PARAMETER_ID_MASK = "parameter-id-mask";
public static final String VERSION_MASK = "version-mask";
public static final String PROFILE_DATA = "profile-data";
public static final String PREVIOUS = "previous";
public static final String NEXT = "next";

public static final String LOCATION_ID = "location-id";
public static final String SOURCE_ENTITY = "source-entity";
Expand Down
Loading

0 comments on commit c6f746d

Please sign in to comment.