Skip to content

Commit

Permalink
Switch from AV_GATE to AV_OUTLET.
Browse files Browse the repository at this point in the history
  • Loading branch information
rma-rripken committed Jul 25, 2024
1 parent 412c48b commit 6d195d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.jetbrains.annotations.Nullable;
import org.jooq.DSLContext;
import usace.cwms.db.jooq.codegen.tables.AV_EMBANKMENT;
import usace.cwms.db.jooq.codegen.tables.AV_GATE;
import usace.cwms.db.jooq.codegen.tables.AV_LOCK;
import usace.cwms.db.jooq.codegen.tables.AV_OUTLET;
import usace.cwms.db.jooq.codegen.tables.AV_TURBINE;
Expand Down Expand Up @@ -117,22 +116,24 @@ private Map<String, List<CwmsId>> getChildrenOfKind(String office, String projLi

private Map<String, List<CwmsId>> getGateChildren(String office, @Nullable String projLike) {
Map<String, List<CwmsId>> retval = new LinkedHashMap<>();
AV_GATE view = AV_GATE.AV_GATE;
dsl.selectDistinct(view.OFFICE_ID, view.GATE_ID, view.PROJECT_ID)
// AV_GATE is apparently not used.
AV_OUTLET view = AV_OUTLET.AV_OUTLET;
dsl.selectDistinct(view.OFFICE_ID, view.PROJECT_ID, view.OUTLET_ID)
.from(view)
.where(view.OFFICE_ID.eq(office))
.where(view.OFFICE_ID.eq(office)
.and(view.OPENING_UNIT_EN.isNotNull().or(view.OPENING_UNIT_SI.isNotNull()))
)
.and(caseInsensitiveLikeRegexNullTrue(view.PROJECT_ID, projLike))
.orderBy(view.OFFICE_ID, view.PROJECT_ID, view.GATE_ID)
.orderBy(view.OFFICE_ID, view.PROJECT_ID, view.OUTLET_ID)
.forEach(row -> {
String projId = row.get(view.PROJECT_ID);
CwmsId gate = new CwmsId.Builder()
.withOfficeId(row.get(view.OFFICE_ID))
.withName(row.get(view.GATE_ID))
.withName(row.get(view.OUTLET_ID))
.build();
retval.computeIfAbsent(projId, k -> new ArrayList<>()).add(gate);
});


return retval;
}

Expand All @@ -153,7 +154,6 @@ private Map<String, List<CwmsId>> getLockChildren(String office, String projLike
retval.computeIfAbsent(projId, k -> new ArrayList<>()).add(lock);
});


return retval;
}

Expand All @@ -174,7 +174,6 @@ private Map<String, List<CwmsId>> getOutletChildren(String office, String projLi
retval.computeIfAbsent(projId, k -> new ArrayList<>()).add(outlet);
});


return retval;
}

Expand Down Expand Up @@ -216,7 +215,6 @@ private Map<String, List<CwmsId>> getEmbankmentChildren(String office, String pr
retval.computeIfAbsent(projId, k -> new ArrayList<>()).add(embankment);
});


return retval;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
import java.util.List;
import org.jetbrains.annotations.Nullable;

/**
* This class holds a project and lists of the project children by kind.
*/
@JsonDeserialize(builder = ProjectChildren.Builder.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy.class)
Expand Down

0 comments on commit 6d195d0

Please sign in to comment.