# HG changeset patch # User mschaefer # Date 1525075995 -7200 # Node ID 8aa7d9eaaa218b85dbed2b8b9d4775ef0da94332 # Parent 384eee4b4135ebd0053a0aa792aa803a4fa71188 Added bed_height_values section heights height01 to height10 diff -r 384eee4b4135 -r 8aa7d9eaaa21 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefineddepthevol/PredefinedDepthEvolArtifact.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefineddepthevol/PredefinedDepthEvolArtifact.java Fri Apr 27 17:41:59 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/predefineddepthevol/PredefinedDepthEvolArtifact.java Mon Apr 30 10:13:15 2018 +0200 @@ -75,12 +75,12 @@ log.debug(XMLUtils.toString(data)); } - // FIXME Irgendwie muss es doch möglich sein, an das name-Attribut aus meta-data.xml ranzukommen (jetzt provisorisch in - // ids untergebracht) - // final String seriesName = getDataAsString(NAME); - so geht's nicht + // FIXME Irgendwie muss es doch möglich sein, an das name-Attribut aus meta-data.xml ranzukommen + // (jetzt provisorisch in ids untergebracht) final String code = getDatacageIDValue(data); + final String seriesName = (code.split("-").length >= 3) ? code.split("-", 3)[2] : "name?"; - createFacets(callMeta, code, (code.split("-").length >= 3) ? code.split("-", 3)[2] : "name?"); + createFacets(callMeta, code, seriesName); super.setup(identifier, factory, context, callMeta, data, loadFacets); } diff -r 384eee4b4135 -r 8aa7d9eaaa21 backend/src/main/java/org/dive4elements/river/importer/ImportBedHeightValue.java --- a/backend/src/main/java/org/dive4elements/river/importer/ImportBedHeightValue.java Fri Apr 27 17:41:59 2018 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/ImportBedHeightValue.java Mon Apr 30 10:13:15 2018 +0200 @@ -32,6 +32,7 @@ protected Double soundingWidth; protected Double minHeight; protected Double maxHeight; + protected Double[] sectionHeight; protected BedHeightValue peer; @@ -46,9 +47,14 @@ this.soundingWidth = soundingWidth; this.minHeight = minHeight; this.maxHeight = maxHeight; + this.sectionHeight = new Double[10]; } + public void setSectionHeight(final int index, final Double value) { + this.sectionHeight[index - 1] = value; + } + public void storeDependencies(final BedHeight bedHeight) { getPeer(bedHeight); } @@ -76,6 +82,8 @@ if ((values == null) || values.isEmpty()) { this.peer = new BedHeightValue(bedHeight, this.station, this.height, this.uncertainty, this.dataGap, this.soundingWidth, this.minHeight, this.maxHeight); + for (int i = 1; i <= 10; i++) + this.peer.setSectionHeight(i, this.sectionHeight[i - 1]); session.save(this.peer); } else { this.peer = values.get(0); diff -r 384eee4b4135 -r 8aa7d9eaaa21 backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java --- a/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java Fri Apr 27 17:41:59 2018 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java Mon Apr 30 10:13:15 2018 +0200 @@ -90,7 +90,17 @@ GAP("Datenl.cke.*"), // WIDTH("Peilbreite\\s*\\[(.*)\\].*"), // MINHEIGHT("Minimale Sohlh.he\\s*\\[(.*)\\].*"), // - MAXHEIGHT("Maximale Sohlh.he\\s*\\[(.*)\\].*"); + MAXHEIGHT("Maximale Sohlh.he\\s*\\[(.*)\\].*"), // + HEIGHT01("Feld\\s*1\\s*\\[(.*)\\].*"), // + HEIGHT02("Feld\\s*2\\s*\\[(.*)\\].*"), // + HEIGHT03("Feld\\s*3\\s*\\[(.*)\\].*"), // + HEIGHT04("Feld\\s*4\\s*\\[(.*)\\].*"), // + HEIGHT05("Feld\\s*5\\s*\\[(.*)\\].*"), // + HEIGHT06("Feld\\s*6\\s*\\[(.*)\\].*"), // + HEIGHT07("Feld\\s*7\\s*\\[(.*)\\].*"), // + HEIGHT08("Feld\\s*8\\s*\\[(.*)\\].*"), // + HEIGHT09("Feld\\s*9\\s*\\[(.*)\\].*"), // + HEIGHT10("Feld\\s*10\\s*\\[(.*)\\].*"); private final Pattern pattern; @@ -101,6 +111,10 @@ public Pattern getPattern() { return this.pattern; } + + public static ColTitlePattern getSectionPattern(final int index) { + return ColTitlePattern.valueOf(String.format("HEIGHT%02d", index)); + } } private final EnumMap cols = new EnumMap<>(ColTitlePattern.class); @@ -401,6 +415,8 @@ final ImportBedHeightValue value = new ImportBedHeightValue(obj, km, parse(values, ColTitlePattern.HEIGHT), parse(values, ColTitlePattern.UNCERTAINTY), parse(values, ColTitlePattern.GAP), parse(values, ColTitlePattern.WIDTH), parse(values, ColTitlePattern.MINHEIGHT), parse(values, ColTitlePattern.MAXHEIGHT)); + for (int i = 1; i <= 10; i++) + value.setSectionHeight(i, parse(values, ColTitlePattern.getSectionPattern(i))); obj.addValue(value); } diff -r 384eee4b4135 -r 8aa7d9eaaa21 backend/src/main/java/org/dive4elements/river/model/BedHeightValue.java --- a/backend/src/main/java/org/dive4elements/river/model/BedHeightValue.java Fri Apr 27 17:41:59 2018 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/BedHeightValue.java Mon Apr 30 10:13:15 2018 +0200 @@ -20,6 +20,7 @@ import javax.persistence.OneToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; +import javax.persistence.Transient; import org.apache.log4j.Logger; import org.dive4elements.river.backend.SessionHolder; @@ -46,6 +47,16 @@ private Double soundingWidth; private Double minHeight; private Double maxHeight; + private Double height01; + private Double height02; + private Double height03; + private Double height04; + private Double height05; + private Double height06; + private Double height07; + private Double height08; + private Double height09; + private Double height10; public BedHeightValue() { @@ -148,6 +159,133 @@ this.maxHeight = maxHeight; } + @Column(name = "height01") + public Double getHeight01() { + return this.height01; + } + + public void setHeight01(final Double height) { + this.height01 = height; + } + + @Column(name = "height02") + public Double getHeight02() { + return this.height02; + } + + public void setHeight02(final Double height) { + this.height02 = height; + } + + @Column(name = "height03") + public Double getHeight03() { + return this.height03; + } + + public void setHeight03(final Double height) { + this.height03 = height; + } + + @Column(name = "height04") + public Double getHeight04() { + return this.height04; + } + + public void setHeight04(final Double height) { + this.height04 = height; + } + + @Column(name = "height05") + public Double getHeight05() { + return this.height05; + } + + public void setHeight05(final Double height) { + this.height05 = height; + } + + @Column(name = "height06") + public Double getHeight06() { + return this.height06; + } + + public void setHeight06(final Double height) { + this.height06 = height; + } + + @Column(name = "height07") + public Double getHeight07() { + return this.height07; + } + + public void setHeight07(final Double height) { + this.height07 = height; + } + + @Column(name = "height08") + public Double getHeight08() { + return this.height08; + } + + public void setHeight08(final Double height) { + this.height08 = height; + } + + @Column(name = "height09") + public Double getHeight09() { + return this.height09; + } + + public void setHeight09(final Double height) { + this.height09 = height; + } + + @Column(name = "height10") + public Double getHeight10() { + return this.height10; + } + + public void setHeight10(final Double height) { + this.height10 = height; + } + + @Transient + public void setSectionHeight(final int index, final Double value) { + switch (index) { + case 1: + this.height01 = value; + break; + case 2: + this.height02 = value; + break; + case 3: + this.height03 = value; + break; + case 4: + this.height04 = value; + break; + case 5: + this.height05 = value; + break; + case 6: + this.height06 = value; + break; + case 7: + this.height07 = value; + break; + case 8: + this.height08 = value; + break; + case 9: + this.height09 = value; + break; + case 10: + this.height10 = value; + break; + default: + break; + } + } public static List getBedHeightValues(final BedHeight single) { final Session session = SessionHolder.HOLDER.get(); final Query query = session.createQuery("FROM BedHeightValue WHERE bedHeight=:single");