Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFacet.java @ 7357:9d3e44ab25f2
Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Idea is that Artifact and Access are lightweight. Access access the 'data'
('parameterization') attached to artifact, not the data delivered by means of
artifact and its parameterization.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 16 Oct 2013 10:42:45 +0200 |
parents | a0078e5e3b39 |
children | 793dfb2f4b7b |
comparison
equal
deleted
inserted
replaced
7356:534850c9fabc | 7357:9d3e44ab25f2 |
---|---|
11 import org.dive4elements.artifacts.Artifact; | 11 import org.dive4elements.artifacts.Artifact; |
12 import org.dive4elements.artifacts.CallContext; | 12 import org.dive4elements.artifacts.CallContext; |
13 import org.dive4elements.river.artifacts.D4EArtifact; | 13 import org.dive4elements.river.artifacts.D4EArtifact; |
14 import org.dive4elements.river.artifacts.access.BedHeightAccess; | 14 import org.dive4elements.river.artifacts.access.BedHeightAccess; |
15 import org.dive4elements.river.artifacts.model.BlackboardDataFacet; | 15 import org.dive4elements.river.artifacts.model.BlackboardDataFacet; |
16 import org.dive4elements.river.artifacts.model.minfo.BedHeight; | |
17 import org.dive4elements.river.artifacts.model.minfo.BedHeightFactory; | |
16 import org.dive4elements.river.artifacts.model.FacetTypes; | 18 import org.dive4elements.river.artifacts.model.FacetTypes; |
19 import org.dive4elements.river.model.BedHeightSingle; | |
20 import org.dive4elements.river.model.BedHeightSingleValue; | |
17 | 21 |
18 public class BedHeightFacet | 22 public class BedHeightFacet |
19 extends BlackboardDataFacet | 23 extends BlackboardDataFacet |
20 implements FacetTypes { | 24 implements FacetTypes { |
21 | 25 |
38 */ | 42 */ |
39 @Override | 43 @Override |
40 public Object getData(Artifact artifact, CallContext context) { | 44 public Object getData(Artifact artifact, CallContext context) { |
41 BedHeightAccess access = new BedHeightAccess((D4EArtifact)artifact); | 45 BedHeightAccess access = new BedHeightAccess((D4EArtifact)artifact); |
42 if (type.equals("singlevalues")) { | 46 if (type.equals("singlevalues")) { |
43 return access.getSingleValues(); | 47 /* Former doc (from BedHeightAccess): |
48 * Return a {@link List} of {@link BedHeightSingleValue}s | |
49 * at the range of the artifact | |
50 * @return List of {@link BedHeightSingleValue}s | |
51 */ | |
52 BedHeightSingle single = BedHeightSingle.getBedHeightSingleById( | |
53 access.getHeightId()); | |
54 return BedHeightSingleValue.getBedHeightSingleValues(single, | |
55 access.getFrom(), | |
56 access.getTo()); | |
44 } | 57 } |
45 return access.getHeight(); | 58 else { |
59 /* Former doc (from BedHeightAccess): | |
60 * Return the {@link BedHeight} at the height_id and time of the artifact | |
61 * @return {@link BedHeight} | |
62 */ | |
63 return BedHeightFactory.getHeight( | |
64 access.getType(), | |
65 access.getHeightId(), | |
66 access.getTime()); | |
67 } | |
46 } | 68 } |
69 | |
47 /** | 70 /** |
48 * Create a deep copy of this Facet. | 71 * Create a deep copy of this Facet. |
49 * @return a deep copy. | 72 * @return a deep copy. |
50 */ | 73 */ |
51 @Override | 74 @Override |