[PATCH 1 of 2] issue1433: Filter loaded unknown sediment yields by kind
Wald Commits
scm-commit at wald.intevation.org
Tue Aug 6 12:16:30 CEST 2013
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1375784753 -7200
# Node ID 91c43293e53845d58864a1c43a981bbff0d33397
# Parent e032e9e6d09e9dfcac92b1b0ae1f649ac137b4f9
issue1433: Filter loaded unknown sediment yields by kind.
diff -r e032e9e6d09e -r 91c43293e538 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java Tue Aug 06 11:06:25 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java Tue Aug 06 12:25:53 2013 +0200
@@ -137,6 +137,7 @@
" JOIN units u ON sy.unit_id = u.id " +
"WHERE r.name = :river " +
" AND gf.name = 'unknown' " +
+ " AND sy.kind = :type " +
" AND u.name = :unit";
public static final String SQL_SELECT_EPOCHS_DATA =
@@ -628,8 +629,12 @@
/**
* Return sediment loads with 'unknown' fraction type.
* @param unit Restrict result set to those of given unit.
+ * @param type Type like year, epoch, off_epoch
*/
- public static SedimentLoad[] getSedimentLoadUnknown(String river, String unit) {
+ public static SedimentLoad[] getSedimentLoadUnknown(
+ String river,
+ String unit,
+ String type) {
Session session = SessionHolder.HOLDER.get();
SQLQuery sqlQuery = session.createSQLQuery(SQL_SELECT_UNKNOWN)
.addScalar("description", StandardBasicTypes.STRING)
@@ -637,6 +642,12 @@
.addScalar("end", StandardBasicTypes.DATE);
sqlQuery.setString("river", river);
sqlQuery.setString("unit", unit);
+ if (type.equals("off_epoch")) {
+ sqlQuery.setInteger("type", 1);
+ }
+ else {
+ sqlQuery.setInteger("type", 0);
+ }
List<Object[]> results = sqlQuery.list();
SedimentLoad[] loads = new SedimentLoad[results.size()];
int counter = 0;
diff -r e032e9e6d09e -r 91c43293e538 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadUnknownFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadUnknownFacet.java Tue Aug 06 11:06:25 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadUnknownFacet.java Tue Aug 06 12:25:53 2013 +0200
@@ -35,7 +35,10 @@
String river = access.getRiver();
String unit = access.getUnit();
SedimentLoad[] unknown =
- SedimentLoadFactory.getSedimentLoadUnknown(river, unit.replace("_per_","/"));
+ SedimentLoadFactory.getSedimentLoadUnknown(
+ river,
+ unit.replace("_per_","/"),
+ access.getYearEpoch());
SedimentLoad load = SedimentLoadFactory.getLoadUnknown(
river, unknown[index].getDescription());
More information about the Dive4elements-commits
mailing list