annotate 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
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4826
diff changeset
9 package org.dive4elements.river.artifacts.model.minfo;
3614
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4826
diff changeset
11 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4826
diff changeset
12 import org.dive4elements.artifacts.CallContext;
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
13 import org.dive4elements.river.artifacts.D4EArtifact;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4826
diff changeset
14 import org.dive4elements.river.artifacts.access.BedHeightAccess;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4826
diff changeset
15 import org.dive4elements.river.artifacts.model.BlackboardDataFacet;
7357
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
16 import org.dive4elements.river.artifacts.model.minfo.BedHeight;
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
17 import org.dive4elements.river.artifacts.model.minfo.BedHeightFactory;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4826
diff changeset
18 import org.dive4elements.river.artifacts.model.FacetTypes;
7357
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
19 import org.dive4elements.river.model.BedHeightSingle;
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
20 import org.dive4elements.river.model.BedHeightSingleValue;
3614
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 public class BedHeightFacet
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 extends BlackboardDataFacet
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 implements FacetTypes {
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25
4534
1619f80eb62e Add type member variable to BedHeightFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3633
diff changeset
26 private String type;
3633
ebfce31c7eec Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3614
diff changeset
27
4534
1619f80eb62e Add type member variable to BedHeightFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3633
diff changeset
28 public BedHeightFacet(String name, String description, String type) {
3614
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 this.name = name;
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 this.description = description;
4534
1619f80eb62e Add type member variable to BedHeightFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3633
diff changeset
31 this.type = type;
3614
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 this.index = 0;
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 }
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 /**
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 * Returns the data this facet requires.
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 *
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 * @param artifact the owner artifact.
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 * @param context the CallContext (ignored).
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 *
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 * @return the data.
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 */
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 @Override
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 public Object getData(Artifact artifact, CallContext context) {
6101
a0078e5e3b39 Removed unused context from RangeAccess and subclasses leading to some dead code removal.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
45 BedHeightAccess access = new BedHeightAccess((D4EArtifact)artifact);
4534
1619f80eb62e Add type member variable to BedHeightFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3633
diff changeset
46 if (type.equals("singlevalues")) {
7357
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
47 /* Former doc (from BedHeightAccess):
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
48 * Return a {@link List} of {@link BedHeightSingleValue}s
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
49 * at the range of the artifact
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
50 * @return List of {@link BedHeightSingleValue}s
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
51 */
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
52 BedHeightSingle single = BedHeightSingle.getBedHeightSingleById(
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
53 access.getHeightId());
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
54 return BedHeightSingleValue.getBedHeightSingleValues(single,
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
55 access.getFrom(),
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
56 access.getTo());
4534
1619f80eb62e Add type member variable to BedHeightFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3633
diff changeset
57 }
7357
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
58 else {
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
59 /* Former doc (from BedHeightAccess):
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
60 * Return the {@link BedHeight} at the height_id and time of the artifact
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
61 * @return {@link BedHeight}
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
62 */
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
63 return BedHeightFactory.getHeight(
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
64 access.getType(),
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
65 access.getHeightId(),
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
66 access.getTime());
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
67 }
3614
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 }
7357
9d3e44ab25f2 Refactoring: Move functionality of BedHeightAccess into BedHeightFacet for now.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6101
diff changeset
69
3614
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 /**
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 * Create a deep copy of this Facet.
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 * @return a deep copy.
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 */
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 @Override
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 public BedHeightFacet deepCopy() {
4534
1619f80eb62e Add type member variable to BedHeightFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3633
diff changeset
76 BedHeightFacet copy = new BedHeightFacet(name, description, type);
3614
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 copy.set(this);
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 return copy;
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 }
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 }
68beaa827751 MINFO: Implemented UI and facet/artifact stack for bed height differences.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org