annotate artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java @ 8264:4d99606a844e

SQ relation overview is now a single chart containing all fractions. * Added new facet types. * Add new facets for the overview chart. * Removed generator code for the old overview.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 12 Sep 2014 14:55:42 +0200
parents c87c87544cc6
children 994995baa32b
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: 4433
diff changeset
9 package org.dive4elements.river.exports;
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 import java.io.IOException;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 import java.util.ArrayList;
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
13 import java.util.Collections;
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 import java.util.HashMap;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 import java.util.List;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 import java.util.Map;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 import javax.xml.xpath.XPathConstants;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 import org.apache.log4j.Logger;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 import org.w3c.dom.Document;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 import org.w3c.dom.Element;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 import org.w3c.dom.Node;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 import org.w3c.dom.NodeList;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25
8221
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
26 import org.dive4elements.artifacts.ContextInjector;
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
27
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
28 import org.dive4elements.artifactdatabase.Backend;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
29 import org.dive4elements.artifactdatabase.Backend.PersistentArtifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
30 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
31 import org.dive4elements.artifactdatabase.state.Facet;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
32 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
33 import org.dive4elements.artifacts.ArtifactDatabase;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
34 import org.dive4elements.artifacts.ArtifactDatabaseException;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
35 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
36 import org.dive4elements.artifacts.CallMeta;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
37 import org.dive4elements.artifacts.common.ArtifactNamespaceContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
38 import org.dive4elements.artifacts.common.utils.ClientProtocolUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
39 import org.dive4elements.artifacts.common.utils.XMLUtils;
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
40 import org.dive4elements.river.artifacts.D4EArtifact;
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
41 import org.dive4elements.river.artifacts.context.RiverContext;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
42 import org.dive4elements.river.artifacts.model.ManagedDomFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
43 import org.dive4elements.river.artifacts.model.ManagedFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
44 import org.dive4elements.river.themes.Theme;
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6564
diff changeset
45 import org.dive4elements.river.themes.ThemeDocument;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4433
diff changeset
46 import org.dive4elements.river.themes.ThemeFactory;
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 public class OutputHelper {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7254
diff changeset
49 /** The log used in this class. */
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 private static Logger log = Logger.getLogger(OutputHelper.class);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 protected String identifier;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 public OutputHelper(String identifier) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 this.identifier = identifier;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 }
8221
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
57
8254
c87c87544cc6 Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8225
diff changeset
58 private static List<ContextInjector> getContextInjectors(CallContext context, String out) {
8221
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
59 RiverContext flysContext = context instanceof RiverContext
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
60 ? (RiverContext)context
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
61 : (RiverContext)context.globalContext();
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
62
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
63 GeneratorLookup generators =
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
64 (GeneratorLookup)flysContext.get(RiverContext.OUTGENERATORS_KEY);
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
65
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
66 if (generators == null) {
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
67 return null;
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
68 }
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
69
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
70 GeneratorLookup.Item item = generators.getGenerator(out);
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
71 return item != null
8254
c87c87544cc6 Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8225
diff changeset
72 ? item.getContextInjectors()
8221
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
73 : null;
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
74 }
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 /**
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 * Creates a concrete output.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 *
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 * @param generator The OutGenerator that creates the output.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 * @param outputName The name of the requested output.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 * @param attributes The collection's attributes for this concrete output
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 * type.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 * @param context The context object.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 */
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 public void doOut(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 OutGenerator generator,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 String outName,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 String facet,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 Document attributes,
8225
724081af301c Pass request document to the context injectors.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8223
diff changeset
89 CallContext context,
724081af301c Pass request document to the context injectors.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8223
diff changeset
90 Document request
724081af301c Pass request document to the context injectors.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8223
diff changeset
91 ) throws IOException {
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 boolean debug = log.isDebugEnabled();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 if (debug) {
6564
42856353a222 OutputHelper: Fix misleading debug output copy/pasted from D4EArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6140
diff changeset
95 log.debug("OutputHelper.doOut: " + outName);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 ThemeList themeList = new ThemeList(attributes);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6564
diff changeset
100 ThemeDocument themeDoc = new ThemeDocument(attributes);
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6564
diff changeset
101
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 List<ArtifactAndFacet> dataProviders =
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
103 doBlackboardPass(themeList, context, outName);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104
8254
c87c87544cc6 Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8225
diff changeset
105 List<ContextInjector> cis = getContextInjectors(context, outName);
8221
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
106
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 try {
7254
fe32a7f9655e Reduce usage of careless 'for (int i = 0; i < x.size(); i++)' pattern.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6905
diff changeset
108 for (int i = 0, T = themeList.size(); i < T; i++) {
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 ManagedFacet theme = themeList.get(i);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 if (theme == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 log.debug("Theme is empty - no output is generated.");
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 continue;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 String art = theme.getArtifact();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 String facetName = theme.getName();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 if (debug) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 log.debug("Do output for...");
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 log.debug("... artifact: " + art);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 log.debug("... facet: " + facetName);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 if (outName.equals("export") && !facetName.equals(facet)) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 continue;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 // Skip invisible themes.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 if (theme.getVisible() == 0) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131 continue;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133
8254
c87c87544cc6 Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8225
diff changeset
134 if (cis != null) {
c87c87544cc6 Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8225
diff changeset
135 for (ContextInjector ci: cis) {
c87c87544cc6 Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8225
diff changeset
136 ci.injectContext(
c87c87544cc6 Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8225
diff changeset
137 context, dataProviders.get(i).getArtifact(), request);
c87c87544cc6 Made call context injectors a list of comma separated classes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8225
diff changeset
138 }
8221
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
139 }
a0994a326e2a Call context inspector in output helper.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8202
diff changeset
140
8264
4d99606a844e SQ relation overview is now a single chart containing all fractions.
Raimund Renkert <rrenkert@intevation.de>
parents: 8254
diff changeset
141 generator.doOut(
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 dataProviders.get(i),
8264
4d99606a844e SQ relation overview is now a single chart containing all fractions.
Raimund Renkert <rrenkert@intevation.de>
parents: 8254
diff changeset
143 getFacetThemeFromAttribute(
4d99606a844e SQ relation overview is now a single chart containing all fractions.
Raimund Renkert <rrenkert@intevation.de>
parents: 8254
diff changeset
144 art,
4d99606a844e SQ relation overview is now a single chart containing all fractions.
Raimund Renkert <rrenkert@intevation.de>
parents: 8254
diff changeset
145 outName,
4d99606a844e SQ relation overview is now a single chart containing all fractions.
Raimund Renkert <rrenkert@intevation.de>
parents: 8254
diff changeset
146 facetName,
4d99606a844e SQ relation overview is now a single chart containing all fractions.
Raimund Renkert <rrenkert@intevation.de>
parents: 8254
diff changeset
147 theme.getDescription(),
4d99606a844e SQ relation overview is now a single chart containing all fractions.
Raimund Renkert <rrenkert@intevation.de>
parents: 8254
diff changeset
148 theme.getIndex(),
4d99606a844e SQ relation overview is now a single chart containing all fractions.
Raimund Renkert <rrenkert@intevation.de>
parents: 8254
diff changeset
149 context),
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 theme.getActive() == 1);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 catch (ArtifactDatabaseException ade) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 log.error(ade, ade);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 /**
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158 * Returns the attribute that belongs to an artifact and facet stored in
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
159 * this collection.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160 *
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 * @param uuid The Artifact's uuid.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 * @param outname The name of the requested output.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 * @param facet The name of the requested facet.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 * @param context The CallContext.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165 *
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 * @return an attribute in form of a document.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 */
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6564
diff changeset
168 protected ThemeDocument getFacetThemeFromAttribute(
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 String uuid,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 String outName,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 String facet,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172 String pattern,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 int index,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 CallContext context)
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175 throws ArtifactDatabaseException
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176 {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 boolean debug = log.isDebugEnabled();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 if (debug) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 log.debug(
6564
42856353a222 OutputHelper: Fix misleading debug output copy/pasted from D4EArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6140
diff changeset
181 "OutputHelper.getFacetThemeFromAttribute(facet="
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 + facet + ", index=" + index + ")");
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 ArtifactDatabase db = context.getDatabase();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 CallMeta meta = context.getMeta();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 Document attr = db.getCollectionItemAttribute(identifier, uuid, meta);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 if (attr == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 attr = initItemAttribute(uuid, facet, pattern, index, outName, context);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 if (attr == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 return null;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 if (debug) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199 log.debug("Search attribute of collection item: " + uuid);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
202 Node tmp = (Node) XMLUtils.xpath(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203 attr,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 "/art:attribute",
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
205 XPathConstants.NODE,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
206 ArtifactNamespaceContext.INSTANCE);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 if (tmp == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 log.warn("No attribute found. Operation failed.");
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
210 return null;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
211 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
212
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213 if (debug) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
214 log.debug("Search theme for facet '" + facet + "' in attribute.");
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
216
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
217 Map<String, String> vars = new HashMap<String, String>();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
218 vars.put("facet", facet);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
219 vars.put("index", String.valueOf(index));
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
220
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
221 Node theme = (Node) XMLUtils.xpath(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
222 tmp,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
223 "art:themes/theme[@facet=$facet and @index=$index]",
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
224 XPathConstants.NODE,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
225 ArtifactNamespaceContext.INSTANCE,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
226 vars);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
227
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
228 if (theme == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
229 log.warn("Could not find the theme in attribute of: " + facet + " " + uuid);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
230
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
231 Theme t = getThemeForFacet(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
232 uuid, facet, pattern, index, outName, context);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
233
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
234 if (t == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
235 log.warn("No theme found for facet: " + facet);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
236 return null;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
237 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
238
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
239 addThemeToAttribute(uuid, attr, t, context);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
240 theme = t.toXML().getFirstChild();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
241 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
242
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
243 Document doc = XMLUtils.newDocument();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
244 doc.appendChild(doc.importNode(theme, true));
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
245
6905
1b35b2ddfc28 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6564
diff changeset
246 return new ThemeDocument(doc);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
247 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
248 /**
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
249 * Adds the theme of a facet to a CollectionItem's attribute.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
250 *
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
251 * @param uuid The uuid of the artifact.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
252 * @param attr The current attribute of an artifact.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
253 * @param t The theme to add.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
254 * @param context The CallContext.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
255 */
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
256 protected void addThemeToAttribute(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
257 String uuid,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
258 Document attr,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
259 Theme t,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
260 CallContext context)
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
261 {
6564
42856353a222 OutputHelper: Fix misleading debug output copy/pasted from D4EArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6140
diff changeset
262 log.debug("OutputHelper.addThemeToAttribute: " + uuid);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
263
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
264 if (t == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
265 log.warn("Theme is empty - cancel adding it to attribute!");
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
266 return;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
267 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
268
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
269 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
270 attr,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
271 ArtifactNamespaceContext.NAMESPACE_URI,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
272 ArtifactNamespaceContext.NAMESPACE_PREFIX);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
273
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
274 Node tmp = (Node) XMLUtils.xpath(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
275 attr,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
276 "/art:attribute",
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
277 XPathConstants.NODE,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
278 ArtifactNamespaceContext.INSTANCE);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
279
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
280 if (tmp == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
281 tmp = ec.create("attribute");
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
282 attr.appendChild(tmp);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
283 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
284
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
285 Node themes = (Node) XMLUtils.xpath(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
286 tmp,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
287 "art:themes",
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
288 XPathConstants.NODE,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
289 ArtifactNamespaceContext.INSTANCE);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
290
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
291 if (themes == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
292 themes = ec.create("themes");
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
293 tmp.appendChild(themes);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
294 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
296 themes.appendChild(attr.importNode(t.toXML().getFirstChild(), true));
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
297
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
298 try {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
299 setCollectionItemAttribute(uuid, attr, context);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
300 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
301 catch (ArtifactDatabaseException e) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
302 // do nothing
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
303 log.warn("Cannot set attribute of item: " + uuid);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
304 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
305 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
306
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
307 /**
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
308 * Sets the attribute of a CollectionItem specified by <i>uuid</i> to a new
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
309 * value <i>attr</i>.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
310 *
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
311 * @param uuid The uuid of the CollectionItem.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
312 * @param attr The new attribute for the CollectionItem.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
313 * @param context The CallContext.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
314 */
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
315 public void setCollectionItemAttribute(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
316 String uuid,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
317 Document attr,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
318 CallContext context)
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
319 throws ArtifactDatabaseException
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
320 {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
321 Document doc = ClientProtocolUtils.newSetItemAttributeDocument(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
322 uuid,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
323 attr);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
324
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
325 if (doc == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
326 log.warn("Cannot set item attribute: No attribute found.");
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
327 return;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
328 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
329
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
330 ArtifactDatabase db = context.getDatabase();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
331 CallMeta meta = context.getMeta();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
332
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
333 db.setCollectionItemAttribute(identifier, uuid, doc, meta);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
334 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
335
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
336
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
337 /**
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
338 * Show blackboard (context) to each facet and create a list of
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
339 * ArtifactAndFacets on the fly (with the same ordering as the passed
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
340 * ThemeList).
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
341 * @param themeList ThemeList to create a ArtifactAndFacetList along.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
342 * @param context The "Blackboard".
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
343 */
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
344 protected List<ArtifactAndFacet> doBlackboardPass(
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
345 ThemeList themeList, CallContext context, String outname
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
346 ) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
347 ArrayList<ArtifactAndFacet> dataProviders =
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
348 new ArrayList<ArtifactAndFacet>();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
349
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
350 try {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
351 // Collect all ArtifactAndFacets for blackboard pass.
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
352 for (int i = 0; i < themeList.size(); i++) {
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
353 log.debug("BLackboard pass for: " + outname);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
354 ManagedFacet theme = themeList.get(i);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
355 if (theme == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
356 log.warn("A ManagedFacet in ThemeList is null.");
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
357 themeList.remove(i);
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
358 i--;
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
359 continue;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
360 }
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
361
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
362 String uuid = theme.getArtifact();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
363 Artifact artifact = getArtifact(uuid, context);
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
364 D4EArtifact flys = (D4EArtifact) artifact;
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
365 Facet face = flys.getNativeFacet(theme, outname);
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
366 log.debug("Looking for Native Facet for theme: " + theme + " and out: " +
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
367 outname + " in artifact: " + uuid +
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
368 face == null ? " Found. " : " Not Found. ");
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
369 if (face == null) {
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
370 log.warn("Theme " + theme.getName() + " for " + outname + " has no facets!. Removing theme.");
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
371 themeList.remove(i);
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
372 i--;
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
373 continue;
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
374 }
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
375
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
376 ArtifactAndFacet artifactAndFacet = new ArtifactAndFacet(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
377 artifact,
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
378 face);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
379
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
380 // XXX HELP ME PLEASE
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
381 artifactAndFacet.setFacetDescription(theme.getDescription());
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
382
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
383 // Show blackboard to facet.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
384 artifactAndFacet.register(context);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
385
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
386 // Add to themes.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
387 dataProviders.add(i, artifactAndFacet);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
388 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
389 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
390 catch (ArtifactDatabaseException ade) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
391 log.error("ArtifactDatabaseException!", ade);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
392 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
393
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
394 return dataProviders;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
395 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
396 /**
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
397 * Returns a concrete Artifact of this collection specified by its uuid.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
398 *
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
399 * @param uuid The Artifact's uuid.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
400 * @param context The CallContext.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
401 *
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
402 * @return an Artifact.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
403 */
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
404 protected Artifact getArtifact(String uuid, CallContext context)
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
405 throws ArtifactDatabaseException
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
406 {
6564
42856353a222 OutputHelper: Fix misleading debug output copy/pasted from D4EArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6140
diff changeset
407 log.debug("OutputHelper.getArtifact");
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
408
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
409 Backend backend = Backend.getInstance();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
410 PersistentArtifact persistent = backend.getArtifact(uuid);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
411
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
412 return persistent != null ? persistent.getArtifact() : null;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
413 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
414
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
415 /**
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
416 * Initializes the attribute of an collection item with the theme of a
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
417 * specific facet.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
418 *
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
419 * @param uuid The uuid of an artifact.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
420 * @param facet The name of a facet.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
421 * @param context The CallContext.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
422 *
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
423 * @param the new attribute.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
424 */
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
425 protected Document initItemAttribute(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
426 String uuid,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
427 String facet,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
428 String pattern,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
429 int index,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
430 String outName,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
431 CallContext context)
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
432 {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
433 boolean debug = log.isDebugEnabled();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
434
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
435 if (debug) {
6564
42856353a222 OutputHelper: Fix misleading debug output copy/pasted from D4EArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6140
diff changeset
436 log.debug("OutputHelper.initItemAttribute");
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
437 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
438
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
439 Theme t = getThemeForFacet(uuid, facet, pattern, index, outName, context);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
440
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
441 if (t == null) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
442 log.info("Could not find theme for facet. Cancel initialization.");
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
443 return null;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
444 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
445
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
446 Document attr = XMLUtils.newDocument();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
447 addThemeToAttribute(uuid, attr, t, context);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
448
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
449 if (debug) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
450 log.debug("initItemAttribute for facet " + facet + ": "
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
451 + XMLUtils.toString(attr));
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
452 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
453
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
454 return attr;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
455 }
3299
d76a889bc30d Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3295
diff changeset
456
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
457 /**
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
458 * Returns the theme of a specific facet.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
459 *
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
460 * @param uuid The uuid of an artifact.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
461 * @param facet The name of the facet.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
462 * @param context The CallContext object.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
463 *
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
464 * @return the desired theme.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
465 */
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
466 protected Theme getThemeForFacet(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
467 String uuid,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
468 String facet,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
469 String pattern,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
470 int index,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
471 String outName,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
472 CallContext context)
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
473 {
6564
42856353a222 OutputHelper: Fix misleading debug output copy/pasted from D4EArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6140
diff changeset
474 log.info("OutputHelper.getThemeForFacet: " + facet);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
475
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
476 RiverContext flysContext = context instanceof RiverContext
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
477 ? (RiverContext) context
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
478 : (RiverContext) context.globalContext();
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
479
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
480 // Push artifact in flysContext.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
481 ArtifactDatabase db = context.getDatabase();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
482 try {
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5866
diff changeset
483 D4EArtifact artifact = (D4EArtifact) db.getRawArtifact(uuid);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
484 log.debug("Got raw artifact");
5866
9a6741ccf6d4 FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
485 flysContext.put(RiverContext.ARTIFACT_KEY, artifact);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
486 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
487 catch (ArtifactDatabaseException dbe) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
488 log.error("Exception caught when trying to get art.", dbe);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
489 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
490
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
491 Theme t = ThemeFactory.getTheme(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
492 flysContext,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
493 facet,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
494 pattern,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
495 outName,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
496 "default");
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
497
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
498 if (t != null) {
3781
8e713e9bb4d7 Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3304
diff changeset
499 log.debug("found theme for facet '" + facet + "'");
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
500 t.setFacet(facet);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
501 t.setIndex(index);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
502 }
3781
8e713e9bb4d7 Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3304
diff changeset
503 else {
8e713e9bb4d7 Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3304
diff changeset
504 log.warn("unable to find theme for facet '" + facet + "'");
8e713e9bb4d7 Defined colors for bed quality themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3304
diff changeset
505 }
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
506
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
507 return t;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
508 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
509
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
510 /**
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
511 * Inner class to structure/order the themes of a chart.
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
512 */
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
513 private static class ThemeList {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7254
diff changeset
514 private Logger log = Logger.getLogger(ThemeList.class);
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
515 protected List<ManagedFacet> themes;
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
516
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
517 public ThemeList(Document output) {
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
518 themes = new ArrayList<ManagedFacet>();
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
519 parse(output);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
520 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
521
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
522 protected void parse(Document output) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
523 NodeList themeList = (NodeList) XMLUtils.xpath(
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
524 output,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
525 "art:output/art:facet",
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
526 XPathConstants.NODESET,
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
527 ArtifactNamespaceContext.INSTANCE);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
528
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
529 int num = themeList != null ? themeList.getLength() : 0;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
530
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7254
diff changeset
531 log.debug("Output has " + num + " elements.");
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
532
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
533 if (num == 0) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
534 return;
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
535 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
536
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
537 for (int i = 0; i < num; i++) {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
538 Element theme = (Element) themeList.item(i);
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
539
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
540 ManagedDomFacet facet = new ManagedDomFacet(theme);
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
541 themes.add(facet);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
542 }
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
543
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
544 Collections.sort(themes);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
545 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
546
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
547 public ManagedFacet get(int idx) {
4255
670e98f5a441 Fixed leak while merging facets.
Ingo Weinzierl <weinzierl.ingo@googlemail.com>
parents: 4049
diff changeset
548 return themes.get(idx);
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
549 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
550
6140
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
551 public void remove(int idx) {
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
552 themes.remove(idx);
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
553 }
60b94dec104b Add handling of bound artifacts.
Andre Heinecke <aheinecke@intevation.de>
parents: 5994
diff changeset
554
3295
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
555 public int size() {
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
556 return themes.size();
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
557 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
558 }
4fc442f1b4f6 Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
559 }
3304
02d5731b43a2 SQ relation: Build a valid SQResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3299
diff changeset
560 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org