annotate flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 1979:a7c437c9547e

Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing. flys-artifacts/trunk@3409 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 14 Dec 2011 10:20:56 +0000
parents 0b466bd4ab24
children 158b3aabda2c
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;
638
9c565eb46f06 Fixed the process of creating and storing the attribute of a collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
6 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
7 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
8 import java.util.Map;
1979
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
9 import java.util.Set;
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;
1979
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
34 import de.intevation.artifactdatabase.state.Output;
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
35 import de.intevation.artifactdatabase.state.Settings;
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
36 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
37
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
38 import de.intevation.flys.artifacts.context.FLYSContext;
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
39 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
40 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
41 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
42 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
43 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
44 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
45
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
46 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
47
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 * @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
50 */
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 public class FLYSArtifactCollection extends DefaultArtifactCollection {
1013
73330e89b0af Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 971
diff changeset
52 /** 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
53 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
54
1013
73330e89b0af Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 971
diff changeset
55 /** 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
56 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
57 "/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
58
1950
37a7b3841565 Include state data items in description document of collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1948
diff changeset
59 public static final String XPATH_ARTIFACT_STATE_DATA =
37a7b3841565 Include state data items in description document of collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1948
diff changeset
60 "/art:result/art:ui/art:static/art:state/art:data";
37a7b3841565 Include state data items in description document of collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1948
diff changeset
61
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
62 public static final String XPATH_COLLECTION_ITEMS =
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
63 "/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
64
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
65 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
66
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
67 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
68
1780
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
69 /** Xpath to master artifacts uuid. */
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
70 public static final String XPATH_MASTER_UUID =
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
71 "/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
72
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
73 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
74 "/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
75
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
76
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
77 /**
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
78 * Return description Document for this collection.
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
79 */
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 @Override
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 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
82 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
83
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
84 CollectionDescriptionHelper helper = new CollectionDescriptionHelper(
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
85 getName(), identifier(), getCreationTime(), getTTL(),
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
86 context);
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
88 ArtifactDatabase db = context.getDatabase();
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
89
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
90 Document oldAttrs = getAttribute();
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
91 AttributeParser parser = new AttributeParser(oldAttrs);
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
92
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
93 try {
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
94 String[] aUUIDs = getArtifactUUIDs(context);
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
95 CollectionAttribute newAttr = mergeAttributes(
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
96 db, context, parser, 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
97
1979
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
98 if (checkOutputSettings(newAttr, context)) {
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
99 saveCollectionAttribute(db, context, newAttr);
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
100 }
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
101
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
102 helper.setAttribute(newAttr);
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
103
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
104 // Make it an empty array if null.
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
105 if (aUUIDs == null) {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
106 aUUIDs = new String[] {};
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
107 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
108
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
109 for (String uuid: aUUIDs) {
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
110 helper.addArtifact(uuid);
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
111 }
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
112 }
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
113 catch (ArtifactDatabaseException ade) {
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
114 log.error("Error while merging attribute documents.", ade);
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
115
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
116 helper.setAttribute(parser.getCollectionAttribute());
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 }
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
119 return helper.toXML();
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 }
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
123 /**
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
124 * 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
125 * artifacts in the Collection.
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
126 *
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
127 * @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
128 */
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
129 protected CollectionAttribute mergeAttributes(
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
130 ArtifactDatabase db,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
131 CallContext context,
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
132 AttributeParser oldParser,
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
133 String[] uuids
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
134 ) {
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
135 CollectionAttribute cAttribute =
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
136 buildOutAttributes(db, context, oldParser, uuids);
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
137
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
138 cAttribute.setLoadedRecommendations(
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
139 getLoadedRecommendations(oldParser.getAttributeDocument()));
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
140
1979
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
141 saveCollectionAttribute(db, context, cAttribute);
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
142
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
143 return cAttribute;
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
144 }
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
145
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
146
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
147 /**
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
148 * @param db The ArtifactDatabase which is required to save the attribute
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
149 * into.
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
150 * @param attribute The CollectionAttribute that should be stored in the
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
151 * database.
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
152 *
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
153 * @return true, if the transaction was successful, otherwise false.
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
154 */
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
155 protected boolean saveCollectionAttribute(
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
156 ArtifactDatabase db,
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
157 CallContext context,
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
158 CollectionAttribute attribute
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
159 ) {
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
160 log.info("Save new CollectionAttribute into database.");
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
161
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
162 Document doc = attribute.toXML();
971
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 try {
1013
73330e89b0af Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 971
diff changeset
165 // 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
166 db.setCollectionAttribute(identifier(), context.getMeta(), doc);
1979
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
167
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
168 log.info("Saving CollectionAttribute was successful.");
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
169
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
170 return true;
971
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 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
173 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
174 }
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
175
1979
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
176 return false;
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
177 }
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
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
180 /**
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
181 * 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
182 * 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
183 * 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
184 * 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
185 */
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
186 protected Node getLoadedRecommendations(Document oldAttrs) {
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
187 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
188 oldAttrs,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
189 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
190 XPathConstants.NODE,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
191 ArtifactNamespaceContext.INSTANCE);
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
192
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
193 return loadedRecoms;
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
194 }
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
195
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
196
1979
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
197 /**
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
198 * Evaluates the Output settings. If an Output has no Settings set, the
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
199 * relevant OutGenerator is used to initialize a default Settings object.
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
200 *
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
201 * @param attribute The CollectionAttribute.
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
202 * @param cc The CallContext.
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
203 *
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
204 * @return true, if the CollectionAttribute was modified, otherwise false.
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
205 */
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
206 protected boolean checkOutputSettings(
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
207 CollectionAttribute attribute,
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
208 CallContext cc
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
209 ) {
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
210 boolean modified = false;
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
211
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
212 Map<String, Output> outputMap = attribute != null
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
213 ? attribute.getOutputs()
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
214 : null;
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
215
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
216 if (outputMap == null || outputMap.size() == 0) {
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
217 log.debug("No Output Settings check necessary.");
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
218 return modified;
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
219 }
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
220
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
221 Set<Map.Entry<String, Output>> entries = outputMap.entrySet();
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
222
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
223 for (Map.Entry<String, Output> entry: entries) {
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
224 String outName = entry.getKey();
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
225 Output output = entry.getValue();
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
226
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
227 Settings settings = output.getSettings();
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
228
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
229 if (settings == null) {
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
230 log.debug("No Settings set for Output '" + outName + "'.");
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
231 output.setSettings(createInitialOutputSettings(cc, outName));
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
232
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
233 modified = true;
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
234 }
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
235 }
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
236
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
237 return modified;
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
238 }
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
239
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
240
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
241 /**
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
242 * This method uses the the OutGenerator for the specified Output
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
243 * <i>out</i> to create an initial Settings object.
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
244 */
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
245 protected Settings createInitialOutputSettings(CallContext cc, String out) {
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
246 OutGenerator outGen = getOutGenerator(cc, out, null);
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
247
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
248 // TODO simulate a real out() process and return finally the Settings
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
249 // object retrieved by the OutGenerator.
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
250
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
251 return outGen.getSettings();
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
252 }
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
253
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1976
diff changeset
254
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
255 @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
256 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
257 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
258 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
259 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
260 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
261 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
262 {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
263 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
264
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
265 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
266 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
267
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
268 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
269 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
270
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
271 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
272 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
273 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
274
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
275 OutGenerator generator = null;
1780
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
276 if (type != null
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
277 && type.length() > 0
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
278 && type.indexOf("chartinfo") > 0)
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
279 {
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
280 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
281 }
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
282 else {
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
283 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
284 }
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
285
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
286 if (generator == null) {
390
a67748ad4d61 Modified a confusing debug statement.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 388
diff changeset
287 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
288 // 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
289
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
290 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
291 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
292
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
293 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
294
1744
62efd1288e34 Fix setting of masterartifact in flyscollections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1718
diff changeset
295 // Get master artifact.
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
296 FLYSArtifact master = getMasterArtifact(context);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
297 if (master != null) {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
298 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
299 generator.setMasterArtifact(master);
1780
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
300 }
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
301 else {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
302 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
303 }
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
304
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
305 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
306 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
307 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
308 }
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
309 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
310 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
311 }
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
312 }
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
313
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
314
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
315 /**
1029
3f3988bb6284 Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1013
diff changeset
316 * 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
317 *
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
318 * @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
319 * @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
320 * @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
321 * 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
322 * @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
323 */
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
324 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
325 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
326 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
327 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
328 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
329 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
330 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
331 {
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
332 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
333
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
334 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
335
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
336 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
337 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
338
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
339 List<ArtifactAndFacet> dataProviders =
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
340 doBlackboardPass(themeList, context);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
341
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
342 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
343 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
344 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
345
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
346 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
347 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
348 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
349 }
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
350
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
351 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
352 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
353
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
354 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
355 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
356 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
357 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
358 }
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
359
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
360 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
361 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
362 }
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
363
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
364 generator.doOut(
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
365 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
366 getFacetThemeFromAttribute(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
367 art,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
368 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
369 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
370 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
371 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
372 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
373 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
374 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
375 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
376 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
377 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
378 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
379
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
380 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
381 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
382
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
383
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
384 /**
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
385 * 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
386 * 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
387 * ThemeList).
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
388 * @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
389 * @param contect The "Blackboard".
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
390 */
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
391 protected List<ArtifactAndFacet> doBlackboardPass(
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
392 ThemeList themeList, CallContext context
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
393 ) {
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
394 ArrayList<ArtifactAndFacet> dataProviders =
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
395 new ArrayList<ArtifactAndFacet>();
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
396 int size = themeList.size();
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
397
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
398 try {
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
399 // 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
400 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
401 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
402 String uuid = theme.getArtifact();
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
403 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
404 FLYSArtifact flys = (FLYSArtifact) artifact;
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
405 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
406 flys.getNativeFacet(theme));
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
407
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
408 // Show blackboard to facet.
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
409 artifactAndFacet.register(context);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
410
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
411 // Add to themes.
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
412 dataProviders.add(i, artifactAndFacet);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
413 }
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
414 }
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
415 catch (ArtifactDatabaseException ade) {
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
416 log.error("ArtifactDatabaseException!", ade);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
417 }
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
418
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
419 return dataProviders;
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
420 }
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
421
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
422
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
423 /**
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
424 * @return masterartifact or null if exception/not found.
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
425 */
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
426 protected FLYSArtifact getMasterArtifact(CallContext context)
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
427 {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
428 try {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
429 ArtifactDatabase db = context.getDatabase();
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
430 CallMeta callMeta = context.getMeta();
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
431 Document document = db.getCollectionsMasterArtifact(
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
432 identifier(), callMeta);
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
433
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
434 String masterUUID = XMLUtils.xpathString(
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
435 document, XPATH_MASTER_UUID, ArtifactNamespaceContext.INSTANCE);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
436 FLYSArtifact masterArtifact =
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
437 (FLYSArtifact) getArtifact(masterUUID, context);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
438 return masterArtifact;
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
439 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
440 catch (ArtifactDatabaseException ade) {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
441 log.error(ade, ade);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
442 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
443 return null;
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
444 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
445
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
446
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
447 /**
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
448 * 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
449 * @param uuids List of artifact uuids.
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
450 */
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
451 protected CollectionAttribute buildOutAttributes(
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
452 ArtifactDatabase db,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
453 CallContext context,
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
454 AttributeParser aParser,
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
455 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
456 {
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
457 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
458
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
459 FLYSContext flysContext = FLYSUtils.getFlysContext(context);
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
460 StateEngine engine = (StateEngine) flysContext.get(
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
461 FLYSContext.STATE_ENGINE_KEY);
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
462
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
463 FLYSArtifact masterArtifact = getMasterArtifact(context);
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
464
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
465 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
466 doc,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
467 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
468 ArtifactNamespaceContext.NAMESPACE_PREFIX);
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
469
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
470 OutputParser oParser = new OutputParser(db, context);
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
471
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
472 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
473 for (String uuid: uuids) {
1175
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
474 try {
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
475 oParser.parse(uuid);
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
476 }
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
477 catch (ArtifactDatabaseException ade) {
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
478 log.warn(ade, ade);
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
479 }
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
480 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
481 }
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
482
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
483 aParser.parse();
1950
37a7b3841565 Include state data items in description document of collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1948
diff changeset
484
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
485 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
486 db,
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
487 aParser.getOuts(),
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
488 aParser.getFacets(),
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
489 oParser.getOuts(),
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
490 oParser.getFacets(),
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
491 engine.getCompatibleFacets(masterArtifact.getStateHistoryIds())
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
492 ).write();
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
493 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
494
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
495
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
496 /**
1780
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
497 * Returns the "attribute" (part of description document) for a specific
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
498 * 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
499 *
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
500 * @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
501 *
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
502 * @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
503 */
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
504 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
505 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
506 {
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
507 CollectionAttribute cAttr = 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
508 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
509 context,
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
510 new AttributeParser(getAttribute()),
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
511 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
512
1976
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
513 Document attr = cAttr.toXML();
0b466bd4ab24 Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1972
diff changeset
514
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
515 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
516 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
517 "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
518 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
519 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
520
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
521
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
522 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
523 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
524
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
525 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
526
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
527 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
528 }
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
529
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
530 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
531 }
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
532
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
533
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
534 /**
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
535 * 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
536 * 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
537 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
538 * @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
539 * 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
540 *
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 * @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
542 */
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 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
544 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
545 {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
546 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
547
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
548 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
549 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
550
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 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
552 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
553 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
554 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
555 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
556 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
557
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
558 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
559 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
560 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
561 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
562
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
563 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
564
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
565 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
566
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
567 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
568 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
569 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
570 "@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
571 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
572
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
573 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
574 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
575 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
576 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
577
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
578 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
579 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
580
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
581
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
582 /**
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
583 * 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
584 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
585 * @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
586 * @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
587 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
588 * @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
589 */
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
590 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
591 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
592 {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
593 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
594
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
595 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
596 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
597
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
598 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
599 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
600
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
601
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
602 /**
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
603 * 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
604 * 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
605 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
606 * @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
607 * @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
608 * @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
609 * @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
610 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
611 * @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
612 */
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
613 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
614 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
615 String outName,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
616 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
617 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
618 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
619 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
620 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
621 {
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
622 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
623
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
624 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
625 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
626
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
627 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
628 ? (FLYSContext) context
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
629 : (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
630
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
631 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
632
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
633 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
634 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
635
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
636 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
637 return null;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
638 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
639 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
640
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
641 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
642
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
643 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
644 attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
645 "/art:attribute",
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
646 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
647 ArtifactNamespaceContext.INSTANCE);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
648
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
649 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
650 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
651 return null;
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
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
654 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
655
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
656 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
657 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
658 "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
659 "' 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
660 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
661 ArtifactNamespaceContext.INSTANCE);
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 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
664 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
665
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
666 Theme t = getThemeForFacet(
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
667 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
668
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
669 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
670 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
671 return null;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
672 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
673
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
674 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
675 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
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 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
679 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
680
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
681 return doc;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
682 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
683
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
684
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 * 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
687 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
688 * @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
689 * @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
690 * @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
691 * @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
692 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
693 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
694 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
695 Document attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
696 Theme t,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
697 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
698 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
699 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
700
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
701 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
702 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
703 return;
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
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
706 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
707 attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
708 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
709 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
710
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
711 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
712 attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
713 "/art:attribute",
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
714 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
715 ArtifactNamespaceContext.INSTANCE);
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 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
718 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
719 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
720 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
721
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
722 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
723 tmp,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
724 "art:themes",
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
725 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
726 ArtifactNamespaceContext.INSTANCE);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
727
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
728 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
729 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
730 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
731 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
732
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
733 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
734
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
735 try {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
736 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
737
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
738 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
739 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
740 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
741 // do nothing
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
742 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
743 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
744 }
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
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
747 /**
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
748 * 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
749 * specific facet.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
750 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
751 * @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
752 * @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
753 * @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
754 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
755 * @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
756 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
757 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
758 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
759 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
760 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
761 int index,
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
762 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
763 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
764 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
765 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
766
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
767 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
768
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
769 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
770 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
771 return null;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
772 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
773
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
774 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
775
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
776 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
777
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
778 return attr;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
779 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
780
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
781
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
782 /**
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
783 * 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
784 * 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
785 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
786 * @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
787 * @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
788 * @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
789 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
790 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
791 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
792 Document attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
793 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
794 throws ArtifactDatabaseException
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
795 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
796 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
797 uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
798 attr);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
799
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
800 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
801 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
802 return;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
803 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
804
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
805 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
806 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
807
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
808 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
809 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
810
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
811
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
812 /**
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
813 * 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
814 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
815 * @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
816 * @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
817 * @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
818 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
819 * @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
820 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
821 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
822 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
823 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
824 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
825 int index,
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
826 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
827 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
828 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
829 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
830
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
831 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
832 ? (FLYSContext) context
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
833 : (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
834
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
835 // 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
836 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
837 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
838 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
839 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
840 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
841 }
1837
0585bf8af41b Catch more specific Exception in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1828
diff changeset
842 catch (ArtifactDatabaseException dbe) {
0585bf8af41b Catch more specific Exception in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1828
diff changeset
843 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
844 }
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
845
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
846 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
847
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
848 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
849 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
850 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
851 }
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
852
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
853 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
854 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
855
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
856
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
857 /**
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
858 * 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
859 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
860 * @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
861 * @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
862 *
1029
3f3988bb6284 Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1013
diff changeset
863 * @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
864 */
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
865 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
866 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
867 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
868 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
869 {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
870 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
871 ? (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
872 : (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
873
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
874 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
875 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
876
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
877 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
878 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
879 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
880 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
881
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
882 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
883
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
884 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
885 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
886 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
887 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
888 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
889 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
890 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
891 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
892 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
893
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
894 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
895 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
896
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
897
1950
37a7b3841565 Include state data items in description document of collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1948
diff changeset
898 /**
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
899 * 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
900 */
1718
defe2cfeefa5 FLYSArtifactCollection: Small optimizations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1717
diff changeset
901 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
902 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
903 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
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 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
906 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
907 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
908 }
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
909
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
910 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
911 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
912 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
913 "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
914 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
915 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
916
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
917 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
918
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
919 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
920
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
921 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
922 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
923 }
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
924
694
68c6c75a6f7c Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 649
diff changeset
925 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
926
694
68c6c75a6f7c Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 649
diff changeset
927 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
928 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
929
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
930 ManagedDomFacet facet = new ManagedDomFacet(theme);
1718
defe2cfeefa5 FLYSArtifactCollection: Small optimizations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1717
diff changeset
931 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
932 }
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
933 }
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
934
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
935 public ManagedFacet get(int idx) {
1718
defe2cfeefa5 FLYSArtifactCollection: Small optimizations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1717
diff changeset
936 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
937 }
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
938
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
939 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
940 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
941 }
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
942 }
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
943 }
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
944 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org