[Dive4elements-commits] [PATCH] removed unit from model and importer for grain fractions (its always mm, otherwise a typo)
Wald Commits
scm-commit at wald.intevation.org
Tue Mar 26 18:05:10 CET 2013
# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1364317499 -3600
# Node ID 7aeb2c1016289bc785e62c31cb2392622b405808
# Parent 91b14ade214971aa6d4e30d04aaf61a730d5fb08
removed unit from model and importer for grain fractions (its always mm, otherwise a typo)
diff -r 91b14ade2149 -r 7aeb2c101628 flys-backend/src/main/java/de/intevation/flys/importer/ImportGrainFraction.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportGrainFraction.java Tue Mar 26 17:35:39 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportGrainFraction.java Tue Mar 26 18:04:59 2013 +0100
@@ -8,7 +8,6 @@
import org.hibernate.Query;
import de.intevation.flys.model.GrainFraction;
-import de.intevation.flys.model.Unit;
public class ImportGrainFraction {
@@ -21,8 +20,6 @@
private Double lower;
private Double upper;
- private ImportUnit unit;
-
private GrainFraction peer;
@@ -34,13 +31,11 @@
public ImportGrainFraction(
String name,
Double lower,
- Double upper,
- ImportUnit unit
+ Double upper
) {
this.name = name;
this.lower = lower;
this.upper = upper;
- this.unit = unit;
}
@@ -54,28 +49,24 @@
public GrainFraction getPeer() {
log.debug("get peer");
- Unit u = unit != null ? unit.getPeer() : null;
-
if (peer == null) {
Session session = ImporterSession.getInstance().getDatabaseSession();
Query query = session.createQuery(
"from GrainFraction where " +
" name=:name and " +
" lower=:lower and " +
- " upper=:upper and " +
- " unit=:unit"
+ " upper=:upper"
);
query.setParameter("name", name);
query.setParameter("lower", lower);
query.setParameter("upper", upper);
- query.setParameter("unit", u);
List<GrainFraction> fractions = query.list();
if (fractions.isEmpty()) {
log.info("create new GrainFraction");
- peer = new GrainFraction(name, lower, upper, u);
+ peer = new GrainFraction(name, lower, upper);
session.save(peer);
}
else {
diff -r 91b14ade2149 -r 7aeb2c101628 flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java Tue Mar 26 17:35:39 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java Tue Mar 26 18:04:59 2013 +0100
@@ -285,7 +285,6 @@
String upperA = a.group(4);
String upperB = a.group(5);
- String unitStr = a.group(7);
String lower = lowerA != null ? lowerA : lowerB;
String upper = upperA != null ? upperA : upperB;
@@ -293,8 +292,7 @@
return new ImportGrainFraction(
getGrainFractionTypeName(this.description),
nf.parse(lower).doubleValue(),
- nf.parse(upper).doubleValue(),
- new ImportUnit(unitStr)
+ nf.parse(upper).doubleValue()
);
}
catch (ParseException pe) {
@@ -308,7 +306,6 @@
String lowerB = b.group(5);
String upperA = b.group(6);
String upperB = b.group(7);
- String unitStr = b.group(9);
String lower = lowerA != null ? lowerA : lowerB;
String upper = upperA != null ? upperA : upperB;
@@ -317,8 +314,7 @@
return new ImportGrainFraction(
getGrainFractionTypeName(this.description),
nf.parse(lower).doubleValue(),
- nf.parse(upper).doubleValue(),
- new ImportUnit(unitStr)
+ nf.parse(upper).doubleValue()
);
}
catch (ParseException pe) {
@@ -330,7 +326,6 @@
if (c.matches()) {
String oper = c.group(1);
String valueStr = c.group(3);
- String unitStr = c.group(6);
try {
Double value = nf.parse(valueStr).doubleValue();
@@ -339,16 +334,14 @@
return new ImportGrainFraction(
getGrainFractionTypeName(this.description),
value,
- null,
- new ImportUnit(unitStr)
+ null
);
}
else {
return new ImportGrainFraction(
getGrainFractionTypeName(this.description),
null,
- value,
- new ImportUnit(unitStr)
+ value
);
}
}
diff -r 91b14ade2149 -r 7aeb2c101628 flys-backend/src/main/java/de/intevation/flys/model/GrainFraction.java
--- a/flys-backend/src/main/java/de/intevation/flys/model/GrainFraction.java Tue Mar 26 17:35:39 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/GrainFraction.java Tue Mar 26 18:04:59 2013 +0100
@@ -38,17 +38,14 @@
private Double lower;
private Double upper;
- private Unit unit;
-
public GrainFraction() {
}
- public GrainFraction(String name, Double lower, Double upper, Unit unit) {
+ public GrainFraction(String name, Double lower, Double upper) {
this.name = name;
this.lower = lower;
this.upper = upper;
- this.unit = unit;
}
@Id
@@ -95,14 +92,5 @@
this.upper = upper;
}
- @OneToOne
- @JoinColumn(name = "unit_id")
- public Unit getUnit() {
- return unit;
- }
-
- public void setUnit(Unit unit) {
- this.unit = unit;
- }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
More information about the Dive4elements-commits
mailing list