Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/AnnotationArtifact.java @ 8148:eb48b244921d
The rest is silence.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 27 Aug 2014 19:52:51 +0200 |
parents | 8d5ca5175038 |
children | e4606eae8ea5 |
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:
4497
diff
changeset
|
9 package org.dive4elements.river.artifacts; |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import java.util.ArrayList; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import java.util.List; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import org.w3c.dom.Document; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import org.w3c.dom.Element; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import org.apache.log4j.Logger; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
19 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
20 import org.dive4elements.artifacts.ArtifactFactory; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
21 import org.dive4elements.artifacts.ArtifactNamespaceContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
22 import org.dive4elements.artifacts.CallContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
23 import org.dive4elements.artifacts.CallMeta; |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
25 import org.dive4elements.artifactdatabase.ProtocolUtils; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
26 import org.dive4elements.artifactdatabase.state.Facet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
27 import org.dive4elements.artifactdatabase.state.FacetActivity; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
28 import org.dive4elements.artifactdatabase.state.Output; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
29 import org.dive4elements.artifactdatabase.state.State; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
30 import org.dive4elements.artifactdatabase.state.StateEngine; |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
32 import org.dive4elements.river.artifacts.model.FacetTypes; |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
34 import org.dive4elements.artifacts.common.utils.XMLUtils; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
35 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
36 import org.dive4elements.river.artifacts.states.DefaultState; |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
37 import org.dive4elements.river.artifacts.context.RiverContext; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
38 |
5865
73da40528cf2
River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
39 import org.dive4elements.river.utils.RiverUtils; |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 /** |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 * Artifact to access names of Points Of Interest along a segment of a river. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 */ |
4209
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
44 public class AnnotationArtifact |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
45 extends StaticD4EArtifact |
4209
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
46 implements FacetTypes { |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 /** The logger for this class. */ |
1675
19d0eb41e923
AnnotationArtifact: Bugfixes and enabled cache support.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1631
diff
changeset
|
49 private static Logger logger = Logger.getLogger(AnnotationArtifact.class); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 /** The name of the artifact. */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 public static final String ARTIFACT_NAME = "annotation"; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 |
4209
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
54 // Let Annotations enter life inactively if in Fix Analysis LS setting. |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
55 static { |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
56 FacetActivity.Registry.getInstance().register( |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
57 "annotation", |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
58 new FacetActivity() { |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
59 @Override |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
60 public Boolean isInitialActive( |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
61 Artifact artifact, |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
62 Facet facet, |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
63 String output |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
64 ) { |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
65 if (output.contains(FacetTypes.ChartType.FLSC.toString())) { |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
66 // Longitudinal section chart |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
67 String name = facet.getName(); |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
68 |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
69 if (name.contains(FacetTypes.LONGITUDINAL_ANNOTATION)) { |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
70 return Boolean.FALSE; |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
71 } |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
72 } |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
73 |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
74 return Boolean.TRUE; |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
75 } |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
76 }); |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
77 } |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
78 |
7d0fb0109c01
Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4049
diff
changeset
|
79 |
4015
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
80 @Override |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
81 public void setup( |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
82 String identifier, |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
83 ArtifactFactory factory, |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
84 Object context, |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
85 CallMeta callMeta, |
7842
8d5ca5175038
Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents:
5994
diff
changeset
|
86 Document data, |
8d5ca5175038
Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents:
5994
diff
changeset
|
87 List<Class> loadFacets) |
4015
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
88 { |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
89 logger.debug("AnnotationArtifact.setup"); |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
90 String filter = StaticD4EArtifact.getDatacageIDValue(data); |
4015
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
91 String[] splits = filter.split(":"); |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
92 if (splits.length > 1) { |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
93 addStringData("nameFilter", splits[1]); |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
94 } |
7842
8d5ca5175038
Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents:
5994
diff
changeset
|
95 super.setup(identifier, factory, context, callMeta, data, loadFacets); |
4015
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
96 } |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
97 |
4210
e47559908acc
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4209
diff
changeset
|
98 |
2112
2d0b22602fc2
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
99 /** Get river, setup Facets. */ |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 @Override |
1077
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1070
diff
changeset
|
101 protected void initialize(Artifact artifact, Object context, |
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1070
diff
changeset
|
102 CallMeta meta) { |
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1070
diff
changeset
|
103 logger.debug("AnnotationArtifact.initialize, id: " |
2112
2d0b22602fc2
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
104 + artifact.identifier()); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
105 |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
106 D4EArtifact flys = (D4EArtifact) artifact; |
4010
efb067ab2ca4
Added TODOs for issue880.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3555
diff
changeset
|
107 // TODO issue880: make annotations available _per type_ |
2112
2d0b22602fc2
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
108 importData(flys, "river"); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 List<Facet> fs = new ArrayList<Facet>(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 // TODO Add CallMeta (duplicate TODO in RiverAxisArtifact.java). |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 DefaultState state = (DefaultState) getCurrentState(context); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
114 state.computeInit(this, hash(), context, meta, fs); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 if (!fs.isEmpty()) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 logger.debug("Facets to add in AnnotationsArtifact.initialize ."); |
4497
a2735a4bf75e
Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4210
diff
changeset
|
118 addFacets(getCurrentStateId(), fs); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 else { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 logger.debug("No facets to add in AnnotationsArtifact.initialize ."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 |
4210
e47559908acc
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4209
diff
changeset
|
125 |
e47559908acc
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4209
diff
changeset
|
126 /** Shortcut to nameFilter-data (TODO: move to respective Access). */ |
4015
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
127 public String getFilterName() { |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
128 return getDataAsString("nameFilter"); |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
129 } |
7f8d92873d58
Handle annotationtypes in AnnotationArtifact and -Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4010
diff
changeset
|
130 |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 public double[] getDistance() { |
1032
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
133 /** TODO In initialize(), access maximal range of river (via |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2144
diff
changeset
|
134 * AnnotationFactory) instead of overriding getDistance, |
1032
abd2ab6dff4f
Let AnnotationArtifact fetch "more correct" data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1026
diff
changeset
|
135 * important for diagram generation. */ |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 return new double[] {0f, 1000f}; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 /** |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 * Create the description of this AnnotationArtifact-instance. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
142 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 * @param data Some data. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 * @param context The CallContext. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
145 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
146 * @return the description of this artifact. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
147 */ |
1070
b1ed0ec0236f
Smaller Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1055
diff
changeset
|
148 @Override |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 public Document describe(Document data, CallContext context) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 logger.debug("Describe: the current state is: " + getCurrentStateId()); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 if (logger.isDebugEnabled()) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 dumpArtifact(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 Document description = XMLUtils.newDocument(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 description, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 ArtifactNamespaceContext.NAMESPACE_URI, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
162 Element root = ProtocolUtils.createRootNode(creator); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 description.appendChild(root); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
164 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 State current = getCurrentState(context); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
167 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash()); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 ProtocolUtils.appendState(creator, root, current); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
170 Element name = ProtocolUtils.createArtNode( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 creator, "name", |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
172 new String[] { "value" }, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 new String[] { getName() }); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
175 Element outs = ProtocolUtils.createArtNode( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
176 creator, "outputmodes", null, null); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
177 appendOutputModes(description, outs, context); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
178 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 root.appendChild(name); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
180 root.appendChild(outs); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
181 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
182 return description; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
183 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
184 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
185 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
186 /** |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
187 * Returns the name of the concrete artifact. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
188 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
189 * @return the name of the concrete artifact. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
190 */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
191 public String getName() { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
192 return ARTIFACT_NAME; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
193 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
194 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
195 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
196 /** |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
197 * Append outputmode elements to given document. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
198 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
199 * @param doc Document to add outputmodes to. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
200 * @param outs Element to add outputmode elements to. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
201 * @param context The given CallContext (mostly for internationalization). |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
202 */ |
1070
b1ed0ec0236f
Smaller Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1055
diff
changeset
|
203 //@Override |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
204 protected void appendOutputModes( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
205 Document doc, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
206 Element outs, |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
207 CallContext context) |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
208 { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
209 List<String> stateIds = getPreviousStateIds(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
210 |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
211 RiverContext flysContext = RiverUtils.getFlysContext(context); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
212 StateEngine engine = (StateEngine) flysContext.get( |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
213 RiverContext.STATE_ENGINE_KEY); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
214 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
215 for (String stateId: stateIds) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
216 logger.debug("Append output modes for state: " + stateId); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
217 DefaultState state = (DefaultState) engine.getState(stateId); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
218 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
219 List<Output> list = state.getOutputs(); |
3555
b1912514e0f5
s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
220 if (list == null || list.isEmpty()) { |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
221 logger.debug("-> No output modes for this state."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
222 continue; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
223 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
224 |
4497
a2735a4bf75e
Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4210
diff
changeset
|
225 List<Facet> fs = getFacets(stateId); |
3555
b1912514e0f5
s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
226 if (fs == null || fs.isEmpty()) { |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
227 logger.debug("No facets found."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
228 continue; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
229 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
230 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
231 logger.debug("Found " + fs.size() + " facets in previous states."); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
232 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
233 List<Output> generated = generateOutputs(list, fs); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
234 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
235 ProtocolUtils.appendOutputModes(doc, outs, generated); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
236 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
237 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
238 try { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
239 DefaultState cur = (DefaultState) getCurrentState(context); |
1050
eccf966fb677
State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1033
diff
changeset
|
240 if (cur.validate(this)) { |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
241 List<Output> list = cur.getOutputs(); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
242 if (list != null && list.size() > 0) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
243 logger.debug( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
244 "Append output modes for state: " + cur.getID()); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
245 |
4497
a2735a4bf75e
Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4210
diff
changeset
|
246 List<Facet> fs = getFacets(cur.getID()); |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
247 if (fs != null && fs.size() > 0) { |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
248 List<Output> generated = generateOutputs(list, fs); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
249 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
250 logger.debug("Found " + fs.size() + " current facets."); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
251 if (!generated.isEmpty()) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
252 ProtocolUtils.appendOutputModes( |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
253 doc, outs, generated); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
254 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
255 else{ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
256 logger.debug("Cannot append output to generated document."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
257 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
258 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
259 else { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
260 logger.debug("No facets found for the current state."); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
261 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
262 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
263 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
264 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
265 catch (IllegalArgumentException iae) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
266 // state is not valid, so we do not append its outputs. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
267 } |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2144
diff
changeset
|
268 } |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
269 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
270 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |