# HG changeset patch # User Andre Heinecke # Date 1408989645 -7200 # Node ID 58e3fed51e9edd29b2470329cbf142dea09a1323 # Parent fae48b3c09d196e6178dd7cc729a0a247aaabb2c GetFractionByName now returns a list as it can differ in Epochs One result can be calculated with multiple epochs. there is a todo in there to correctly split up the epochs in the facets. diff -r fae48b3c09d1 -r 58e3fed51e9e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFacet.java Mon Aug 25 19:59:14 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFacet.java Mon Aug 25 20:00:45 2014 +0200 @@ -110,12 +110,18 @@ SedimentLoadDataResult sdResult = (SedimentLoadDataResult) payload; - Fraction frac = sdResult.getFractionByName(fraction); - if (frac == null) { + List fractions = sdResult.getFractionsByName(fraction); + if (fractions == null) { logger.warn("No result for: " + fraction); + return null; } - return frac.getData(); + /* TODO handle multiple periods per fraction */ + if (fractions.size() > 1) { + logger.warn("Multiple periods not implemented."); + } + + return fractions.get(0).getData(); /* Are gaps neccessary now? for (int x = 0; x < values[0].length-1; x++) { diff -r fae48b3c09d1 -r 58e3fed51e9e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataResult.java Mon Aug 25 19:59:14 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataResult.java Mon Aug 25 20:00:45 2014 +0200 @@ -73,13 +73,14 @@ return fractions; } - public Fraction getFractionByName(String name) { + public List getFractionsByName(String name) { + List result = new ArrayList(); for (Fraction fraction: fractions) { if (fraction.getName().equals(name)) { - return fraction; + result.add(fraction); } } - return null; + return result.isEmpty() ? null : result; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :