annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DataFacet.java @ 1057:d4a5d3941cc0

Build out/facet filter from XML document passed at creation time. flys-artifacts/trunk@2527 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 22 Aug 2011 16:37:12 +0000
parents 3fd891d5228d
children b1b0a0b61845
rev   line source
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import de.intevation.artifacts.Artifact;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4 import de.intevation.artifacts.CallContext;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 import de.intevation.artifactdatabase.state.DefaultFacet;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 import de.intevation.flys.artifacts.FLYSArtifact;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 public class DataFacet
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 extends DefaultFacet
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 protected ComputeType type;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 protected String hash;
930
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
17 protected String stateId;
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 public DataFacet(String name, String description) {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 this(name, description, ComputeType.ADVANCE);
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 }
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 public DataFacet(String name, String description, ComputeType type) {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 this(name, description, type, null);
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 }
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 public DataFacet(
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 String name,
742
c09c9e05ecfa Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 705
diff changeset
29 String description,
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 ComputeType type,
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 String hash
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 ) {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 super(name, description);
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 this.type = type;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 this.hash = hash;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 }
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37
930
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
38
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
39 public DataFacet(
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
40 String name,
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
41 String description,
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
42 ComputeType type,
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
43 String hash,
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
44 String stateId
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
45 ) {
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
46 super(name, description);
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
47 this.type = type;
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
48 this.hash = hash;
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
49 this.stateId = stateId;
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
50 }
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
51
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 public Object getData(Artifact artifact, CallContext context) {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 FLYSArtifact flys = (FLYSArtifact)artifact;
930
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
54 String theHash = hash != null ? hash : flys.hash();
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
55
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
56 return stateId != null && stateId.length() > 0
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
57 ? flys.compute(context, stateId, theHash, type, false)
3fd891d5228d The DataFacets are now able to store the ID of the create which created them.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 742
diff changeset
58 : flys.compute(context, theHash, type, false);
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 }
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 }
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org