9499
|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
|
2 * Software engineering by |
|
3 * Björnsen Beratende Ingenieure GmbH |
|
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
|
5 * |
|
6 * This file is Free Software under the GNU AGPL (>=v3) |
|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
8 * documentation coming with Dive4Elements River for details. |
|
9 */ |
|
10 package org.dive4elements.river.artifacts.model; |
|
11 |
|
12 import java.util.List; |
|
13 |
|
14 import org.apache.log4j.Logger; |
|
15 import org.dive4elements.artifacts.CallContext; |
|
16 import org.dive4elements.artifacts.DataProvider; |
|
17 import org.dive4elements.river.model.FastCrossSectionLine; |
|
18 |
|
19 /** |
|
20 * @author Domenico Nardi Tironi |
|
21 */ |
|
22 public final class CrossSectionFacetUtils { |
|
23 |
|
24 private static Logger log = Logger.getLogger(CrossSectionFacetUtils.class); |
|
25 |
|
26 private CrossSectionFacetUtils() { |
|
27 throw new UnsupportedOperationException(); |
|
28 } |
|
29 |
|
30 public static DataProvider getDataProvider(final CallContext context) { |
|
31 |
|
32 final List<DataProvider> providers = context.getDataProvider(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA); |
|
33 if (providers.size() < 1) { |
|
34 log.warn("Could not find Cross-Section data provider."); |
|
35 return null; |
|
36 } |
|
37 |
|
38 return providers.get(0); |
|
39 } |
|
40 |
|
41 public static FastCrossSectionLine getCrossSection(final DataProvider provider, final CallContext context) { |
|
42 |
|
43 if (provider == null) |
|
44 return null; |
|
45 |
|
46 return (FastCrossSectionLine) provider.provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA, null, context); |
|
47 } |
|
48 } |