Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java @ 8856:5e38e2924c07 3.2.x
Fix code style.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:12:01 +0100 |
parents | 994995baa32b |
children | 0a5239a1e46e |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5867
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5867
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
9 package org.dive4elements.river.collections; |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
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
|
11 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
|
12 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
|
13 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
|
14 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
|
15 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
|
16 import java.util.Map; |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 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
|
19 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 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
|
21 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
|
22 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
|
23 import org.w3c.dom.Node; |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
24 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
|
25 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
26 import org.dive4elements.artifactdatabase.Backend; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
27 import org.dive4elements.artifactdatabase.Backend.PersistentArtifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
28 import org.dive4elements.artifactdatabase.DefaultArtifactCollection; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
29 import org.dive4elements.artifactdatabase.state.Facet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
30 import org.dive4elements.artifactdatabase.state.Output; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
31 import org.dive4elements.artifactdatabase.state.Settings; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
32 import org.dive4elements.artifactdatabase.state.StateEngine; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
33 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
34 import org.dive4elements.artifacts.ArtifactDatabase; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
35 import org.dive4elements.artifacts.ArtifactDatabaseException; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
36 import org.dive4elements.artifacts.ArtifactNamespaceContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
37 import org.dive4elements.artifacts.CallContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
38 import org.dive4elements.artifacts.CallMeta; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
39 import org.dive4elements.artifacts.common.utils.XMLUtils; |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
40 import org.dive4elements.river.artifacts.D4EArtifact; |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
41 import org.dive4elements.river.artifacts.context.RiverContext; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
42 import org.dive4elements.river.exports.OutGenerator; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5046
diff
changeset
|
43 import org.dive4elements.river.exports.OutputHelper; |
5865
73da40528cf2
River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
44 import org.dive4elements.river.utils.RiverUtils; |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 /** |
4966
86d825d1173f
FLYSArtifactCollection: Doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4499
diff
changeset
|
47 * Collection of artifacts, can do outs, describe. |
86d825d1173f
FLYSArtifactCollection: Doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4499
diff
changeset
|
48 * Lots of stuff done in AttributeParser and AttributeWriter. |
86d825d1173f
FLYSArtifactCollection: Doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4499
diff
changeset
|
49 * Critical out and facet merging. |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 * @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
|
51 */ |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
52 public class D4EArtifactCollection extends DefaultArtifactCollection { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7077
diff
changeset
|
53 /** The log used in this class. */ |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
54 private static Logger log = Logger.getLogger(D4EArtifactCollection.class); |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
1013
73330e89b0af
Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
971
diff
changeset
|
56 /** 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
|
57 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
|
58 "/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
|
59 |
1950
37a7b3841565
Include state data items in description document of collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
60 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
|
61 "/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
|
62 |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
63 public static final String XPATH_COLLECTION_ITEMS = |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
64 "/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
|
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 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
|
67 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
68 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
|
69 |
1780
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
70 /** Xpath to master artifacts uuid. */ |
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
71 public static final String XPATH_MASTER_UUID = |
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
72 "/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
|
73 |
971
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
74 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
|
75 "/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
|
76 |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
77 private CallContext context; |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
78 |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
79 private ArtifactDatabase db; |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
80 |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
81 protected CallContext getContext() { |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
82 return this.context; |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
83 } |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
84 |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
85 protected ArtifactDatabase getArtifactDB() { |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
86 return this.db; |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
87 } |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
88 |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
89 protected void setContext(CallContext context) { |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
90 this.context = context; |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
91 this.db = context.getDatabase(); |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
92 } |
300
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
93 |
1628
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1175
diff
changeset
|
94 /** |
4966
86d825d1173f
FLYSArtifactCollection: Doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4499
diff
changeset
|
95 * Create and return description Document for this collection. |
1628
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1175
diff
changeset
|
96 */ |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 @Override |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 public Document describe(CallContext context) { |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
99 log.debug("D4EArtifactCollection.describe: " + identifier); |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
101 setContext(context); |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
102 |
1972
3c3e81fca092
Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1950
diff
changeset
|
103 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
|
104 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
|
105 context); |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
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 |
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
|
108 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
|
109 AttributeParser parser = new AttributeParser(oldAttrs); |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
110 |
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
|
111 try { |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
112 String[] aUUIDs = getArtifactUUIDs(); |
2585
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
113 |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
114 oldAttrs = removeAttributes(oldAttrs); |
2585
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
115 parser = new AttributeParser(oldAttrs); |
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
116 |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
117 CollectionAttribute newAttr = mergeAttributes(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
|
118 |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
119 if (checkOutputSettings(newAttr)) { |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
120 saveCollectionAttribute(newAttr); |
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
|
121 } |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
122 |
1972
3c3e81fca092
Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1950
diff
changeset
|
123 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
|
124 |
3315
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
125 if (aUUIDs != null) { |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
126 for (String uuid: aUUIDs) { |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
127 helper.addArtifact(uuid); |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
128 } |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
129 } |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
130 } |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
131 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
|
132 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
|
133 |
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
|
134 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
|
135 } |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 |
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
|
137 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
|
138 } |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 |
971
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
141 /** |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
142 * 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
|
143 * artifacts in the Collection. |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
144 * |
1709
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
145 * @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
|
146 */ |
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
|
147 protected CollectionAttribute 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
|
148 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
|
149 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
|
150 ) { |
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
|
151 CollectionAttribute cAttribute = |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
152 buildOutAttributes(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
|
153 |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3608
diff
changeset
|
154 if (cAttribute == null) { |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3608
diff
changeset
|
155 log.warn("mergeAttributes: cAttribute == null"); |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3608
diff
changeset
|
156 return null; |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3608
diff
changeset
|
157 } |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3608
diff
changeset
|
158 |
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
|
159 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
|
160 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
|
161 |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
162 saveCollectionAttribute(cAttribute); |
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
|
163 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
164 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
|
165 } |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
166 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
167 |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
168 /** |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
169 * Remove those output-elements which have a name that does |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
170 * not appear in master artifacts out-list. |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
171 * @param attr[in,out] Document to clean and return. |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
172 * @return param attr. |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
173 */ |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
174 protected Document removeAttributes(Document attrs) { |
2594
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
175 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
|
176 attrs, |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
177 "/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
|
178 XPathConstants.NODE, |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
179 ArtifactNamespaceContext.INSTANCE); |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
180 |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
181 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
|
182 attrs, |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
183 "/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
|
184 XPathConstants.NODESET, |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
185 ArtifactNamespaceContext.INSTANCE); |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
186 |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
187 if (nodes != null) { |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
188 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
|
189 Element e = (Element)nodes.item(i); |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
190 if(!outputExists(e.getAttribute("name"))) { |
2594
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
191 outs.removeChild(e); |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
192 } |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
193 } |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
194 } |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
195 return attrs; |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
196 } |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
197 |
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
198 |
2728
306b9d0f0fb3
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2594
diff
changeset
|
199 /** |
306b9d0f0fb3
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2594
diff
changeset
|
200 * True if current MasterArtifact has given output. |
306b9d0f0fb3
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2594
diff
changeset
|
201 * @param name Name of the output of interest. |
306b9d0f0fb3
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2594
diff
changeset
|
202 * @param context current context |
3081
26119b7b3154
Fixing output generator hacking
Christian Lins <christian.lins@intevation.de>
parents:
2737
diff
changeset
|
203 * @return true if current master artifact has given output. |
2728
306b9d0f0fb3
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2594
diff
changeset
|
204 */ |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
205 protected boolean outputExists(String name) { |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
206 D4EArtifact master = getMasterArtifact(); |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
207 List<Output> outList = master.getOutputs(getContext()); |
2585
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
208 |
2594
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
209 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
|
210 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
|
211 return true; |
2585
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
212 } |
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
213 } |
2594
226c360febae
Remove unnecessary outputs from attributes instead of copying outs to
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2585
diff
changeset
|
214 return false; |
2585
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
215 } |
a71fc8f2030c
Issue 640.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2325
diff
changeset
|
216 |
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
|
217 /** |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
218 * @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
|
219 * 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
|
220 * @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
|
221 * 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
|
222 * |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
223 * @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
|
224 */ |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
225 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
|
226 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
|
227 ) { |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
228 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
|
229 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
230 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
|
231 |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
232 try { |
1013
73330e89b0af
Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
971
diff
changeset
|
233 // Save the merged document into database. |
8856 | 234 getArtifactDB().setCollectionAttribute( |
235 identifier(), getContext().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
|
236 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
237 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
|
238 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
239 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
|
240 } |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
241 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
|
242 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
|
243 } |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
244 |
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
|
245 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
|
246 } |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
247 |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
248 |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
249 /** |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
250 * 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
|
251 * 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
|
252 * because mergeAttributes() only merges the art:outputs nodes - all |
3442
cd5eb8f5f6f1
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3422
diff
changeset
|
253 * 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
|
254 */ |
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
|
255 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
|
256 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
|
257 oldAttrs, |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
258 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
|
259 XPathConstants.NODE, |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
260 ArtifactNamespaceContext.INSTANCE); |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
261 |
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
|
262 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
|
263 } |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
264 |
d0c9a5f32c30
Prepared the FLYSArtifactCollection to support the storage of already loaded recommendations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
945
diff
changeset
|
265 |
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
|
266 /** |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs 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 * 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
|
268 * 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
|
269 * |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs 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 * @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
|
271 * @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
|
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 * @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
|
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 protected boolean checkOutputSettings( |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
276 CollectionAttribute attribute |
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
|
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 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
|
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 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
|
281 ? 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
|
282 : 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
|
283 |
3555
b1912514e0f5
s/container.size() == 0/container.isEmpty()/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3452
diff
changeset
|
284 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
|
285 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
|
286 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
|
287 } |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs 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 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
289 |
4050
975f608dd254
Cleaned up iterating over maps. Removed some dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4024
diff
changeset
|
290 for (Map.Entry<String, Output> entry: outputMap.entrySet()) { |
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
|
291 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
|
292 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
|
293 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
294 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
|
295 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
296 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
|
297 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
|
298 output.setSettings( |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
299 createInitialOutputSettings(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
|
300 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
301 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
|
302 } |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
303 } |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
304 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
305 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
|
306 } |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
307 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
308 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
309 /** |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
310 * 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
|
311 * <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
|
312 * |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
313 * @param cc The CallContext object. |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
314 * @param attr The CollectionAttribute. |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
315 * @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
|
316 * |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
317 * @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
|
318 */ |
1999
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
319 protected Settings createInitialOutputSettings( |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
320 CollectionAttribute attr, |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
321 String out |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
322 ) { |
8220
1d3d61c8f596
Stop stupid propagation of out subtype in generators. What is this? It is not used anyway.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
323 OutGenerator outGen = RiverContext.getOutGenerator(getContext(), out); |
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
|
324 |
1999
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
325 if (outGen == null) { |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
326 return null; |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
327 } |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
328 |
8856 | 329 // XXX NOTE: outGen is not able to process its generate() operation, |
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
|
330 // because it has no OutputStream set! |
8225
724081af301c
Pass request document to the context injectors.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8220
diff
changeset
|
331 Document dummy = XMLUtils.newDocument(); |
724081af301c
Pass request document to the context injectors.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8220
diff
changeset
|
332 outGen.init(out, dummy, null, getContext()); |
8392
994995baa32b
Only the master-artifact should decide about injected CURRENT_KM et al. (and removed dependend obsolete class).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8271
diff
changeset
|
333 D4EArtifact master = getMasterArtifact(); |
994995baa32b
Only the master-artifact should decide about injected CURRENT_KM et al. (and removed dependend obsolete class).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8271
diff
changeset
|
334 prepareMasterArtifact(master, outGen); |
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
|
335 |
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
|
336 try { |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
337 Document outAttr = getAttribute(attr, out); |
8392
994995baa32b
Only the master-artifact should decide about injected CURRENT_KM et al. (and removed dependend obsolete class).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8271
diff
changeset
|
338 OutputHelper helper = new OutputHelper(identifier(), master); |
8225
724081af301c
Pass request document to the context injectors.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8220
diff
changeset
|
339 helper.doOut(outGen, out, out, outAttr, getContext(), dummy); |
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
|
340 } |
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
|
341 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
|
342 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
|
343 } |
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
|
344 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
|
345 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
|
346 } |
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
|
347 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
348 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
|
349 } |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
350 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1976
diff
changeset
|
351 |
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
|
352 @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
|
353 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
|
354 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
|
355 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
|
356 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
|
357 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
|
358 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
|
359 { |
3315
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
360 boolean debug = log.isDebugEnabled(); |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
361 |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
362 setContext(context); |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
363 |
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
|
364 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
|
365 |
3315
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
366 if (debug) { |
4499
b74399bd0960
Improve debugging while merging outs and facets
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4050
diff
changeset
|
367 log.debug(XMLUtils.toString(format)); |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
368 log.debug("D4EArtifactCollection.out"); |
3315
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
369 } |
300
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
370 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
371 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
|
372 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
|
373 |
646
d299e220d89c
Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
641
diff
changeset
|
374 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
|
375 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
|
376 |
3315
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
377 if (debug) { |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
378 log.debug("-> Output name = " + name); |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
379 log.debug("-> Output type = " + type); |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
380 log.debug("-> Output subtype = " + subtype); |
e2d355da4bd6
FLYSArtifactCollection: Lowered log level.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3298
diff
changeset
|
381 } |
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
|
382 |
6975 | 383 // If type contains 'chartinfo' use a generator that |
384 // just allow access to width, height etc. | |
7077
0a337f0005c2
Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6976
diff
changeset
|
385 |
8856 | 386 String key = type != null |
387 && !type.isEmpty() | |
388 && type.indexOf("chartinfo") > 0 | |
7077
0a337f0005c2
Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6976
diff
changeset
|
389 ? type |
0a337f0005c2
Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6976
diff
changeset
|
390 : name; |
0a337f0005c2
Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6976
diff
changeset
|
391 |
8220
1d3d61c8f596
Stop stupid propagation of out subtype in generators. What is this? It is not used anyway.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8202
diff
changeset
|
392 OutGenerator generator = RiverContext.getOutGenerator(context, key); |
646
d299e220d89c
Added support for the 'type' parameter of the collection's out() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
641
diff
changeset
|
393 |
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
|
394 if (generator == null) { |
1013
73330e89b0af
Minor cosmetics, (comments).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
971
diff
changeset
|
395 // 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
|
396 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
397 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
|
398 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
399 |
1999
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
400 Document oldAttrs = getAttribute(); |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
401 AttributeParser parser = new AttributeParser(oldAttrs); |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
402 CollectionAttribute cAttr = parser.getCollectionAttribute(); |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
403 |
5046
ace7a56d8047
FLYSArtifactCollection: WSP cosmetic.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4966
diff
changeset
|
404 Output output = cAttr.getOutput(name); |
4024
62d99de39a8d
Avoid NPE if no attribute outs are present
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3978
diff
changeset
|
405 Settings settings = null; |
62d99de39a8d
Avoid NPE if no attribute outs are present
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3978
diff
changeset
|
406 if (output != null) { |
62d99de39a8d
Avoid NPE if no attribute outs are present
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3978
diff
changeset
|
407 settings = output.getSettings(); |
4499
b74399bd0960
Improve debugging while merging outs and facets
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4050
diff
changeset
|
408 |
b74399bd0960
Improve debugging while merging outs and facets
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4050
diff
changeset
|
409 if (debug) { |
b74399bd0960
Improve debugging while merging outs and facets
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4050
diff
changeset
|
410 List<Facet> facets = output.getFacets(); |
b74399bd0960
Improve debugging while merging outs and facets
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4050
diff
changeset
|
411 for(Facet facet: facets) { |
b74399bd0960
Improve debugging while merging outs and facets
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4050
diff
changeset
|
412 log.debug(" -- Facet " + facet.getName()); |
b74399bd0960
Improve debugging while merging outs and facets
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4050
diff
changeset
|
413 } |
b74399bd0960
Improve debugging while merging outs and facets
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4050
diff
changeset
|
414 } |
4024
62d99de39a8d
Avoid NPE if no attribute outs are present
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3978
diff
changeset
|
415 } |
1999
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
416 |
7077
0a337f0005c2
Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6976
diff
changeset
|
417 generator.init(key, 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
|
418 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
|
419 generator.setCollection(this); |
8392
994995baa32b
Only the master-artifact should decide about injected CURRENT_KM et al. (and removed dependend obsolete class).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8271
diff
changeset
|
420 |
994995baa32b
Only the master-artifact should decide about injected CURRENT_KM et al. (and removed dependend obsolete class).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8271
diff
changeset
|
421 D4EArtifact master = getMasterArtifact(); |
994995baa32b
Only the master-artifact should decide about injected CURRENT_KM et al. (and removed dependend obsolete class).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8271
diff
changeset
|
422 prepareMasterArtifact(master, generator); |
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
|
423 |
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
|
424 try { |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
425 Document attr = getAttribute(cAttr, name); |
8392
994995baa32b
Only the master-artifact should decide about injected CURRENT_KM et al. (and removed dependend obsolete class).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8271
diff
changeset
|
426 OutputHelper helper = new OutputHelper(identifier(), master); |
8225
724081af301c
Pass request document to the context injectors.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
8220
diff
changeset
|
427 helper.doOut(generator, name, subtype, attr, context, format); |
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
|
428 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
|
429 } |
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
|
430 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
|
431 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
|
432 } |
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
|
433 |
3316
2495b24147ff
Forget file to save.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3315
diff
changeset
|
434 if (debug) { |
2495b24147ff
Forget file to save.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3315
diff
changeset
|
435 long duration = System.currentTimeMillis() -reqBegin; |
2495b24147ff
Forget file to save.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3315
diff
changeset
|
436 log.info("Processing out(" + name + ") took " + duration + " ms."); |
2495b24147ff
Forget file to save.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3315
diff
changeset
|
437 } |
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
|
438 } |
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
|
439 |
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
|
440 |
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
|
441 /** |
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
|
442 * 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
|
443 * |
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
|
444 * @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
|
445 */ |
8856 | 446 protected void prepareMasterArtifact( |
447 D4EArtifact master, | |
448 OutGenerator generator | |
449 ) { | |
1744
62efd1288e34
Fix setting of masterartifact in flyscollections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1718
diff
changeset
|
450 // Get master artifact. |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
451 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
|
452 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
|
453 generator.setMasterArtifact(master); |
1780
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
454 } |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
455 else { |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
456 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
|
457 } |
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
|
458 } |
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
|
459 |
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
|
460 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
461 /** |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
462 * @return masterartifact or null if exception/not found. |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
463 */ |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
464 protected D4EArtifact getMasterArtifact() |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
465 { |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
466 try { |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
467 ArtifactDatabase db = getArtifactDB(); |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
468 CallMeta callMeta = getContext().getMeta(); |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
469 Document document = db.getCollectionsMasterArtifact( |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
470 identifier(), callMeta); |
1972
3c3e81fca092
Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1950
diff
changeset
|
471 |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
472 String masterUUID = XMLUtils.xpathString( |
8856 | 473 document, |
474 XPATH_MASTER_UUID, | |
475 ArtifactNamespaceContext.INSTANCE); | |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
476 D4EArtifact masterArtifact = |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
477 (D4EArtifact) getArtifact(masterUUID); |
1784
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
478 return masterArtifact; |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
479 } |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
480 catch (ArtifactDatabaseException ade) { |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
481 log.error(ade, ade); |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
482 } |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
483 return null; |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
484 } |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
485 |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
486 |
0fe3c4849baa
Cosmetics and refactoring in FLYSArtifactCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1780
diff
changeset
|
487 /** |
1628
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1175
diff
changeset
|
488 * 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
|
489 * @param uuids List of artifact uuids. |
1628
16c74ca3586e
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1175
diff
changeset
|
490 */ |
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
|
491 protected CollectionAttribute buildOutAttributes( |
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
|
492 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
|
493 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
|
494 { |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
495 RiverContext flysContext = RiverUtils.getFlysContext(context); |
1785
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
496 StateEngine engine = (StateEngine) flysContext.get( |
5866
9a6741ccf6d4
FLYS artifacts: Renamed FLYSContext(Factory) to RiverContext(Factory).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
497 RiverContext.STATE_ENGINE_KEY); |
3608
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
498 |
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
499 if (engine == null) { |
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
500 log.error("buildOutAttributes: engine == null"); |
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
501 return null; |
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
502 } |
1785
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
503 |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
504 D4EArtifact masterArtifact = getMasterArtifact(); |
1972
3c3e81fca092
Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1950
diff
changeset
|
505 |
3608
53aa395a29e0
FLYSArtifactCollection: Prevent another NPE. Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3606
diff
changeset
|
506 if (masterArtifact == null) { |
3606 | 507 log.debug("buildOutAttributes: masterArtifact == null"); |
508 return null; | |
509 } | |
1972
3c3e81fca092
Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1950
diff
changeset
|
510 |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
511 OutputParser oParser = new OutputParser( |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
512 getArtifactDB(), |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
513 getContext()); |
1972
3c3e81fca092
Added a CollectionDescriptionHelper that helps generating DESCRIBE documents for Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1950
diff
changeset
|
514 |
1709
f643ea084213
Allow simple codepaths to have Facets initially being 'inactive' (wrt rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1684
diff
changeset
|
515 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
|
516 for (String uuid: uuids) { |
1175
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
517 try { |
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
518 oParser.parse(uuid); |
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
519 } |
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
520 catch (ArtifactDatabaseException ade) { |
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
521 log.warn(ade, ade); |
e6b513495281
Prepared FLYSArtifactCollection to live without Artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1060
diff
changeset
|
522 } |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
523 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
524 } |
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
|
525 |
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
|
526 aParser.parse(); |
1950
37a7b3841565
Include state data items in description document of collection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
527 |
3606 | 528 AttributeWriter aWriter = new AttributeWriter( |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
529 getArtifactDB(), |
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
|
530 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
|
531 aParser.getOuts(), |
1785
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
532 aParser.getFacets(), |
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
533 oParser.getOuts(), |
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
534 oParser.getFacets(), |
661dfad9910a
Use compatibility matrix when creating collections output.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1784
diff
changeset
|
535 engine.getCompatibleFacets(masterArtifact.getStateHistoryIds()) |
3606 | 536 ); |
537 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
|
538 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
539 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
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 /** |
1780
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
542 * Returns the "attribute" (part of description document) for a specific |
b503d92dd709
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1772
diff
changeset
|
543 * 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
|
544 * |
1999
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
545 * @param context The CallContext object. |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
546 * @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
|
547 * @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
|
548 * |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
549 * @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
|
550 */ |
1999
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
551 protected Document getAttribute( |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
552 CollectionAttribute cAttr, |
02ce03329ef5
Some optimizations during out() operation of FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1998
diff
changeset
|
553 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
|
554 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
|
555 { |
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
|
556 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
|
557 |
3263
68320805566a
Removed dynamic XPaths to pervent potential XPath injections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3245
diff
changeset
|
558 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
|
559 vars.put("output", output); |
68320805566a
Removed dynamic XPaths to pervent potential XPath injections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3245
diff
changeset
|
560 |
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
|
561 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
|
562 attr, |
3263
68320805566a
Removed dynamic XPaths to pervent potential XPath injections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3245
diff
changeset
|
563 "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
|
564 XPathConstants.NODE, |
3263
68320805566a
Removed dynamic XPaths to pervent potential XPath injections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3245
diff
changeset
|
565 ArtifactNamespaceContext.INSTANCE, |
68320805566a
Removed dynamic XPaths to pervent potential XPath injections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3245
diff
changeset
|
566 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
|
567 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
568 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
569 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
|
570 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
|
571 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
572 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
|
573 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
574 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
|
575 } |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
576 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
577 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
|
578 } |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
579 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
580 |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
581 /** |
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
|
582 * 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
|
583 * 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
|
584 * |
8856 | 585 * @param context CallContext that is necessary to get information about |
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
|
586 * 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
|
587 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
588 * @return 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
|
589 */ |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
590 protected String[] getArtifactUUIDs() |
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
|
591 throws ArtifactDatabaseException |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
592 { |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
593 log.debug("D4EArtifactCollection.getArtifactUUIDs"); |
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
|
594 |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
595 ArtifactDatabase db = getArtifactDB(); |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
596 CallMeta meta = getContext().getMeta(); |
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
|
597 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
598 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
|
599 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
|
600 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
|
601 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
|
602 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
|
603 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
|
604 |
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 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
|
606 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
|
607 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
|
608 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
609 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
610 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
|
611 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
612 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
|
613 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
614 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
|
615 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
|
616 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
|
617 "@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
|
618 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
|
619 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
620 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
|
621 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
|
622 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
623 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
624 |
3452
200e70f31f6f
Removed some superfluous casts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3442
diff
changeset
|
625 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
|
626 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
627 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
628 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
629 /** |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
630 * 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
|
631 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
632 * @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
|
633 * @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
|
634 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
635 * @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
|
636 */ |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
637 protected Artifact getArtifact(String uuid) |
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
|
638 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
|
639 { |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5866
diff
changeset
|
640 log.debug("D4EArtifactCollection.getArtifact"); |
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
|
641 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
642 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
|
643 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
|
644 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
645 return 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
|
646 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
647 |
6600
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
648 /** |
6975 | 649 * Returns artifacts with name name. |
6600
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
650 * |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
651 * @param name The Artifact name to search |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
652 * @param context The CallContext |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
653 * |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
654 * @return a list of artifacts matching this name. |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
655 */ |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
656 public List<Artifact> getArtifactsByName(String name, CallContext context) |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
657 { |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
658 setContext(context); |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
659 return getArtifactsByName(name); |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
660 } |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
661 |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
662 |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
663 /** |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
664 * Returns artifacts with name name. |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
665 * |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
666 * @param name The Artifact name to search |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
667 * |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
668 * @return a list of artifacts matching this name. |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
669 */ |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
670 protected List<Artifact> getArtifactsByName(String name) |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
671 { |
6600
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
672 log.debug("Searching for Artifacts: " + name); |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
673 List<Artifact> ret = new ArrayList<Artifact>(); |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
674 try { |
6976
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
675 for (String uuid: getArtifactUUIDs()) { |
c47f1a1d0f0f
D4EArtifactCollection: Do not push CallContext and reference to db around.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6975
diff
changeset
|
676 D4EArtifact subArt = (D4EArtifact) getArtifact(uuid); |
8856 | 677 if ( |
678 subArt.getName() != null && subArt.getName().equals(name) | |
679 ) { | |
6600
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
680 ret.add(subArt); |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
681 } |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
682 } |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
683 } catch (ArtifactDatabaseException e) { |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
684 log.error("Unexpected Error!", e); |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
685 } finally { |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
686 return ret; |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
687 } |
df1140486ba4
Add getArtifactsByName to collection
Andre Heinecke <aheinecke@intevation.de>
parents:
5994
diff
changeset
|
688 } |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
689 } |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
690 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |