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