annotate flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 1948:65f9d707caff

Removed superfluous imports. flys-artifacts/trunk@3340 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 30 Nov 2011 12:06:32 +0000
parents 8c0e9d13d1fc
children 37a7b3841565
rev   line source
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.collections;
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
3 import java.io.IOException;
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
4 import java.io.OutputStream;
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
5 import java.util.ArrayList;
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import java.util.Date;
638
9c565eb46f06 Fixed the process of creating and storing the attribute of a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
7 import java.util.HashMap;
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
8 import java.util.List;
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
9 import java.util.Map;
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import javax.xml.xpath.XPathConstants;
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.apache.log4j.Logger;
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.w3c.dom.Document;
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import org.w3c.dom.Element;
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import org.w3c.dom.Node;
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
18 import org.w3c.dom.NodeList;
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
20 import de.intevation.artifacts.Artifact;
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
21 import de.intevation.artifacts.ArtifactDatabase;
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
22 import de.intevation.artifacts.ArtifactDatabaseException;
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import de.intevation.artifacts.ArtifactNamespaceContext;
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 import de.intevation.artifacts.CallContext;
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
25 import de.intevation.artifacts.CallMeta;
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
27 import de.intevation.artifacts.common.utils.ClientProtocolUtils;
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 import de.intevation.artifacts.common.utils.XMLUtils;
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
30 import de.intevation.artifactdatabase.Backend;
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
31 import de.intevation.artifactdatabase.Backend.PersistentArtifact;
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 import de.intevation.artifactdatabase.DefaultArtifactCollection;
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
33 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
34 import de.intevation.artifactdatabase.state.StateEngine;
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
36 import de.intevation.flys.artifacts.context.FLYSContext;
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
37 import de.intevation.flys.artifacts.FLYSArtifact;
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
38 import de.intevation.flys.artifacts.model.ManagedFacet;
1717
755a890ecf0e FLYSArtifactCollection.ThemeList makes now use of ManagedDomFacet to read all attributes of a Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1715
diff changeset
39 import de.intevation.flys.artifacts.model.ManagedDomFacet;
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
40 import de.intevation.flys.exports.OutGenerator;
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
41 import de.intevation.flys.themes.Theme;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
42 import de.intevation.flys.themes.ThemeFactory;
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
43
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
44 import de.intevation.flys.utils.FLYSUtils;
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 /**
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 */
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 public class FLYSArtifactCollection extends DefaultArtifactCollection {
1013
73330e89b0af Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 971
diff changeset
50 /** The logger used in this class. */
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 private static Logger log = Logger.getLogger(FLYSArtifactCollection.class);
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
1013
73330e89b0af Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 971
diff changeset
53 /** Constant XPath that points to the outputmodes of an artifact. */
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 public static final String XPATH_ARTIFACT_OUTPUTMODES =
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 "/art:result/art:outputmodes";
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
57 public static final String XPATH_COLLECTION_ITEMS =
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
58 "/art:result/art:artifact-collection/art:collection-item";
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
59
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
60 public static final String XPATH_OUT_NAME = "/art:action/@art:name";
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
61
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
62 public static final String XPATH_OUT_TYPE = "/art:action/@art:type";
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
63
1780
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
64 /** Xpath to master artifacts uuid. */
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
65 public static final String XPATH_MASTER_UUID =
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
66 "/art:artifact-collection/art:artifact/@art:uuid";
1744
62efd1288e34 Fix setting of masterartifact in flyscollections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1718
diff changeset
67
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
68 public static final String XPATH_LOADED_RECOMMENDATIONS =
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
69 "/art:attribute/art:loaded-recommendations";
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
70
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
71
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
72 /**
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
73 * Return description Document for this collection.
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
74 */
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 @Override
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 public Document describe(CallContext context) {
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 log.debug("FLYSArtifactCollection.describe: " + identifier);
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 Document doc = XMLUtils.newDocument();
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 doc,
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 ArtifactNamespaceContext.NAMESPACE_URI,
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 ArtifactNamespaceContext.NAMESPACE_PREFIX);
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 Date creationTime = getCreationTime();
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 String creation = creationTime != null
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 ? Long.toString(creationTime.getTime())
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 : "";
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 Element collection = ec.create("artifact-collection");
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 Element artifacts = ec.create("artifacts");
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 ec.addAttr(collection, "name", getName(), true);
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 ec.addAttr(collection, "uuid", identifier(), true);
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 ec.addAttr(collection, "creation", creation, true);
713
dc3a8c45349b Put the time-to-live of the collection into its DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
97 ec.addAttr(collection, "ttl", String.valueOf(getTTL()), true);
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 collection.appendChild(artifacts);
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 doc.appendChild(collection);
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
102 ArtifactDatabase db = context.getDatabase();
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
103 Document oldAttrs = getAttribute();
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
104
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
105 try {
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
106 String[] aUUIDs = getArtifactUUIDs(context);
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
107 Node newAttr = mergeAttributes(db, context, oldAttrs, aUUIDs);
638
9c565eb46f06 Fixed the process of creating and storing the attribute of a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
108
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
109 collection.appendChild(doc.importNode(newAttr, true));
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
110
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
111 // Make it an empty array if null.
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
112 if (aUUIDs == null) {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
113 aUUIDs = new String[] {};
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
114 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
115
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
116 for (String uuid: aUUIDs) {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
117 try {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
118 artifacts.appendChild(
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
119 buildArtifactNode(db, uuid, context, ec));
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
120 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
121 catch (ArtifactDatabaseException dbe) {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
122 log.warn(dbe, dbe);
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
123 }
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
124 }
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
125 }
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
126 catch (ArtifactDatabaseException ade) {
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
127 log.error(ade, ade);
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
128
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
129 collection.appendChild(
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
130 doc.importNode(oldAttrs.getFirstChild(), true));
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 }
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 return doc;
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 }
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
137 /**
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
138 * Merge the current art:outputs nodes with the the outputs provided by the
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
139 * artifacts in the Collection.
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
140 *
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
141 * @param uuids Artifact uuids.
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
142 */
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
143 protected Node mergeAttributes(
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
144 ArtifactDatabase db,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
145 CallContext context,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
146 Document oldAttrs,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
147 String[] uuids)
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
148 {
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
149 Document doc = buildOutAttributes(db, context, oldAttrs, uuids);
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
150 Node newAttr = doc.getFirstChild();
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
151
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
152 newAttr = mergeLoadedRecommendations(oldAttrs, newAttr);
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
153
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
154 try {
1013
73330e89b0af Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 971
diff changeset
155 // Save the merged document into database.
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
156 db.setCollectionAttribute(identifier(), context.getMeta(), doc);
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
157 }
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
158 catch (ArtifactDatabaseException adb) {
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
159 log.error(adb, adb);
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
160 }
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
161
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
162 return newAttr;
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
163 }
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
164
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
165
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
166 /**
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
167 * Merge the recommendations which have already been loaded from the old
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
168 * attribute document into the new attribute document. This is necessary,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
169 * because mergeAttributes() only merges the art:outputs nodes - all
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
170 * other nodes are skiped.
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
171 */
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
172 protected Node mergeLoadedRecommendations(Document oldAttrs, Node newAttrs){
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
173 Element loadedRecoms = (Element) XMLUtils.xpath(
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
174 oldAttrs,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
175 XPATH_LOADED_RECOMMENDATIONS,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
176 XPathConstants.NODE,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
177 ArtifactNamespaceContext.INSTANCE);
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
178
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
179 if (loadedRecoms != null) {
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
180 Document doc = newAttrs.getOwnerDocument();
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
181 newAttrs.appendChild(doc.importNode(loadedRecoms, true));
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
182 }
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
183
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
184 return newAttrs;
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
185 }
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
186
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
187
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
188 @Override
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
189 public void out(
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
190 String type,
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
191 Document format,
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
192 OutputStream out,
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
193 CallContext context)
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
194 throws IOException
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
195 {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
196 log.info("FLYSArtifactCollection.out");
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
197
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
198 String name = XMLUtils.xpathString(
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
199 format, XPATH_OUT_NAME, ArtifactNamespaceContext.INSTANCE);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
200
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
201 String subtype = XMLUtils.xpathString(
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
202 format, XPATH_OUT_TYPE, ArtifactNamespaceContext.INSTANCE);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
203
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
204 log.info("-> Output name = " + name);
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
205 log.info("-> Output type = " + type);
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
206 log.info("-> Output subtype = " + subtype);
388
cc6840cbe503 Introduced an export output target on collection level that enables collections to be exported.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 372
diff changeset
207
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
208 OutGenerator generator = null;
1780
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
209 if (type != null
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
210 && type.length() > 0
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
211 && type.indexOf("chartinfo") > 0)
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
212 {
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
213 generator = getOutGenerator(context, type, subtype);
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
214 }
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
215 else {
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
216 generator = getOutGenerator(context, name, subtype);
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
217 }
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
218
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
219 if (generator == null) {
390
a67748ad4d61 Modified a confusing debug statement.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 388
diff changeset
220 log.error("There is no generator specified for output: " + name);
1013
73330e89b0af Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 971
diff changeset
221 // TODO Throw an exception.
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
222
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
223 return;
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
224 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
225
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
226 generator.init(format, out, context);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
227
1744
62efd1288e34 Fix setting of masterartifact in flyscollections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1718
diff changeset
228 // Get master artifact.
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
229 FLYSArtifact master = getMasterArtifact(context);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
230 if (master != null) {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
231 log.debug("Will set master Artifact to uuid: " + master.identifier());
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
232 generator.setMasterArtifact(master);
1780
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
233 }
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
234 else {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
235 log.warn("Could not set master artifact.");
1744
62efd1288e34 Fix setting of masterartifact in flyscollections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1718
diff changeset
236 }
412
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 390
diff changeset
237
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
238 try {
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
239 Document attr = getAttribute(context, name);
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
240 doOut(generator, name, subtype, attr, context);
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
241 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
242 catch (ArtifactDatabaseException adbe) {
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
243 log.error(adbe, adbe);
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
244 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
245 }
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
246
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
247
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
248 /**
1029
3f3988bb6284 Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1013
diff changeset
249 * Creates the concrete output.
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
250 *
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
251 * @param generator The OutGenerator that creates the output.
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
252 * @param outputName The name of the requested output.
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
253 * @param attributes The collection's attributes for this concrete output
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
254 * type.
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
255 * @param context The context object.
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
256 */
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
257 protected void doOut(
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
258 OutGenerator generator,
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
259 String outName,
388
cc6840cbe503 Introduced an export output target on collection level that enables collections to be exported.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 372
diff changeset
260 String facet,
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
261 Document attributes,
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
262 CallContext context)
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
263 throws IOException
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
264 {
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
265 log.info("FLYSArtifactCollection.doOut: " + outName);
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
266
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
267 ThemeList themeList = new ThemeList(attributes);
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
268
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
269 int size = themeList.size();
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
270 log.debug("Output will contain " + size + " elements.");
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
271
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
272 List<ArtifactAndFacet> dataProviders =
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
273 doBlackboardPass(themeList, context);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
274
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
275 try {
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
276 for (int i = 0; i < size; i++) {
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
277 ManagedFacet theme = themeList.get(i);
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
278
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
279 if (theme == null) {
370
4a8d934e745f Bugfix: Changed the datastructure of the ThemeList (inner class of FLYSArtifactCollection) to store the theme of a chart in an ordered list -> Q curves of longitudinal section charts are now drawn.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
280 log.debug("Theme is empty - no output is generated.");
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
281 continue;
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
282 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
283
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
284 String art = theme.getArtifact();
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
285 String facetName = theme.getName();
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
286
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
287 if (log.isDebugEnabled()) {
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
288 log.debug("Do output for...");
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
289 log.debug("... artifact: " + art);
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
290 log.debug("... facet: " + facetName);
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
291 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
292
388
cc6840cbe503 Introduced an export output target on collection level that enables collections to be exported.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 372
diff changeset
293 if (outName.equals("export") && !facetName.equals(facet)) {
cc6840cbe503 Introduced an export output target on collection level that enables collections to be exported.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 372
diff changeset
294 continue;
cc6840cbe503 Introduced an export output target on collection level that enables collections to be exported.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 372
diff changeset
295 }
cc6840cbe503 Introduced an export output target on collection level that enables collections to be exported.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 372
diff changeset
296
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
297 generator.doOut(
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
298 dataProviders.get(i),
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
299 getFacetThemeFromAttribute(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
300 art,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
301 outName,
364
8830eecad69e Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 353
diff changeset
302 facetName,
1747
d2a17e990c70 Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1744
diff changeset
303 theme.getDescription(),
1668
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
304 theme.getIndex(),
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1668
diff changeset
305 context),
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1668
diff changeset
306 theme.getActive() == 1);
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
307 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
308 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
309 catch (ArtifactDatabaseException ade) {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
310 log.error(ade, ade);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
311 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
312
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
313 generator.generate();
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
314 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
315
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
316
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
317 /**
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
318 * Show blackboard (context) to each facet and create a list of
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
319 * ArtifactAndFacets on the fly (with the same ordering as the passed
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
320 * ThemeList).
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
321 * @param themeList ThemeList to create a ArtifactAndFacetList along.
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
322 * @param contect The "Blackboard".
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
323 */
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
324 protected List<ArtifactAndFacet> doBlackboardPass(
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
325 ThemeList themeList, CallContext context
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
326 ) {
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
327 ArrayList<ArtifactAndFacet> dataProviders =
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
328 new ArrayList<ArtifactAndFacet>();
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
329 int size = themeList.size();
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
330
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
331 try {
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
332 // Collect all ArtifactAndFacets for blackboard pass.
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
333 for (int i = 0; i < size; i++) {
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
334 ManagedFacet theme = themeList.get(i);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
335 String uuid = theme.getArtifact();
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
336 Artifact artifact = getArtifact(uuid, context);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
337 FLYSArtifact flys = (FLYSArtifact) artifact;
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
338 ArtifactAndFacet artifactAndFacet = new ArtifactAndFacet(artifact,
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
339 flys.getNativeFacet(theme));
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
340
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
341 // Show blackboard to facet.
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
342 artifactAndFacet.register(context);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
343
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
344 // Add to themes.
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
345 dataProviders.add(i, artifactAndFacet);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
346 }
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
347 }
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
348 catch (ArtifactDatabaseException ade) {
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
349 log.error("ArtifactDatabaseException!", ade);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
350 }
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
351
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
352 return dataProviders;
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
353 }
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
354
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
355 /**
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
356 * @return masterartifact or null if exception/not found.
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
357 */
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
358 protected FLYSArtifact getMasterArtifact(CallContext context)
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
359 {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
360 try {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
361 ArtifactDatabase db = context.getDatabase();
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
362 CallMeta callMeta = context.getMeta();
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
363 Document document = db.getCollectionsMasterArtifact(
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
364 identifier(), callMeta);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
365
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
366 String masterUUID = XMLUtils.xpathString(
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
367 document, XPATH_MASTER_UUID, ArtifactNamespaceContext.INSTANCE);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
368 FLYSArtifact masterArtifact =
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
369 (FLYSArtifact) getArtifact(masterUUID, context);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
370 return masterArtifact;
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
371 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
372 catch (ArtifactDatabaseException ade) {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
373 log.error(ade, ade);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
374 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
375 return null;
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
376 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
377
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
378
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
379 /**
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
380 * Return merged output document.
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
381 * @param uuids List of artifact uuids.
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
382 */
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
383 protected Document buildOutAttributes(
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
384 ArtifactDatabase db,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
385 CallContext context,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
386 Document oldAttr,
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
387 String[] uuids)
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
388 {
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
389 Document doc = XMLUtils.newDocument();
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
390
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
391 FLYSContext flysContext = FLYSUtils.getFlysContext(context);
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
392 StateEngine engine = (StateEngine) flysContext.get(
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
393 FLYSContext.STATE_ENGINE_KEY);
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
394
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
395 FLYSArtifact masterArtifact = getMasterArtifact(context);
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
396
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
397 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
398 doc,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
399 ArtifactNamespaceContext.NAMESPACE_URI,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
400 ArtifactNamespaceContext.NAMESPACE_PREFIX);
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
401
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
402 AttributeParser aParser = new AttributeParser();
944
c256061287d7 Simplified the code to read all provided Outputs of an Artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 713
diff changeset
403 OutputParser oParser = new OutputParser(db, context);
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
404
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
405 if (uuids != null) {
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
406 for (String uuid: uuids) {
1175
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
407 try {
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
408 oParser.parse(uuid);
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
409 }
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
410 catch (ArtifactDatabaseException ade) {
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
411 log.warn(ade, ade);
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
412 }
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
413 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
414 }
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
415
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
416 aParser.parse(oldAttr);
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
417
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
418 return new AttributeWriter(
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
419 db,
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
420 aParser.getOuts(),
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
421 aParser.getFacets(),
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
422 oParser.getOuts(),
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
423 oParser.getFacets(),
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
424 engine.getCompatibleFacets(masterArtifact.getStateHistoryIds())
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
425 ).write();
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
426 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
427
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
428
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
429 /**
1780
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
430 * Returns the "attribute" (part of description document) for a specific
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
431 * output type.
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
432 *
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
433 * @param output The name of the desired output type.
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
434 *
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
435 * @return the attribute for the desired output type.
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
436 */
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
437 protected Document getAttribute(CallContext context, String output)
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
438 throws ArtifactDatabaseException
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
439 {
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
440 Document attr = buildOutAttributes(
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
441 context.getDatabase(),
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
442 context,
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
443 getAttribute(),
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
444 getArtifactUUIDs(context));
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
445
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
446 Node out = (Node) XMLUtils.xpath(
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
447 attr,
638
9c565eb46f06 Fixed the process of creating and storing the attribute of a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
448 "art:attribute/art:outputs/art:output[@name='" + output + "']",
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
449 XPathConstants.NODE,
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
450 ArtifactNamespaceContext.INSTANCE);
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
451
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
452
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
453 if (out != null) {
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
454 Document o = XMLUtils.newDocument();
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
455
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
456 o.appendChild(o.importNode(out, true));
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
457
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
458 return o;
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
459 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
460
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
461 return null;
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
462 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
463
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
464
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
465 /**
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
466 * This method returns the list of artifact UUIDs that this collections
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
467 * contains.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
468 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
469 * @param context The CallContext that is necessary to get information about
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
470 * the ArtifactDatabase.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
471 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
472 * @return a list of uuids.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
473 */
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
474 protected String[] getArtifactUUIDs(CallContext context)
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
475 throws ArtifactDatabaseException
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
476 {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
477 log.debug("FLYSArtifactCollection.getArtifactUUIDs");
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
478
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
479 ArtifactDatabase db = context.getDatabase();
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
480 CallMeta meta = context.getMeta();
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
481
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
482 Document itemList = db.listCollectionArtifacts(identifier(), meta);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
483 NodeList items = (NodeList) XMLUtils.xpath(
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
484 itemList,
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
485 XPATH_COLLECTION_ITEMS,
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
486 XPathConstants.NODESET,
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
487 ArtifactNamespaceContext.INSTANCE);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
488
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
489 if (items == null || items.getLength() == 0) {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
490 log.debug("No artifacts found in this collection.");
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
491 return null;
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
492 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
493
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
494 int num = items.getLength();
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
495
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
496 List<String> uuids = new ArrayList<String>(num);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
497
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
498 for (int i = 0; i < num; i++) {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
499 String uuid = XMLUtils.xpathString(
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
500 items.item(i),
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
501 "@art:uuid",
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
502 ArtifactNamespaceContext.INSTANCE);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
503
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
504 if (uuid != null && uuid.trim().length() != 0) {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
505 uuids.add(uuid);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
506 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
507 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
508
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
509 return (String[]) uuids.toArray(new String[uuids.size()]);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
510 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
511
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
512
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
513 /**
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
514 * Returns a concrete Artifact of this collection specified by its uuid.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
515 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
516 * @param uuid The Artifact's uuid.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
517 * @param context The CallContext.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
518 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
519 * @return an Artifact.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
520 */
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
521 protected Artifact getArtifact(String uuid, CallContext context)
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
522 throws ArtifactDatabaseException
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
523 {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
524 log.debug("FLYSArtifactCollection.getArtifact");
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
525
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
526 Backend backend = Backend.getInstance();
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
527 PersistentArtifact persistent = backend.getArtifact(uuid);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
528
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
529 return persistent != null ? persistent.getArtifact() : null;
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
530 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
531
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
532
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
533 /**
1822
6ed439ff61bf Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1785
diff changeset
534 * Returns the attribute that belongs to an artifact and facet stored in
6ed439ff61bf Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1785
diff changeset
535 * this collection.
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
536 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
537 * @param uuid The Artifact's uuid.
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
538 * @param outname The name of the requested output.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
539 * @param facet The name of the requested facet.
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
540 * @param context The CallContext.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
541 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
542 * @return an attribute in form of a document.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
543 */
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
544 protected Document getFacetThemeFromAttribute(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
545 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
546 String outName,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
547 String facet,
1747
d2a17e990c70 Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1744
diff changeset
548 String pattern,
1668
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
549 int index,
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
550 CallContext context)
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
551 throws ArtifactDatabaseException
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
552 {
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
553 log.debug("FLYSArtifactCollection.getFacetThemeFromAttribute");
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
554
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
555 ArtifactDatabase db = context.getDatabase();
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
556 CallMeta meta = context.getMeta();
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
557
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
558 FLYSContext flysContext = context instanceof FLYSContext
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
559 ? (FLYSContext) context
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
560 : (FLYSContext) context.globalContext();
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
561
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
562 Document attr = db.getCollectionItemAttribute(identifier(), uuid, meta);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
563
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
564 if (attr == null) {
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
565 attr = initItemAttribute(uuid, facet, pattern, index, outName, context);
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
566
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
567 if (attr == null) {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
568 return null;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
569 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
570 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
571
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
572 log.debug("Search attribute of collection item: " + uuid);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
573
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
574 Node tmp = (Node) XMLUtils.xpath(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
575 attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
576 "/art:attribute",
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
577 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
578 ArtifactNamespaceContext.INSTANCE);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
579
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
580 if (tmp == null) {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
581 log.warn("No attribute found. Operation failed.");
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
582 return null;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
583 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
584
1747
d2a17e990c70 Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1744
diff changeset
585 log.debug("Search theme for facet '" + facet + "' in attribute.");
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
586
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
587 Node theme = (Node) XMLUtils.xpath(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
588 tmp,
1668
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
589 "art:themes/theme[@facet='" + facet +
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
590 "' and @index='" + String.valueOf(index) + "']",
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
591 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
592 ArtifactNamespaceContext.INSTANCE);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
593
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
594 if (theme == null) {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
595 log.warn("Could not find the theme in attribute of: " + uuid);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
596
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
597 Theme t = getThemeForFacet(
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
598 uuid, facet, pattern, index, outName, context);
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
599
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
600 if (t == null) {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
601 log.warn("No theme found for facet: " + facet);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
602 return null;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
603 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
604
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
605 addThemeToAttribute(uuid, attr, t, context);
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
606 theme = t.toXML().getFirstChild();
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
607 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
608
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
609 Document doc = XMLUtils.newDocument();
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
610 doc.appendChild(doc.importNode(theme, true));
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
611
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
612 return doc;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
613 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
614
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
615
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
616 /**
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
617 * Adds the theme of a facet to a CollectionItem's attribute.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
618 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
619 * @param uuid The uuid of the artifact.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
620 * @param attr The current attribute of an artifact.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
621 * @param t The theme to add.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
622 * @param context The CallContext.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
623 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
624 protected void addThemeToAttribute(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
625 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
626 Document attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
627 Theme t,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
628 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
629 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
630 log.debug("FLYSArtifactCollection.addThemeToAttribute: " + uuid);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
631
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
632 if (t == null) {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
633 log.warn("Theme is empty - cancel adding it to attribute!");
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
634 return;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
635 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
636
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
637 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
638 attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
639 ArtifactNamespaceContext.NAMESPACE_URI,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
640 ArtifactNamespaceContext.NAMESPACE_PREFIX);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
641
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
642 Node tmp = (Node) XMLUtils.xpath(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
643 attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
644 "/art:attribute",
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
645 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
646 ArtifactNamespaceContext.INSTANCE);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
647
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
648 if (tmp == null) {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
649 tmp = ec.create("attribute");
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
650 attr.appendChild(tmp);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
651 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
652
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
653 Node themes = (Node) XMLUtils.xpath(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
654 tmp,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
655 "art:themes",
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
656 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
657 ArtifactNamespaceContext.INSTANCE);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
658
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
659 if (themes == null) {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
660 themes = ec.create("themes");
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
661 tmp.appendChild(themes);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
662 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
663
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
664 themes.appendChild(attr.importNode(t.toXML().getFirstChild(), true));
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
665
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
666 try {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
667 setCollectionItemAttribute(uuid, attr, context);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
668
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
669 log.debug("Successfully added theme to item attribute.");
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
670 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
671 catch (ArtifactDatabaseException e) {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
672 // do nothing
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
673 log.warn("Cannot set attribute of item: " + uuid);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
674 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
675 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
676
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
677
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
678 /**
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
679 * Initializes the attribute of an collection item with the theme of a
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
680 * specific facet.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
681 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
682 * @param uuid The uuid of an artifact.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
683 * @param facet The name of a facet.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
684 * @param context The CallContext.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
685 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
686 * @param the new attribute.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
687 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
688 protected Document initItemAttribute(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
689 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
690 String facet,
1747
d2a17e990c70 Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1744
diff changeset
691 String pattern,
1668
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
692 int index,
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
693 String outName,
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
694 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
695 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
696 log.info("FLYSArtifactCollection.initItemAttribute");
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
697
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
698 Theme t = getThemeForFacet(uuid, facet, pattern, index, outName, context);
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
699
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
700 if (t == null) {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
701 log.info("Could not find theme for facet. Cancel initialization.");
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
702 return null;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
703 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
704
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
705 Document attr = XMLUtils.newDocument();
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
706
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
707 addThemeToAttribute(uuid, attr, t, context);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
708
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
709 return attr;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
710 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
711
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
712
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
713 /**
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
714 * Sets the attribute of a CollectionItem specified by <i>uuid</i> to a new
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
715 * value <i>attr</i>.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
716 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
717 * @param uuid The uuid of the CollectionItem.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
718 * @param attr The new attribute for the CollectionItem.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
719 * @param context The CallContext.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
720 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
721 public void setCollectionItemAttribute(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
722 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
723 Document attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
724 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
725 throws ArtifactDatabaseException
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
726 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
727 Document doc = ClientProtocolUtils.newSetItemAttributeDocument(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
728 uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
729 attr);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
730
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
731 if (doc == null) {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
732 log.warn("Cannot set item attribute: No attribute found.");
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
733 return;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
734 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
735
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
736 ArtifactDatabase db = context.getDatabase();
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
737 CallMeta meta = context.getMeta();
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
738
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
739 db.setCollectionItemAttribute(identifier(), uuid, doc, meta);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
740 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
741
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
742
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
743 /**
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
744 * Returns the theme of a specific facet.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
745 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
746 * @param uuid The uuid of an artifact.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
747 * @param facet The name of the facet.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
748 * @param context The CallContext object.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
749 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
750 * @return the desired theme.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
751 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
752 protected Theme getThemeForFacet(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
753 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
754 String facet,
1747
d2a17e990c70 Improved the Themes: we now support special themes for facets which need to match a given pattern string.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1744
diff changeset
755 String pattern,
1668
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
756 int index,
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
757 String outName,
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
758 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
759 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
760 log.info("FLYSArtifactCollection.getThemeForFacet: " + facet);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
761
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
762 FLYSContext flysContext = context instanceof FLYSContext
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
763 ? (FLYSContext) context
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
764 : (FLYSContext) context.globalContext();
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
765
1822
6ed439ff61bf Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1785
diff changeset
766 // Push artifact in flysContext.
6ed439ff61bf Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1785
diff changeset
767 ArtifactDatabase db = context.getDatabase();
6ed439ff61bf Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1785
diff changeset
768 try {
6ed439ff61bf Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1785
diff changeset
769 FLYSArtifact artifact = (FLYSArtifact) db.getRawArtifact(uuid);
6ed439ff61bf Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1785
diff changeset
770 log.debug("Got raw artifact");
6ed439ff61bf Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1785
diff changeset
771 flysContext.put(flysContext.ARTIFACT_KEY, artifact);
6ed439ff61bf Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1785
diff changeset
772 }
1837
0585bf8af41b Catch more specific Exception in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1828
diff changeset
773 catch (ArtifactDatabaseException dbe) {
0585bf8af41b Catch more specific Exception in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1828
diff changeset
774 log.error("Exception caught when trying to get art.", dbe);
1822
6ed439ff61bf Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1785
diff changeset
775 }
6ed439ff61bf Changed theme-mapping mechanism to include further condition (on master-artifacts attributes), added point themes for longitudinal.ws for calculations at locations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1785
diff changeset
776
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
777 Theme t = ThemeFactory.getTheme(flysContext, facet, pattern, outName);
1668
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
778
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
779 if (t != null) {
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
780 t.setFacet(facet);
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
781 t.setIndex(index);
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
782 }
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
783
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
784 return t;
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
785 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
786
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
787
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
788 /**
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
789 * Returns the OutGenerator for a specified <i>type</i>.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
790 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
791 * @param name The name of the output type.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
792 * @param type Defines the type of the desired OutGenerator.
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
793 *
1029
3f3988bb6284 Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1013
diff changeset
794 * @return Instance of an OutGenerator for specified <i>type</i>.
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
795 */
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
796 protected OutGenerator getOutGenerator(
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
797 CallContext context,
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
798 String name,
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
799 String type)
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
800 {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
801 FLYSContext flysContext = context instanceof FLYSContext
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
802 ? (FLYSContext) context
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
803 : (FLYSContext) context.globalContext();
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
804
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
805 Map<String, Class> generators = (Map<String, Class>)
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
806 flysContext.get(FLYSContext.OUTGENERATORS_KEY);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
807
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
808 if (generators == null) {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
809 log.error("No output generators found in the running application!");
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
810 return null;
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
811 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
812
388
cc6840cbe503 Introduced an export output target on collection level that enables collections to be exported.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 372
diff changeset
813 Class clazz = generators.get(name);
300
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
814
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
815 try {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
816 return clazz != null ? (OutGenerator) clazz.newInstance() : null;
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
817 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
818 catch (InstantiationException ie) {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
819 log.error(ie, ie);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
820 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
821 catch (IllegalAccessException iae) {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
822 log.error(iae, iae);
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
823 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
824
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
825 return null;
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
826 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
827
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
828
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
829 protected Element buildArtifactNode(
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
830 ArtifactDatabase database,
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
831 String uuid,
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
832 CallContext context,
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
833 XMLUtils.ElementCreator ec)
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
834 throws ArtifactDatabaseException
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
835 {
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
836 log.debug("Append artifact '" + uuid + "' to collection description");
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
837
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
838 // TODO
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
839 String hash = "MYHASH";
156
d03b8bbeb853 Added the hash code of an artifact to the artifact part of the collection's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 148
diff changeset
840
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
841 Element ci = ec.create("artifact");
148
2649ada6b053 Bugfix: Added a missing artifact namespace prefix in the DESCRIBE document of a FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 147
diff changeset
842 ec.addAttr(ci, "uuid", uuid, true);
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
843 ec.addAttr(ci, "hash", hash, true);
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
844
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
845 // XXX I am not sure if it works well every time with an empty document
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
846 // in the describe operation of an artifact.
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
847 Document description = database.describe(uuid, null, context.getMeta());
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
848
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
849 Node outputModes = (Node) XMLUtils.xpath(
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
850 description,
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
851 XPATH_ARTIFACT_OUTPUTMODES,
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
852 XPathConstants.NODE,
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
853 ArtifactNamespaceContext.INSTANCE);
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
854
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
855 if (outputModes != null) {
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
856 Document doc = ci.getOwnerDocument();
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
857 ci.appendChild(doc.importNode(outputModes, true));
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
858 }
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
859
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
860 return ci;
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
861 }
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
862
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
863
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
864 /**
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
865 * Inner class to structure/order the themes of a chart.
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
866 */
1718
defe2cfeefa5 FLYSArtifactCollection: Small optimizations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1717
diff changeset
867 private static class ThemeList {
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
868 private Logger logger = Logger.getLogger(ThemeList.class);
638
9c565eb46f06 Fixed the process of creating and storing the attribute of a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
869 protected Map<Integer, ManagedFacet> themes;
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
870
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
871 public ThemeList(Document output) {
638
9c565eb46f06 Fixed the process of creating and storing the attribute of a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
872 themes = new HashMap<Integer, ManagedFacet>();
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
873 parse(output);
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
874 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
875
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
876 protected void parse(Document output) {
1717
755a890ecf0e FLYSArtifactCollection.ThemeList makes now use of ManagedDomFacet to read all attributes of a Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1715
diff changeset
877 NodeList themeList = (NodeList) XMLUtils.xpath(
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
878 output,
945
59ae2a823e73 Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 944
diff changeset
879 "art:output/art:facet",
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
880 XPathConstants.NODESET,
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
881 ArtifactNamespaceContext.INSTANCE);
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
882
1717
755a890ecf0e FLYSArtifactCollection.ThemeList makes now use of ManagedDomFacet to read all attributes of a Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1715
diff changeset
883 int num = themeList != null ? themeList.getLength() : 0;
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
884
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
885 logger.debug("Output has " + num + " elements.");
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
886
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
887 if (num == 0) {
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
888 return;
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
889 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
890
694
68c6c75a6f7c Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 649
diff changeset
891 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
892
694
68c6c75a6f7c Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 649
diff changeset
893 for (int i = 0; i < num; i++) {
1717
755a890ecf0e FLYSArtifactCollection.ThemeList makes now use of ManagedDomFacet to read all attributes of a Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1715
diff changeset
894 Element theme = (Element) themeList.item(i);
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
895
1717
755a890ecf0e FLYSArtifactCollection.ThemeList makes now use of ManagedDomFacet to read all attributes of a Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1715
diff changeset
896 ManagedDomFacet facet = new ManagedDomFacet(theme);
1718
defe2cfeefa5 FLYSArtifactCollection: Small optimizations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1717
diff changeset
897 themes.put(Integer.valueOf(facet.getPosition()-1), facet);
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
898 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
899 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
900
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
901 public ManagedFacet get(int idx) {
1718
defe2cfeefa5 FLYSArtifactCollection: Small optimizations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1717
diff changeset
902 return themes.get(Integer.valueOf(idx));
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
903 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
904
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
905 public int size() {
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
906 return themes.size();
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
907 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
908 }
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
909 }
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
910 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org