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