Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 3743:51f76225823b
Extreme waterlevels: calculate the segments for Q km ranges.
flys-artifacts/trunk@5426 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 10 Sep 2012 15:59:34 +0000 |
parents | 53aa395a29e0 |
children | a5f65e8983be |
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 |
3606 | 3 import de.intevation.artifactdatabase.Backend; |
4 import de.intevation.artifactdatabase.Backend.PersistentArtifact; | |
5 import de.intevation.artifactdatabase.DefaultArtifactCollection; | |
6 import de.intevation.artifactdatabase.state.Output; | |
7 import de.intevation.artifactdatabase.state.Settings; | |
8 import de.intevation.artifactdatabase.state.StateEngine; | |
9 import de.intevation.artifacts.Artifact; | |
10 import de.intevation.artifacts.ArtifactDatabase; | |
11 import de.intevation.artifacts.ArtifactDatabaseException; | |
12 import de.intevation.artifacts.ArtifactNamespaceContext; | |
13 import de.intevation.artifacts.CallContext; | |
14 import de.intevation.artifacts.CallMeta; | |
15 import de.intevation.artifacts.common.utils.XMLUtils; | |
16 import de.intevation.flys.artifacts.FLYSArtifact; | |
17 import de.intevation.flys.artifacts.context.FLYSContext; | |
18 import de.intevation.flys.exports.OutGenerator; | |
19 import de.intevation.flys.exports.OutputHelper; | |
20 import de.intevation.flys.utils.FLYSUtils; | |
21 | |
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
|
22 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
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 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
|
29 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 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
|
31 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 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
|
33 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
|
34 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
|
35 import org.w3c.dom.Node; |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
36 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
|
37 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 /** |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 * @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
|
40 */ |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 public class FLYSArtifactCollection extends DefaultArtifactCollection { |
1013
73330e89b0af
Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
971
diff
changeset
|
42 /** 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
|
43 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
|
44 |
1013
73330e89b0af
Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
971
diff
changeset
|
45 /** 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
|
46 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
|
47 "/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
|
48 |
1950
37a7b3841565
Include state data items in description document of collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
49 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
|
50 "/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
|
51 |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
52 public static final String XPATH_COLLECTION_ITEMS = |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
53 "/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
|
54 |
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
|
55 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
|
56 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
57 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
|
58 |
1780
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
59 /** Xpath to master artifacts uuid. */ |
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
60 public static final String XPATH_MASTER_UUID = |
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
61 "/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
|
62 |
971
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
63 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
|
64 "/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
|
65 |
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
|
66 |
1628
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1175
diff
changeset
|
67 /** |
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1175
diff
changeset
|
68 * Return description Document for this collection. |
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1175
diff
changeset
|
69 */ |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 @Override |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 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
|
72 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
|
73 |
1972
3c3e81fca092
Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1950
diff
changeset
|
74 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
|
75 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
|
76 context); |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
78 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
|
79 |
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
|
80 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
|
81 AttributeParser parser = new AttributeParser(oldAttrs); |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
82 |
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
|
83 try { |
3315
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
84 String[] aUUIDs = getArtifactUUIDs(context); |
2585
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
85 |
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
86 oldAttrs = removeAttributes(oldAttrs, context); |
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
87 parser = new AttributeParser(oldAttrs); |
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
88 |
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 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
|
90 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
|
91 |
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
|
92 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
|
93 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
|
94 } |
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
|
95 |
1972
3c3e81fca092
Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1950
diff
changeset
|
96 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
|
97 |
3315
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
98 if (aUUIDs != null) { |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
99 for (String uuid: aUUIDs) { |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
100 helper.addArtifact(uuid); |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
101 } |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
102 } |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
103 } |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
104 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
|
105 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
|
106 |
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
|
107 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
|
108 } |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 |
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
|
110 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
|
111 } |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 |
971
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
114 /** |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
115 * 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
|
116 * artifacts in the Collection. |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
117 * |
1709
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
118 * @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
|
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 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
|
121 ArtifactDatabase db, |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
122 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
|
123 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
|
124 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
|
125 ) { |
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
|
126 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
|
127 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
|
128 |
1976
0b466bd4ab24
Introduced a CollectionAttribute class that stores the information provided by the Collection's attribute document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1972
diff
changeset
|
129 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
|
130 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
|
131 |
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
|
132 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
|
133 |
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
|
134 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
|
135 } |
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
|
136 |
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
|
137 |
2585
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
138 protected Document removeAttributes(Document attrs, CallContext context) { |
2594
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
139 Node outs = (Node) XMLUtils.xpath( |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
140 attrs, |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
141 "/art:attribute/art:outputs", |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
142 XPathConstants.NODE, |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
143 ArtifactNamespaceContext.INSTANCE); |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
144 |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
145 NodeList nodes = (NodeList) XMLUtils.xpath( |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
146 attrs, |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
147 "/art:attribute/art:outputs/art:output", |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
148 XPathConstants.NODESET, |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
149 ArtifactNamespaceContext.INSTANCE); |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
150 |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
151 if (nodes != null) { |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
152 for (int i = 0; i < nodes.getLength(); i++) { |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
153 Element e = (Element)nodes.item(i); |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
154 if(!outputExists(e.getAttribute("name"), context)) { |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
155 outs.removeChild(e); |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
156 } |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
157 } |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
158 } |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
159 return attrs; |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
160 } |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
161 |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
162 |
2728
306b9d0f0fb3
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2594
diff
changeset
|
163 /** |
306b9d0f0fb3
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2594
diff
changeset
|
164 * True if current MasterArtifact has given output. |
306b9d0f0fb3
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2594
diff
changeset
|
165 * @param name Name of the output of interest. |
306b9d0f0fb3
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2594
diff
changeset
|
166 * @param context current context |
3081
26119b7b3154
Fixing output generator hacking
Christian Lins <christian.lins@intevation.de>
parents:
2737
diff
changeset
|
167 * @return true if current master artifact has given output. |
2728
306b9d0f0fb3
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2594
diff
changeset
|
168 */ |
2594
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
169 protected boolean outputExists(String name, CallContext context) { |
2585
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
170 FLYSArtifact master = getMasterArtifact(context); |
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
171 List<Output> outList = master.getOutputs(context); |
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
172 |
2594
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
173 for (Output o : outList) { |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
174 if (name.equals(o.getName())) { |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
175 return true; |
2585
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
176 } |
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
177 } |
2594
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
178 return false; |
2585
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 |
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
|
181 /** |
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
|
182 * @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
|
183 * 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
|
184 * @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
|
185 * 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
|
186 * |
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 * @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
|
188 */ |
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 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
|
190 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
|
191 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
|
192 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
|
193 ) { |
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 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
|
195 |
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 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
|
197 |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
198 try { |
1013
73330e89b0af
Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
971
diff
changeset
|
199 // 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
|
200 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
|
201 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
202 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
|
203 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
204 return true; |
971
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
205 } |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
206 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
|
207 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
|
208 } |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
209 |
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
|
210 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
|
211 } |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
212 |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
213 |
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 * 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
|
216 * 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
|
217 * because mergeAttributes() only merges the art:outputs nodes - all |
3442
cd5eb8f5f6f1
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3422
diff
changeset
|
218 * other nodes are skipped. |
971
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
219 */ |
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
|
220 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
|
221 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
|
222 oldAttrs, |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
223 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
|
224 XPathConstants.NODE, |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
225 ArtifactNamespaceContext.INSTANCE); |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
226 |
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
|
227 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
|
228 } |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
229 |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
230 |
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
|
231 /** |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
232 * 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
|
233 * 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
|
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 * @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
|
236 * @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
|
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 * @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
|
239 */ |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
240 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
|
241 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
|
242 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
|
243 ) { |
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 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
|
245 |
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 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
|
247 ? 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
|
248 : 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
|
249 |
3555
b1912514e0f5
s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3452
diff
changeset
|
250 if (outputMap == null || outputMap.isEmpty()) { |
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
|
251 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
|
252 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
|
253 } |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
254 |
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 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
|
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 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
|
258 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
|
259 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
|
260 |
3295
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
261 if (outName.equals("sq_overview")) { |
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
262 continue; |
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
263 } |
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
|
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 ) { |
3295
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
294 OutGenerator outGen = FLYSContext.getOutGenerator(cc, out, null); |
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
|
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); |
3295
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
307 OutputHelper helper = new OutputHelper(identifier()); |
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
308 helper.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
|
309 } |
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 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
|
311 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
|
312 } |
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 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
|
314 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
|
315 } |
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
|
316 |
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 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
|
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 |
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
|
320 |
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
|
321 @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
|
322 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
|
323 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
|
324 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
|
325 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
|
326 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
|
327 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
|
328 { |
3315
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
329 boolean debug = log.isDebugEnabled(); |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
330 |
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
|
331 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
|
332 |
3315
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
333 if (debug) { |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
334 log.debug("FLYSArtifactCollection.out"); |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
335 } |
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 |
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 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
|
338 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
|
339 |
646
d299e220d89c
Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
641
diff
changeset
|
340 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
|
341 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
|
342 |
3315
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
343 if (debug) { |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
344 log.debug("-> Output name = " + name); |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
345 log.debug("-> Output type = " + type); |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
346 log.debug("-> Output subtype = " + subtype); |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
347 } |
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
|
348 |
646
d299e220d89c
Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
641
diff
changeset
|
349 OutGenerator generator = null; |
1780
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
350 if (type != null |
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
351 && type.length() > 0 |
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
352 && type.indexOf("chartinfo") > 0) |
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
353 { |
3295
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
354 generator = FLYSContext.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
|
355 } |
d299e220d89c
Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
641
diff
changeset
|
356 else { |
3295
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
357 generator = FLYSContext.getOutGenerator(context, name, 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
|
358 } |
d299e220d89c
Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
641
diff
changeset
|
359 |
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
|
360 if (generator == null) { |
390
a67748ad4d61
Modified a confusing debug statement.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
388
diff
changeset
|
361 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
|
362 // 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
|
363 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
364 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
|
365 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
366 |
1999
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
367 Document oldAttrs = getAttribute(); |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
368 AttributeParser parser = new AttributeParser(oldAttrs); |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
369 CollectionAttribute cAttr = parser.getCollectionAttribute(); |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
370 |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
371 Output output = cAttr.getOutput(name); |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
372 Settings settings = output.getSettings(); |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
373 |
300
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
374 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
|
375 generator.setSettings(settings); |
3422
118fe1cc8cc8
OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3316
diff
changeset
|
376 generator.setCollection(this); |
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
|
377 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
|
378 |
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
|
379 try { |
1999
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
380 Document attr = getAttribute(context, cAttr, name); |
3295
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
381 OutputHelper helper = new OutputHelper(identifier()); |
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
382 if (name.equals("sq_overview")) { |
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
383 helper.doOut(generator, name, subtype, format, context); |
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
384 } |
4fc442f1b4f6
Refactored FLYSArtifactCollection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3263
diff
changeset
|
385 helper.doOut(generator, name, subtype, attr, context); |
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
|
386 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
|
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 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
|
389 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
|
390 } |
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
|
391 |
3316
2495b24147ff
Forget file to save.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3315
diff
changeset
|
392 if (debug) { |
2495b24147ff
Forget file to save.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3315
diff
changeset
|
393 long duration = System.currentTimeMillis() -reqBegin; |
2495b24147ff
Forget file to save.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3315
diff
changeset
|
394 log.info("Processing out(" + name + ") took " + duration + " ms."); |
2495b24147ff
Forget file to save.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3315
diff
changeset
|
395 } |
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 } |
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
|
397 |
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
|
398 |
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
|
399 /** |
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
|
400 * 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
|
401 * |
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
|
402 * @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
|
403 * @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
|
404 */ |
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
|
405 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
|
406 ) { |
1744
62efd1288e34
Fix setting of masterartifact in flyscollections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1718
diff
changeset
|
407 // 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
|
408 FLYSArtifact master = getMasterArtifact(cc); |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
409 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
|
410 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
|
411 generator.setMasterArtifact(master); |
1780
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
412 } |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
413 else { |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
414 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
|
415 } |
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
|
416 } |
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
|
417 |
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 |
a63d8bdb2d79
Improved the out() operation 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 /** |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
420 * @return masterartifact or null if exception/not found. |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
421 */ |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
422 protected FLYSArtifact getMasterArtifact(CallContext context) |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
423 { |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
424 try { |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
425 ArtifactDatabase db = context.getDatabase(); |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
426 CallMeta callMeta = context.getMeta(); |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
427 Document document = db.getCollectionsMasterArtifact( |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
428 identifier(), callMeta); |
1972
3c3e81fca092
Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1950
diff
changeset
|
429 |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
430 String masterUUID = XMLUtils.xpathString( |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
431 document, XPATH_MASTER_UUID, ArtifactNamespaceContext.INSTANCE); |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
432 FLYSArtifact masterArtifact = |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
433 (FLYSArtifact) getArtifact(masterUUID, context); |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
434 return masterArtifact; |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
435 } |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
436 catch (ArtifactDatabaseException ade) { |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
437 log.error(ade, ade); |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
438 } |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
439 return null; |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
440 } |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
441 |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
442 |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
443 /** |
1628
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1175
diff
changeset
|
444 * 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
|
445 * @param uuids List of artifact uuids. |
1628
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1175
diff
changeset
|
446 */ |
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
|
447 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
|
448 ArtifactDatabase db, |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
449 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
|
450 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
|
451 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
|
452 { |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
453 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
|
454 |
1785
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
455 FLYSContext flysContext = FLYSUtils.getFlysContext(context); |
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
456 StateEngine engine = (StateEngine) flysContext.get( |
3608
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
457 FLYSContext.STATE_ENGINE_KEY); |
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
458 |
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
459 if (engine == null) { |
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
460 log.error("buildOutAttributes: engine == null"); |
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
461 return null; |
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
462 } |
1785
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
463 |
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
464 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
|
465 |
3608
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
466 if (masterArtifact == null) { |
3606 | 467 log.debug("buildOutAttributes: masterArtifact == null"); |
468 return null; | |
469 } | |
470 | |
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
|
471 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
|
472 |
1709
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
473 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
|
474 for (String uuid: uuids) { |
1175
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
475 try { |
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
476 oParser.parse(uuid); |
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
477 } |
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
478 catch (ArtifactDatabaseException ade) { |
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
479 log.warn(ade, ade); |
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
480 } |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
481 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
482 } |
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
|
483 |
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
|
484 aParser.parse(); |
1950
37a7b3841565
Include state data items in description document of collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
485 |
3606 | 486 AttributeWriter aWriter = new AttributeWriter( |
1709
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
487 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
|
488 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
|
489 aParser.getOuts(), |
1785
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
490 aParser.getFacets(), |
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
491 oParser.getOuts(), |
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
492 oParser.getFacets(), |
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
493 engine.getCompatibleFacets(masterArtifact.getStateHistoryIds()) |
3606 | 494 ); |
495 return aWriter.write(); | |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
496 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
497 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
498 |
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
|
499 /** |
1780
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
500 * Returns the "attribute" (part of description document) for a specific |
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
501 * 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
|
502 * |
1999
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
503 * @param context The CallContext object. |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
504 * @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
|
505 * @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
|
506 * |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
507 * @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
|
508 */ |
1999
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
509 protected Document getAttribute( |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
510 CallContext context, |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
511 CollectionAttribute cAttr, |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
512 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
|
513 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
|
514 { |
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
|
515 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
|
516 |
3263
68320805566a
Removed dynamic XPaths to pervent potential XPath injections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3245
diff
changeset
|
517 Map<String, String> vars = new HashMap<String, String>(); |
68320805566a
Removed dynamic XPaths to pervent potential XPath injections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3245
diff
changeset
|
518 vars.put("output", output); |
68320805566a
Removed dynamic XPaths to pervent potential XPath injections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3245
diff
changeset
|
519 |
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
|
520 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
|
521 attr, |
3263
68320805566a
Removed dynamic XPaths to pervent potential XPath injections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3245
diff
changeset
|
522 "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
|
523 XPathConstants.NODE, |
3263
68320805566a
Removed dynamic XPaths to pervent potential XPath injections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3245
diff
changeset
|
524 ArtifactNamespaceContext.INSTANCE, |
68320805566a
Removed dynamic XPaths to pervent potential XPath injections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3245
diff
changeset
|
525 vars); |
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
|
526 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
527 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
528 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
|
529 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
|
530 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
531 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
|
532 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
533 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
|
534 } |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
535 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
536 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
|
537 } |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
538 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
539 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
540 /** |
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
|
541 * 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
|
542 * 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
|
543 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
544 * @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
|
545 * 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
|
546 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
547 * @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
|
548 */ |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
549 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
|
550 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
|
551 { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
552 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
|
553 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
554 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
|
555 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
|
556 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
557 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
|
558 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
|
559 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
|
560 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
|
561 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
|
562 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
|
563 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
564 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
|
565 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
|
566 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
|
567 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
568 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
569 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
|
570 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
571 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
|
572 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
573 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
|
574 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
|
575 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
|
576 "@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
|
577 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
|
578 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
579 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
|
580 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
|
581 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
582 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
583 |
3452
200e70f31f6f
Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3442
diff
changeset
|
584 return uuids.toArray(new String[uuids.size()]); |
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
|
585 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
586 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
587 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
588 /** |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
589 * 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
|
590 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
591 * @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
|
592 * @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
|
593 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
594 * @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
|
595 */ |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
596 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
|
597 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
|
598 { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
599 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
|
600 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
601 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
|
602 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
|
603 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
604 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
|
605 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
606 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
607 |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
608 } |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
609 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |