# HG changeset patch # User Tom Gottfried # Date 1362651931 -3600 # Node ID 25cafe0a974d3cb65c37e8d00b3914c1279645dc # Parent e8e092c00791efc6d3f1da39d8122d223769e80e# Parent 0a83a796f7cf5c127726db33de187ef0cd7d9d17 merge diff -r 0a83a796f7cf -r 25cafe0a974d 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 Thu Mar 07 11:18:50 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java Thu Mar 07 11:25:31 2013 +0100 @@ -33,28 +33,28 @@ public static final String FRAKTION_START = "Fraktion:"; public static final String FRACTION_COARSE_STR = - "_Grobkorn.csv"; + ".*Grobkorn.*"; public static final String FRACTION_FINE_MIDDLE_STR = - "_Fein-Mittel-Kies.csv"; + ".*Fein-Mittel-Kies.*"; public static final String FRACTION_SAND = - "_Sand.csv"; + ".*Sand.*"; public static final String FRACTION_SUSP_SAND = - "_susp_Sand.csv"; + ".*susp_Sand.*"; public static final String FRACTION_SUSP_SAND_BED = - "_bettbild_Anteil_susp_Sand.csv"; + ".*bettbild_Anteil_susp_Sand.*"; public static final String FRACTION_SUSP_SAND_BED_EPOCH = - "_susp_Sand_bettbildAnteil.csv"; + ".*susp_Sand_bettbildAnteil.*"; public static final String FRACTION_SUSPENDED_SEDIMENT = - "_Schwebstoff.csv"; + ".*Schwebstoff.*"; public static final String FRACTION_TOTAL = - "_gesamt.csv"; + ".*gesamt.*"; public static final Pattern TIMEINTERVAL_SINGLE = @@ -357,35 +357,33 @@ } } - log.warn("SYP: Unknow grain fraction: '" + gfStr + "'"); + log.warn("SYP: Unknown grain fraction: '" + gfStr + "'"); return null; } public static String getGrainFractionTypeName(String filename) { - if (filename.endsWith(FRACTION_COARSE_STR)) { - return GrainFraction.COARSE; + if (Pattern.matches(FRACTION_COARSE_STR, filename)) { + return GrainFraction.COARSE; } - else if (filename.endsWith(FRACTION_FINE_MIDDLE_STR)) { + else if (Pattern.matches(FRACTION_FINE_MIDDLE_STR, filename)) { return GrainFraction.FINE_MIDDLE; } - else if (filename.endsWith(FRACTION_SAND) && - !filename.endsWith(FRACTION_SUSP_SAND)) { + else if (Pattern.matches(FRACTION_SUSP_SAND_BED, filename) || + Pattern.matches(FRACTION_SUSP_SAND_BED_EPOCH, filename)) { + return GrainFraction.SUSP_SAND_BED; + } + else if (Pattern.matches(FRACTION_SUSP_SAND, filename)) { + return GrainFraction.SUSP_SAND; + } + else if (Pattern.matches(FRACTION_SAND, filename)) { return GrainFraction.SAND; } - else if (filename.endsWith(FRACTION_SUSP_SAND) && - !filename.endsWith(FRACTION_SUSP_SAND_BED)) { - return GrainFraction.SUSP_SAND; - } - else if (filename.endsWith(FRACTION_SUSP_SAND_BED) || - filename.endsWith(FRACTION_SUSP_SAND_BED_EPOCH)) { - return GrainFraction.SUSP_SAND_BED; - } - else if (filename.endsWith(FRACTION_SUSPENDED_SEDIMENT)) { + else if (Pattern.matches(FRACTION_SUSPENDED_SEDIMENT, filename)) { return GrainFraction.SUSPENDED_SEDIMENT; } - else if (filename.endsWith(FRACTION_TOTAL)) { + else if (Pattern.matches(FRACTION_TOTAL, filename)) { return GrainFraction.TOTAL; } else {