comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 1095:f465785ed1ae

Refactored the code to fetch the km range/locations into a utility class. flys-artifacts/trunk@2598 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 26 Aug 2011 14:58:35 +0000
parents 139e7df1787c
children 29c67a76ad5d
comparison
equal deleted inserted replaced
1094:b1c6d945848d 1095:f465785ed1ae
5 5
6 import org.apache.log4j.Logger; 6 import org.apache.log4j.Logger;
7 7
8 import org.w3c.dom.Document; 8 import org.w3c.dom.Document;
9 9
10 import de.intevation.artifactdatabase.data.DefaultStateData;
11 import de.intevation.artifactdatabase.data.StateData;
10 import de.intevation.artifactdatabase.state.Facet; 12 import de.intevation.artifactdatabase.state.Facet;
11 import de.intevation.artifactdatabase.state.DefaultOutput; 13 import de.intevation.artifactdatabase.state.DefaultOutput;
12 import de.intevation.artifactdatabase.state.State; 14 import de.intevation.artifactdatabase.state.State;
13 import de.intevation.artifactdatabase.data.StateData;
14 15
15 import de.intevation.artifacts.Artifact; 16 import de.intevation.artifacts.Artifact;
16 import de.intevation.artifacts.ArtifactFactory; 17 import de.intevation.artifacts.ArtifactFactory;
17 import de.intevation.artifacts.CallMeta; 18 import de.intevation.artifacts.CallMeta;
18 import de.intevation.flys.artifacts.model.RiverFactory; 19
20 import de.intevation.flys.model.Gauge;
21 import de.intevation.flys.model.MainValue;
22 import de.intevation.flys.model.River;
19 23
20 import de.intevation.flys.artifacts.model.MainValuesQFacet; 24 import de.intevation.flys.artifacts.model.MainValuesQFacet;
21 import de.intevation.flys.artifacts.model.MainValuesWFacet; 25 import de.intevation.flys.artifacts.model.MainValuesWFacet;
22 import de.intevation.flys.artifacts.model.NamedDouble; 26 import de.intevation.flys.artifacts.model.NamedDouble;
23 import de.intevation.artifactdatabase.data.DefaultStateData; 27 import de.intevation.flys.artifacts.model.RiverFactory;
24 import de.intevation.flys.artifacts.states.StaticState; 28 import de.intevation.flys.artifacts.states.StaticState;
25 29 import de.intevation.flys.utils.FLYSUtils;
26 import de.intevation.flys.model.Gauge;
27 import de.intevation.flys.model.MainValue;
28 import de.intevation.flys.model.River;
29 30
30 31
31 /** 32 /**
32 * Artifact to access names of Points Of Interest along a segment of a river. 33 * Artifact to access names of Points Of Interest along a segment of a river.
33 * This artifact neglects (Static)FLYSArtifacts capabilities of interaction 34 * This artifact neglects (Static)FLYSArtifacts capabilities of interaction
72 73
73 @Override 74 @Override
74 protected void initialize(Artifact artifact, Object context, CallMeta meta) { 75 protected void initialize(Artifact artifact, Object context, CallMeta meta) {
75 logger.debug("MainValuesArtifact.initialize"); 76 logger.debug("MainValuesArtifact.initialize");
76 WINFOArtifact winfo = (WINFOArtifact) artifact; 77 WINFOArtifact winfo = (WINFOArtifact) artifact;
77 double location = winfo.getLocations()[0]; 78 double location = FLYSUtils.getLocations(winfo)[0];
78 addData("location", new DefaultStateData("location", null, null, 79 addData("location", new DefaultStateData("location", null, null,
79 String.valueOf(location))); 80 String.valueOf(location)));
80 addData("river", winfo.getData("river")); 81 addData("river", winfo.getData("river"));
81 } 82 }
82 83

http://dive4elements.wald.intevation.org