annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DataFacet.java @ 737:6b38b8488401

Fix for flys/issue86 flys-artifacts/trunk@2233 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 26 Jun 2011 13:07:44 +0000
parents 853dceead0f4
children c09c9e05ecfa
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;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 public DataFacet(String name, String description) {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 this(name, description, ComputeType.ADVANCE);
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 }
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 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
23 this(name, description, type, null);
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 }
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 public DataFacet(
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 String name,
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 String description,
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 ComputeType type,
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 String hash
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 ) {
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 super(name, description);
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 this.type = type;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 this.hash = hash;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 }
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 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
38 FLYSArtifact flys = (FLYSArtifact)artifact;
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 return flys.compute(
705
853dceead0f4 Only generate facets when needed.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 702
diff changeset
40 context, hash != null ? hash : flys.hash(), type, false);
702
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 }
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 }
32ed5d789e50 Add facet to access raw computed data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org