annotate flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 3817:804088c2e23a

Prevent follow-up errors. flys-artifacts/tags/pre2.7-2012-03-16@4162 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 19 Mar 2012 14:14:53 +0000
parents a71fc8f2030c
children 3aec5a42696a
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);
2585
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
95
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
96 oldAttrs = removeAttributes(oldAttrs, context);
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
97 parser = new AttributeParser(oldAttrs);
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
98
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
99 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
100 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
101
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
102 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
103 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
104 }
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
105
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
106 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
107
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
108 // Make it an empty array if null.
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
109 if (aUUIDs == null) {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
110 aUUIDs = new String[] {};
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
111 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
112
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
113 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
114 helper.addArtifact(uuid);
293
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
115 }
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
116 }
3419b1c8ca28 Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 156
diff changeset
117 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
118 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
119
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
120 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
121 }
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122
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
123 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
124 }
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126
971
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
127 /**
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
128 * 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
129 * artifacts in the Collection.
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
130 *
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
131 * @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
132 */
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
133 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
134 ArtifactDatabase db,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
135 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
136 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
137 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
138 ) {
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 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
140 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
141
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
142 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
143 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
144
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
145 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
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 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
148 }
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
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
2585
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
151 protected Document removeAttributes(Document attrs, CallContext context) {
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
152 FLYSArtifact master = getMasterArtifact(context);
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
153 List<Output> outList = master.getOutputs(context);
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
154
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
155 Document doc = XMLUtils.newDocument();
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
156 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
157 doc,
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
158 ArtifactNamespaceContext.NAMESPACE_URI,
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
159 ArtifactNamespaceContext.NAMESPACE_PREFIX);
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
160
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
161 Element root = ec.create("attribute");
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
162 doc.appendChild(root);
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
163
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
164 if (outList.size() > 0) {
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
165 Element outs = ec.create("outputs");
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
166 root.appendChild(outs);
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
167
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
168 for (Output o : outList) {
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
169 Node n = (Node) XMLUtils.xpath(
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
170 attrs,
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
171 "/art:attribute/art:outputs/art:output[@name='" + o.getName() + "']",
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
172 XPathConstants.NODE,
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
173 ArtifactNamespaceContext.INSTANCE);
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
174 if (n != null) {
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
175 Node clone = doc.importNode(n, true);
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
176 outs.appendChild(clone);
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
177 }
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
178 }
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
179 }
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
180
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
181 return doc;
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
182 }
a71fc8f2030c Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2325
diff changeset
183
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
184 /**
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
185 * @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
186 * 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
187 * @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
188 * 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
189 *
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
190 * @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
191 */
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
192 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
193 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
194 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
195 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
196 ) {
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 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
198
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 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
200
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
201 try {
1013
73330e89b0af Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 971
diff changeset
202 // 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
203 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
204
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 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
206
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 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
208 }
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
209 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
210 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
211 }
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
212
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
213 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
214 }
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
215
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
216
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
217 /**
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
218 * 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
219 * 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
220 * 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
221 * 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
222 */
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
223 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
224 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
225 oldAttrs,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
226 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
227 XPathConstants.NODE,
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
228 ArtifactNamespaceContext.INSTANCE);
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
229
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
230 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
231 }
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
232
d0c9a5f32c30 Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 945
diff changeset
233
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
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 * 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
236 * 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
237 *
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 * @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
239 * @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
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 * @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
242 */
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 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
244 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
245 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
246 ) {
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 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
248
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 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
250 ? 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
251 : 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
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 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
254 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
255 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
256 }
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
257
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
258 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
259
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
260 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
261 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
262 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
263
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
264 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
265
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
266 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
267 log.debug("No Settings set for Output '" + outName + "'.");
1999
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
268 output.setSettings(
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
269 createInitialOutputSettings(cc, attribute, outName));
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
270
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
271 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
272 }
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
273 }
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
274
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
275 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
276 }
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
277
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
278
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
279 /**
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
280 * 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
281 * <i>out</i> to create an initial Settings object.
1999
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
282 *
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
283 * @param cc The CallContext object.
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
284 * @param attr The CollectionAttribute.
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
285 * @param out The name of the output.
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
286 *
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
287 * @return a default Settings object for the specified Output.
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
288 */
1999
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
289 protected Settings createInitialOutputSettings(
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
290 CallContext cc,
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
291 CollectionAttribute attr,
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
292 String out
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
293 ) {
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
294 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
295
1999
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
296 if (outGen == null) {
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
297 return null;
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
298 }
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
299
1988
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
300 // XXX NOTE: the outGen is not able to process its generate() operation,
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
301 // because it has no OutputStream set!
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
302 outGen.init(XMLUtils.newDocument(), null, cc);
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
303 prepareMasterArtifact(outGen, cc);
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
304
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
305 try {
1999
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
306 Document outAttr = getAttribute(cc, attr, out);
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
307 doOut(outGen, out, out, outAttr, cc);
1988
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
308 }
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
309 catch (ArtifactDatabaseException adbe) {
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
310 log.error(adbe, adbe);
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
311 }
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
312 catch (IOException ioe) {
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
313 log.error(ioe, ioe);
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
314 }
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
315
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
316 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
317 }
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
318
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
319
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
320 @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
321 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
322 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
323 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
324 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
325 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
326 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
327 {
1998
3862c50d1cf3 Added an INFO statement that displays the duration time for the out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1993
diff changeset
328 long reqBegin = System.currentTimeMillis();
3862c50d1cf3 Added an INFO statement that displays the duration time for the out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1993
diff changeset
329
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
330 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
331
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
332 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
333 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
334
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
335 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
336 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
337
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
338 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
339 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
340 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
341
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
342 OutGenerator generator = null;
1780
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
343 if (type != null
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
344 && type.length() > 0
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
345 && type.indexOf("chartinfo") > 0)
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
346 {
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
347 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
348 }
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
349 else {
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
350 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
351 }
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
352
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
353 if (generator == null) {
390
a67748ad4d61 Modified a confusing debug statement.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 388
diff changeset
354 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
355 // 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
356
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
357 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
358 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
359
1999
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
360 Document oldAttrs = getAttribute();
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
361 AttributeParser parser = new AttributeParser(oldAttrs);
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
362 CollectionAttribute cAttr = parser.getCollectionAttribute();
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
363
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
364 Output output = cAttr.getOutput(name);
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
365 Settings settings = output.getSettings();
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
366
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
367 generator.init(format, out, context);
2047
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2012
diff changeset
368 generator.setSettings(settings);
1988
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
369 prepareMasterArtifact(generator, 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
370
1988
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
371 try {
1999
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
372 Document attr = getAttribute(context, cAttr, name);
1988
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
373 doOut(generator, name, subtype, attr, context);
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
374 generator.generate();
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
375 }
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
376 catch (ArtifactDatabaseException adbe) {
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
377 log.error(adbe, adbe);
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
378 }
1998
3862c50d1cf3 Added an INFO statement that displays the duration time for the out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1993
diff changeset
379
3862c50d1cf3 Added an INFO statement that displays the duration time for the out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1993
diff changeset
380 long duration = System.currentTimeMillis() -reqBegin;
3862c50d1cf3 Added an INFO statement that displays the duration time for the out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1993
diff changeset
381 log.info("Processing out(" + name + ") took " + duration + " ms.");
1988
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
382 }
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
383
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
384
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
385 /**
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
386 * Sets the master Artifact at the given <i>generator</i>.
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
387 *
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
388 * @param generator The generator that gets a master Artifact.
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
389 * @param cc The CallContext.
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
390 */
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
391 protected void prepareMasterArtifact(OutGenerator generator, CallContext cc
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
392 ) {
1744
62efd1288e34 Fix setting of masterartifact in flyscollections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1718
diff changeset
393 // Get master artifact.
1988
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
394 FLYSArtifact master = getMasterArtifact(cc);
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
395 if (master != null) {
1988
158b3aabda2c Prepare the OutGenerator during the describe() operation of the FLYS Collection to enable the OutGenerator to return an initial Settings object.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1979
diff changeset
396 log.debug("Set master Artifact to uuid: " + master.identifier());
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
397 generator.setMasterArtifact(master);
1780
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
398 }
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
399 else {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
400 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
401 }
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
402 }
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
403
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
404
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
405 /**
1029
3f3988bb6284 Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1013
diff changeset
406 * 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
407 *
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
408 * @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
409 * @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
410 * @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
411 * 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
412 * @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
413 */
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
414 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
415 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
416 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
417 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
418 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
419 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
420 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
421 {
646
d299e220d89c Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 641
diff changeset
422 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
423
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
424 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
425
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
426 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
427 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
428
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
429 List<ArtifactAndFacet> dataProviders =
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
430 doBlackboardPass(themeList, context);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
431
347
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
432 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
433 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
434 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
435
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
436 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
437 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
438 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
439 }
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
440
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
441 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
442 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
443
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
444 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
445 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
446 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
447 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
448 }
a63d8bdb2d79 Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 346
diff changeset
449
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
450 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
451 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
452 }
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
453
2011
81eaea64c0db Hide deleted facets from outgenerators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1999
diff changeset
454 // Skip invisible themes.
81eaea64c0db Hide deleted facets from outgenerators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1999
diff changeset
455 if (theme.getVisible() == 0) {
81eaea64c0db Hide deleted facets from outgenerators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1999
diff changeset
456 continue;
81eaea64c0db Hide deleted facets from outgenerators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1999
diff changeset
457 }
81eaea64c0db Hide deleted facets from outgenerators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1999
diff changeset
458
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
459 generator.doOut(
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
460 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
461 getFacetThemeFromAttribute(
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
462 art,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
463 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
464 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
465 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
466 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
467 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
468 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
469 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
470 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
471 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
472 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
473 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
474 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
475
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
476
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
477 /**
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
478 * 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
479 * 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
480 * ThemeList).
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
481 * @param themeList ThemeList to create a ArtifactAndFacetList along.
3817
804088c2e23a Prevent follow-up errors.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2585
diff changeset
482 * @param context The "Blackboard".
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
483 */
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
484 protected List<ArtifactAndFacet> doBlackboardPass(
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
485 ThemeList themeList, CallContext context
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
486 ) {
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
487 ArrayList<ArtifactAndFacet> dataProviders =
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
488 new ArrayList<ArtifactAndFacet>();
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
489 int size = themeList.size();
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
490
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
491 try {
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
492 // Collect all ArtifactAndFacets for blackboard pass.
3817
804088c2e23a Prevent follow-up errors.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2585
diff changeset
493 int pivot = 0;
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
494 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
495 ManagedFacet theme = themeList.get(i);
2212
588db6f2e05a Avoid running into an NPE, but add warning to ease forensic.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2047
diff changeset
496 if (theme == null) {
588db6f2e05a Avoid running into an NPE, but add warning to ease forensic.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2047
diff changeset
497 log.warn("A ManagedFacet in ThemeList is null.");
588db6f2e05a Avoid running into an NPE, but add warning to ease forensic.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2047
diff changeset
498 continue;
588db6f2e05a Avoid running into an NPE, but add warning to ease forensic.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2047
diff changeset
499 }
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
500 String uuid = theme.getArtifact();
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
501 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
502 FLYSArtifact flys = (FLYSArtifact) artifact;
2325
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2212
diff changeset
503
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2212
diff changeset
504 ArtifactAndFacet artifactAndFacet = new ArtifactAndFacet(
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2212
diff changeset
505 artifact,
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
506 flys.getNativeFacet(theme));
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
507
2325
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2212
diff changeset
508 // XXX HELP ME PLEASE
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2212
diff changeset
509 artifactAndFacet.setFacetDescription(theme.getDescription());
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2212
diff changeset
510
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
511 // Show blackboard to facet.
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
512 artifactAndFacet.register(context);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
513
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
514 // Add to themes.
3817
804088c2e23a Prevent follow-up errors.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2585
diff changeset
515 dataProviders.add(pivot, artifactAndFacet);
804088c2e23a Prevent follow-up errors.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2585
diff changeset
516 pivot += 1;
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
517 }
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
518 }
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
519 catch (ArtifactDatabaseException ade) {
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
520 log.error("ArtifactDatabaseException!", ade);
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
521 }
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
522
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
523 return dataProviders;
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
524 }
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
525
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
526
1946
a584a26d5fde Introduce pre-rendering inter-facet communication phase ('blackboard pass').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1837
diff changeset
527 /**
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
528 * @return masterartifact or null if exception/not found.
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
529 */
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
530 protected FLYSArtifact getMasterArtifact(CallContext context)
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
531 {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
532 try {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
533 ArtifactDatabase db = context.getDatabase();
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
534 CallMeta callMeta = context.getMeta();
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
535 Document document = db.getCollectionsMasterArtifact(
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
536 identifier(), callMeta);
1972
3c3e81fca092 Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1950
diff changeset
537
1784
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
538 String masterUUID = XMLUtils.xpathString(
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
539 document, XPATH_MASTER_UUID, ArtifactNamespaceContext.INSTANCE);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
540 FLYSArtifact masterArtifact =
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
541 (FLYSArtifact) getArtifact(masterUUID, context);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
542 return masterArtifact;
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
543 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
544 catch (ArtifactDatabaseException ade) {
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
545 log.error(ade, ade);
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
546 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
547 return null;
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
548 }
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
549
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
550
0fe3c4849baa Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1780
diff changeset
551 /**
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
552 * 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
553 * @param uuids List of artifact uuids.
1628
16c74ca3586e Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1175
diff changeset
554 */
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
555 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
556 ArtifactDatabase db,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
557 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
558 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
559 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
560 {
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
561 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
562
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
563 FLYSContext flysContext = FLYSUtils.getFlysContext(context);
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
564 StateEngine engine = (StateEngine) flysContext.get(
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
565 FLYSContext.STATE_ENGINE_KEY);
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
566
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
567 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
568
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
569 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
570 doc,
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
571 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
572 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
573
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
574 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
575
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
576 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
577 for (String uuid: uuids) {
1175
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
578 try {
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
579 oParser.parse(uuid);
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
580 }
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
581 catch (ArtifactDatabaseException ade) {
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
582 log.warn(ade, ade);
e6b513495281 Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
583 }
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
584 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
585 }
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
586
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
587 aParser.parse();
1950
37a7b3841565 Include state data items in description document of collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1948
diff changeset
588
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
589 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
590 db,
1993
85132c9edd64 Make reuse of the old CollectionAttribute during the describe() operation of FLYSArtifactCollection - remove the old facets only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1988
diff changeset
591 aParser.getCollectionAttribute(),
1709
f643ea084213 Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
592 aParser.getOuts(),
1785
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
593 aParser.getFacets(),
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
594 oParser.getOuts(),
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
595 oParser.getFacets(),
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
596 engine.getCompatibleFacets(masterArtifact.getStateHistoryIds())
661dfad9910a Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1784
diff changeset
597 ).write();
346
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
598 }
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
599
16161de47662 The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 300
diff changeset
600
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
601 /**
1780
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
602 * Returns the "attribute" (part of description document) for a specific
b503d92dd709 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1772
diff changeset
603 * 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
604 *
1999
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
605 * @param context The CallContext object.
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
606 * @param cAttr The CollectionAttribute.
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
607 * @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
608 *
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
609 * @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
610 */
1999
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
611 protected Document getAttribute(
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
612 CallContext context,
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
613 CollectionAttribute cAttr,
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
614 String 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
615 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
616 {
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
617 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
618
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
619 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
620 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
621 "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
622 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
623 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
624
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
625
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
626 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
627 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
628
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
629 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
630
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
631 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
632 }
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
633
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
634 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
635 }
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
636
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
637
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
638 /**
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
639 * 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
640 * 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
641 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
642 * @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
643 * 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
644 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
645 * @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
646 */
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
647 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
648 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
649 {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
650 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
651
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
652 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
653 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
654
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
655 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
656 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
657 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
658 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
659 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
660 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
661
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
662 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
663 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
664 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
665 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
666
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
667 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
668
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
669 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
670
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
671 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
672 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
673 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
674 "@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
675 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
676
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
677 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
678 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
679 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
680 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
681
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
682 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
683 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
684
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
685
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
686 /**
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
687 * 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
688 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
689 * @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
690 * @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
691 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
692 * @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
693 */
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
694 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
695 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
696 {
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
697 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
698
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
699 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
700 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
701
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
702 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
703 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
704
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
705
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
706 /**
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
707 * 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
708 * 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
709 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
710 * @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
711 * @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
712 * @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
713 * @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
714 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
715 * @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
716 */
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
717 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
718 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
719 String outName,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
720 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
721 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
722 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
723 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
724 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
725 {
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
726 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
727
350
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
728 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
729 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
730
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
731 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
732 ? (FLYSContext) context
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
733 : (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
734
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
735 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
736
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
737 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
738 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
739
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
740 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
741 return null;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
742 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
743 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
744
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
745 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
746
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
747 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
748 attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
749 "/art:attribute",
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
750 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
751 ArtifactNamespaceContext.INSTANCE);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
752
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
753 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
754 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
755 return null;
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
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
758 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
759
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
760 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
761 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
762 "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
763 "' 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
764 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
765 ArtifactNamespaceContext.INSTANCE);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
766
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
767 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
768 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
769
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
770 Theme t = getThemeForFacet(
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
771 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
772
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
773 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
774 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
775 return null;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
776 }
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 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
779 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
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 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
783 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
784
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
785 return doc;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
786 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
787
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
788
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 * 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
791 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
792 * @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
793 * @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
794 * @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
795 * @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
796 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
797 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
798 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
799 Document attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
800 Theme t,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
801 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
802 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
803 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
804
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
805 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
806 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
807 return;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
808 }
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 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
811 attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
812 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
813 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
814
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
815 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
816 attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
817 "/art:attribute",
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
818 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
819 ArtifactNamespaceContext.INSTANCE);
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 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
822 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
823 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
824 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
825
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
826 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
827 tmp,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
828 "art:themes",
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
829 XPathConstants.NODE,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
830 ArtifactNamespaceContext.INSTANCE);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
831
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
832 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
833 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
834 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
835 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
836
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
837 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
838
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
839 try {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
840 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
841
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
842 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
843 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
844 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
845 // do nothing
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
846 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
847 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
848 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
849
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
850
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
851 /**
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
852 * 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
853 * specific facet.
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
854 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
855 * @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
856 * @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
857 * @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
858 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
859 * @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
860 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
861 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
862 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
863 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
864 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
865 int index,
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
866 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
867 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
868 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
869 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
870
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
871 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
872
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
873 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
874 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
875 return null;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
876 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
877
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
878 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
879
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
880 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
881
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
882 return attr;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
883 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
884
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
885
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
886 /**
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
887 * 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
888 * 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
889 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
890 * @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
891 * @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
892 * @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
893 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
894 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
895 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
896 Document attr,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
897 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
898 throws ArtifactDatabaseException
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
899 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
900 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
901 uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
902 attr);
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
903
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
904 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
905 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
906 return;
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
907 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
908
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
909 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
910 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
911
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
912 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
913 }
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
914
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
915
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
916 /**
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
917 * 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
918 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
919 * @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
920 * @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
921 * @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
922 *
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
923 * @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
924 */
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
925 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
926 String uuid,
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
927 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
928 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
929 int index,
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
930 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
931 CallContext context)
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
932 {
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
933 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
934
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
935 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
936 ? (FLYSContext) context
2465dc296395 The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 347
diff changeset
937 : (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
938
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
939 // 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
940 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
941 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
942 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
943 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
944 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
945 }
1837
0585bf8af41b Catch more specific Exception in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1828
diff changeset
946 catch (ArtifactDatabaseException dbe) {
0585bf8af41b Catch more specific Exception in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1828
diff changeset
947 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
948 }
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
949
1828
9562ca537143 Added new optional condition for theme-mappings: the output name.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1822
diff changeset
950 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
951
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
952 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
953 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
954 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
955 }
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
956
6566c7868456 Added facet and index information to theme which are stored at CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1628
diff changeset
957 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
958 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
959
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
960
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
961 /**
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
962 * 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
963 *
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
964 * @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
965 * @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
966 *
1029
3f3988bb6284 Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1013
diff changeset
967 * @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
968 */
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
969 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
970 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
971 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
972 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
973 {
1999
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
974 log.debug("Search OutGenerator for Output '" + name + "'");
02ce03329ef5 Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1998
diff changeset
975
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
976 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
977 ? (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
978 : (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
979
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
980 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
981 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
982
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
983 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
984 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
985 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
986 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
987
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
988 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
989
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
990 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
991 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
992 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
993 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
994 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
995 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
996 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
997 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
998 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
999
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
1000 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
1001 }
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
1002
9a0e1289bab6 The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 296
diff changeset
1003
1950
37a7b3841565 Include state data items in description document of collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1948
diff changeset
1004 /**
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
1005 * 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
1006 */
1718
defe2cfeefa5 FLYSArtifactCollection: Small optimizations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1717
diff changeset
1007 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
1008 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
1009 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
1010
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
1011 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
1012 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
1013 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
1014 }
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
1015
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
1016 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
1017 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
1018 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
1019 "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
1020 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
1021 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
1022
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
1023 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
1024
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
1025 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
1026
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
1027 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
1028 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
1029 }
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
1030
694
68c6c75a6f7c Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 649
diff changeset
1031 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
1032
694
68c6c75a6f7c Add index and description of facets to collections describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 649
diff changeset
1033 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
1034 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
1035
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
1036 ManagedDomFacet facet = new ManagedDomFacet(theme);
1718
defe2cfeefa5 FLYSArtifactCollection: Small optimizations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1717
diff changeset
1037 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
1038 }
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
1039 }
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
1040
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
1041 public ManagedFacet get(int idx) {
1718
defe2cfeefa5 FLYSArtifactCollection: Small optimizations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1717
diff changeset
1042 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
1043 }
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
1044
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
1045 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
1046 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
1047 }
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
1048 }
147
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1049 }
76cc1a66a05f Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1050 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org