Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java @ 3818:dc18457b1cef
merged flys-artifacts/pre2.7-2012-03-16
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:59 +0200 |
parents | e2124ca11adb |
children | 5642a83420f2 |
comparison
equal
deleted
inserted
replaced
2456:60ab1054069d | 3818:dc18457b1cef |
---|---|
1 package de.intevation.flys.artifacts; | |
2 | |
3 import java.util.ArrayList; | |
4 import java.util.List; | |
5 | |
6 import org.apache.log4j.Logger; | |
7 | |
8 import org.w3c.dom.Document; | |
9 | |
10 import de.intevation.artifactdatabase.state.Facet; | |
11 | |
12 import de.intevation.artifacts.Artifact; | |
13 import de.intevation.artifacts.ArtifactFactory; | |
14 import de.intevation.artifacts.CallMeta; | |
15 | |
16 import de.intevation.flys.artifacts.model.FacetTypes; | |
17 | |
18 import de.intevation.flys.artifacts.states.DefaultState; | |
19 | |
20 | |
21 | |
22 /** | |
23 * Artifact to store user-added points. | |
24 */ | |
25 public class ManualPointsArtifact | |
26 extends StaticFLYSArtifact | |
27 implements FacetTypes | |
28 { | |
29 /** The logger for this class. */ | |
30 private static Logger logger = Logger.getLogger(ManualPointsArtifact.class); | |
31 | |
32 /** The name of the artifact. */ | |
33 public static final String ARTIFACT_NAME = "manualpoints"; | |
34 | |
35 | |
36 /** | |
37 * Trivial Constructor. | |
38 */ | |
39 public ManualPointsArtifact() { | |
40 logger.debug("ManualPointsArtifact.ManualPointsArtifact()"); | |
41 } | |
42 | |
43 | |
44 /** | |
45 * Gets called from factory, to set things up. | |
46 */ | |
47 @Override | |
48 public void setup( | |
49 String identifier, | |
50 ArtifactFactory factory, | |
51 Object context, | |
52 CallMeta callMeta, | |
53 Document data) | |
54 { | |
55 logger.debug("ManualPointsArtifact.setup"); | |
56 super.setup(identifier, factory, context, callMeta, data); | |
57 initialize(null, context, callMeta); | |
58 } | |
59 | |
60 | |
61 /** Return the name of this artifact. */ | |
62 public String getName() { | |
63 return ARTIFACT_NAME; | |
64 } | |
65 | |
66 | |
67 /** Access state data storing the jsonstring with points. */ | |
68 public String getPointsData(String facetName) { | |
69 return getDataAsString(facetName + ".data"); | |
70 } | |
71 | |
72 | |
73 /** Setup state and facet. */ | |
74 @Override | |
75 protected void initialize(Artifact artifact, Object context, CallMeta meta) { | |
76 logger.debug("ManualPointsArtifact.initialize"); | |
77 List<Facet> fs = new ArrayList<Facet>(); | |
78 | |
79 DefaultState state = (DefaultState) getCurrentState(context); | |
80 state.computeInit(this, hash(), context, meta, fs); | |
81 if (!fs.isEmpty()) { | |
82 logger.debug("Facets to add in ManualPointsArtifact.initialize ."); | |
83 facets.put(getCurrentStateId(), fs); | |
84 } | |
85 else { | |
86 logger.debug("No facets to add in ManualPointsArtifact.initialize (" | |
87 + state.getID() + ")."); | |
88 } | |
89 } | |
90 | |
91 | |
92 /** | |
93 * Determines Facets initial disposition regarding activity (think of | |
94 * selection in Client ThemeList GUI). This will be checked one time | |
95 * when the facet enters a collections describe document. | |
96 * | |
97 * @param facetName name of the facet. | |
98 * @param index index of the facet. | |
99 * @return 0 if not active | |
100 */ | |
101 @Override | |
102 public int getInitialFacetActivity( | |
103 String outputName, | |
104 String facetName, | |
105 int index) | |
106 { | |
107 return 1; | |
108 } | |
109 } | |
110 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |