Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 364:8830eecad69e
Added the name of the facet to the parameterlist of OutGenerator.doOut().
flys-artifacts/trunk@1772 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 29 Apr 2011 08:13:56 +0000 |
parents | 8378683fa07a |
children | 4a8d934e745f |
rev | line source |
---|---|
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.collections; |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
300
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
3 import java.io.IOException; |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
4 import java.io.OutputStream; |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
5 import java.util.ArrayList; |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import java.util.Date; |
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
|
7 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
|
8 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
|
9 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
|
10 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import javax.xml.xpath.XPathConstants; |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import org.apache.log4j.Logger; |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import org.w3c.dom.Document; |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import org.w3c.dom.Element; |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import org.w3c.dom.Node; |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
18 import org.w3c.dom.NodeList; |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
300
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
20 import de.intevation.artifacts.Artifact; |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
21 import de.intevation.artifacts.ArtifactDatabase; |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
22 import de.intevation.artifacts.ArtifactDatabaseException; |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.artifacts.ArtifactNamespaceContext; |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.artifacts.CallContext; |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
25 import de.intevation.artifacts.CallMeta; |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
27 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.artifacts.common.utils.XMLUtils; |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
300
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
30 import de.intevation.artifactdatabase.Backend; |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
31 import de.intevation.artifactdatabase.Backend.PersistentArtifact; |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 import de.intevation.artifactdatabase.DefaultArtifactCollection; |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
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
|
34 import de.intevation.flys.artifacts.context.FLYSContext; |
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
|
35 import de.intevation.flys.artifacts.model.ManagedFacet; |
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
|
36 import de.intevation.flys.exports.OutGenerator; |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
37 import de.intevation.flys.themes.Theme; |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
38 import de.intevation.flys.themes.ThemeFactory; |
300
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
39 |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 /** |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 * @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
|
43 */ |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 public class FLYSArtifactCollection extends DefaultArtifactCollection { |
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 /** The logger used in this class.*/ |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 private static Logger log = Logger.getLogger(FLYSArtifactCollection.class); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 /** Constant XPath that points to the outputmodes of an artifact.*/ |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 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
|
52 "/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
|
53 |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
54 public static final String XPATH_COLLECTION_ITEMS = |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
55 "/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
|
56 |
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
|
57 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
|
58 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
59 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
|
60 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
61 |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 @Override |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 public Document describe(CallContext context) { |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 log.debug("FLYSArtifactCollection.describe: " + identifier); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 Document doc = XMLUtils.newDocument(); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 doc, |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 ArtifactNamespaceContext.NAMESPACE_URI, |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 Date creationTime = getCreationTime(); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 String creation = creationTime != null |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 ? Long.toString(creationTime.getTime()) |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 : ""; |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 Element collection = ec.create("artifact-collection"); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 Element artifacts = ec.create("artifacts"); |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
81 Element attributes = ec.create("attribute"); |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 ec.addAttr(collection, "name", getName(), true); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 ec.addAttr(collection, "uuid", identifier(), true); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 ec.addAttr(collection, "creation", creation, true); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 collection.appendChild(artifacts); |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
88 collection.appendChild(attributes); |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 doc.appendChild(collection); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
91 ArtifactDatabase db = context.getDatabase(); |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
92 |
300
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
93 try { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
94 String[] artifactUUIDs = getArtifactUUIDs(context); |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
95 |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
96 Document oldAttrs = getAttribute(); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
97 Document attrs = buildAttributes( |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
98 db, context, |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
99 oldAttrs, |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
100 artifactUUIDs); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
101 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
102 db.setCollectionAttribute(identifier(), context.getMeta(), attrs); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
103 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
104 Node child = attrs.getFirstChild(); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
105 attributes.appendChild(doc.importNode(child, true)); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
106 |
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
|
107 for (String uuid: artifactUUIDs) { |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
108 try { |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
109 artifacts.appendChild( |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
110 buildArtifactNode(db, uuid, context, ec)); |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
111 } |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
112 catch (ArtifactDatabaseException dbe) { |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
113 log.warn(dbe, dbe); |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
114 } |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
115 } |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
116 } |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
117 catch (ArtifactDatabaseException ade) { |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
118 log.error(ade, ade); |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 } |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 return doc; |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 } |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
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
|
125 @Override |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
126 public void out(Document format, OutputStream out, CallContext context) |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
127 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
|
128 { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
129 log.info("FLYSArtifactCollection.out"); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
130 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
131 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
|
132 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
|
133 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
134 String type = 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
|
135 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
|
136 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
137 OutGenerator generator = getOutGenerator(context, name, 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
|
138 if (generator == 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
|
139 log.error("There is no generator specified for output: " + type); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
140 // TODO throw an exception. |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
141 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
142 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
|
143 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
144 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
145 generator.init(format, out, context); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
146 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
147 try { |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
148 doOut(generator, name, getAttribute(context, name), context); |
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
|
149 } |
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
|
150 catch (ArtifactDatabaseException adbe) { |
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
|
151 log.error(adbe, adbe); |
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
|
152 } |
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
|
153 } |
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
|
154 |
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
|
155 |
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
|
156 /** |
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
|
157 * This method creates the concrete output. |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
158 * |
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
|
159 * @param generator The OutGenerator that creates the output. |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
160 * @param outputName The name of the requested output. |
347
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
161 * @param attributes The collection's attributes for this concrete output |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
162 * 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
|
163 * @param context The context object. |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
164 */ |
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
|
165 protected void doOut( |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
166 OutGenerator generator, |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
167 String outName, |
347
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
168 Document attributes, |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
169 CallContext context) |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
170 throws IOException |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
171 { |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
172 log.debug("FLYSArtifactCollection.doOut: " + outName); |
347
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
173 |
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
|
174 ThemeList themeList = new ThemeList(attributes); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
175 |
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
|
176 int size = themeList.size(); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
177 log.debug("Output will contain " + size + " elements."); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
178 |
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
|
179 try { |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
180 for (int i = 0; i < size; i++) { |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
181 ManagedFacet theme = themeList.get(i); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
182 |
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
|
183 if (theme == 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
|
184 continue; |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
185 } |
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
|
186 |
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
|
187 String art = theme.getArtifact(); |
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
|
188 |
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
|
189 if (log.isDebugEnabled()) { |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
190 log.debug("Do output for..."); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
191 log.debug("... artifact: " + art); |
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
|
192 log.debug("... facet: " + theme.getName()); |
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
|
193 } |
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
|
194 |
364
8830eecad69e
Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
353
diff
changeset
|
195 String facetName = theme.getName(); |
8830eecad69e
Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
353
diff
changeset
|
196 |
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
|
197 generator.doOut( |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
198 getArtifact(art, context), |
364
8830eecad69e
Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
353
diff
changeset
|
199 facetName, |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
200 getFacetThemeFromAttribute( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
201 art, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
202 outName, |
364
8830eecad69e
Added the name of the facet to the parameterlist of OutGenerator.doOut().
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
353
diff
changeset
|
203 facetName, |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
204 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
|
205 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
206 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
207 catch (ArtifactDatabaseException ade) { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
208 log.error(ade, ade); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
209 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
210 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
211 generator.generate(); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
212 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
213 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
214 |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
215 protected Document buildAttributes( |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
216 ArtifactDatabase db, |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
217 CallContext context, |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
218 Document oldAttr, |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
219 String[] items) |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
220 { |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
221 Document doc = XMLUtils.newDocument(); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
222 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
223 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
224 doc, |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
225 ArtifactNamespaceContext.NAMESPACE_URI, |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
226 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
227 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
228 AttributeParser aParser = new AttributeParser(); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
229 OutputParser oParser = new OutputParser(db, context.getMeta()); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
230 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
231 for (String uuid: items) { |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
232 try { |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
233 oParser.parse(uuid); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
234 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
235 catch (ArtifactDatabaseException ade) { |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
236 log.warn(ade, ade); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
237 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
238 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
239 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
240 aParser.parse(oldAttr); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
241 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
242 return new AttributeWriter(aParser.getOuts(), oParser.getOuts()).write(); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
243 } |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
244 |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
245 |
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
|
246 /** |
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
|
247 * Returns the attribute for a specific 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
|
248 * |
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
|
249 * @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
|
250 * |
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
|
251 * @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
|
252 */ |
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
|
253 protected Document getAttribute(CallContext context, String output) |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
254 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
|
255 { |
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
|
256 Document attr = buildAttributes( |
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
|
257 context.getDatabase(), |
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
|
258 context, |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
259 getAttribute(), |
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
|
260 getArtifactUUIDs(context)); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
261 |
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
|
262 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
|
263 attr, |
353
8378683fa07a
Bugfix: The outputs of a Collection's attribute document are stored in an outputs node now instead of being stored toplevel in the document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
350
diff
changeset
|
264 "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
|
265 XPathConstants.NODE, |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
266 ArtifactNamespaceContext.INSTANCE); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
267 |
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
|
268 |
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
|
269 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
|
270 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
|
271 |
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
|
272 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
|
273 |
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
|
274 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
|
275 } |
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
|
276 |
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
|
277 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
|
278 } |
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
|
279 |
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
|
280 |
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
|
281 /** |
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
|
282 * 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
|
283 * 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
|
284 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
285 * @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
|
286 * 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
|
287 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
288 * @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
|
289 */ |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
290 protected String[] getArtifactUUIDs(CallContext context) |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
291 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
|
292 { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
293 log.debug("FLYSArtifactCollection.getArtifactUUIDs"); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
294 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
295 ArtifactDatabase db = context.getDatabase(); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
296 CallMeta meta = context.getMeta(); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
297 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
298 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
|
299 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
|
300 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
|
301 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
|
302 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
|
303 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
|
304 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
305 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
|
306 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
|
307 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
|
308 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
309 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
310 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
|
311 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
312 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
|
313 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
314 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
|
315 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
|
316 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
|
317 "@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
|
318 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
|
319 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
320 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
|
321 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
|
322 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
323 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
324 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
325 return (String[]) uuids.toArray(new String[uuids.size()]); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
326 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
327 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
328 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
329 /** |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
330 * 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
|
331 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
332 * @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
|
333 * @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
|
334 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
335 * @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
|
336 */ |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
337 protected Artifact getArtifact(String uuid, CallContext context) |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
338 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
|
339 { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
340 log.debug("FLYSArtifactCollection.getArtifact"); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
341 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
342 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
|
343 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
|
344 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
345 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
|
346 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
347 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
348 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
349 /** |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
350 * Returns the attribute that belongs to an artifact stored in this |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
351 * 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
|
352 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
353 * @param uuid The Artifact's uuid. |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
354 * @param outname The name of the requested output. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
355 * @param facet The name of the requested facet. |
300
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
356 * @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
|
357 * |
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 * @return an attribute in form of a document. |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
359 */ |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
360 protected Document getFacetThemeFromAttribute( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
361 String uuid, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
362 String outName, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
363 String facet, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
364 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
|
365 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
|
366 { |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
367 log.debug("FLYSArtifactCollection.getFacetThemeFromAttribute"); |
300
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
368 |
350
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
369 ArtifactDatabase db = context.getDatabase(); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
370 CallMeta meta = context.getMeta(); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
371 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
372 FLYSContext flysContext = context instanceof FLYSContext |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
373 ? (FLYSContext) context |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
374 : (FLYSContext) context.globalContext(); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
375 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
376 Map<String, String> mappings = (Map<String, String>) |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
377 flysContext.get(FLYSContext.THEME_MAPPING); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
378 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
379 String themeName = mappings.get(facet); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
380 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
381 Document attr = db.getCollectionItemAttribute(identifier(), uuid, meta); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
382 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
383 if (attr == null) { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
384 attr = initItemAttribute(uuid, facet, context); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
385 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
386 if (attr == null) { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
387 return null; |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
388 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
389 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
390 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
391 log.debug("Search attribute of collection item: " + uuid); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
392 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
393 Node tmp = (Node) XMLUtils.xpath( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
394 attr, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
395 "/art:attribute", |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
396 XPathConstants.NODE, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
397 ArtifactNamespaceContext.INSTANCE); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
398 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
399 if (tmp == null) { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
400 log.warn("No attribute found. Operation failed."); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
401 return null; |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
402 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
403 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
404 log.debug("Search theme '" + themeName + "' in attribute."); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
405 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
406 Node theme = (Node) XMLUtils.xpath( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
407 tmp, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
408 "art:themes/theme[@name='" + themeName + "']", |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
409 XPathConstants.NODE, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
410 ArtifactNamespaceContext.INSTANCE); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
411 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
412 if (theme == null) { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
413 log.warn("Could not find the theme in attribute of: " + uuid); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
414 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
415 Theme t = getThemeForFacet(uuid, facet, context); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
416 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
417 if (t == null) { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
418 log.warn("No theme found for facet: " + facet); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
419 return null; |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
420 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
421 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
422 addThemeToAttribute(uuid, attr, t, context); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
423 theme = t.toXML().getFirstChild(); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
424 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
425 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
426 Document doc = XMLUtils.newDocument(); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
427 doc.appendChild(doc.importNode(theme, true)); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
428 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
429 return doc; |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
430 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
431 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
432 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
433 /** |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
434 * Adds the theme of a facet to a CollectionItem's attribute. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
435 * |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
436 * @param uuid The uuid of the artifact. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
437 * @param attr The current attribute of an artifact. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
438 * @param t The theme to add. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
439 * @param context The CallContext. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
440 */ |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
441 protected void addThemeToAttribute( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
442 String uuid, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
443 Document attr, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
444 Theme t, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
445 CallContext context) |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
446 { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
447 log.debug("FLYSArtifactCollection.addThemeToAttribute: " + uuid); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
448 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
449 if (t == null) { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
450 log.warn("Theme is empty - cancel adding it to attribute!"); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
451 return; |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
452 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
453 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
454 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
455 attr, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
456 ArtifactNamespaceContext.NAMESPACE_URI, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
457 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
458 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
459 Node tmp = (Node) XMLUtils.xpath( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
460 attr, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
461 "/art:attribute", |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
462 XPathConstants.NODE, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
463 ArtifactNamespaceContext.INSTANCE); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
464 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
465 if (tmp == null) { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
466 tmp = ec.create("attribute"); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
467 attr.appendChild(tmp); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
468 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
469 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
470 Node themes = (Node) XMLUtils.xpath( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
471 tmp, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
472 "art:themes", |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
473 XPathConstants.NODE, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
474 ArtifactNamespaceContext.INSTANCE); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
475 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
476 if (themes == null) { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
477 themes = ec.create("themes"); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
478 tmp.appendChild(themes); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
479 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
480 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
481 themes.appendChild(attr.importNode(t.toXML().getFirstChild(), true)); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
482 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
483 try { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
484 setCollectionItemAttribute(uuid, attr, context); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
485 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
486 log.debug("Successfully added theme to item attribute."); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
487 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
488 catch (ArtifactDatabaseException e) { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
489 // do nothing |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
490 log.warn("Cannot set attribute of item: " + uuid); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
491 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
492 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
493 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
494 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
495 /** |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
496 * Initializes the attribute of an collection item with the theme of a |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
497 * specific facet. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
498 * |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
499 * @param uuid The uuid of an artifact. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
500 * @param facet The name of a facet. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
501 * @param context The CallContext. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
502 * |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
503 * @param the new attribute. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
504 */ |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
505 protected Document initItemAttribute( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
506 String uuid, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
507 String facet, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
508 CallContext context) |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
509 { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
510 log.info("FLYSArtifactCollection.initItemAttribute"); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
511 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
512 Theme t = getThemeForFacet(uuid, facet, context); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
513 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
514 if (t == null) { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
515 log.info("Could not find theme for facet. Cancel initialization."); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
516 return null; |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
517 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
518 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
519 Document attr = XMLUtils.newDocument(); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
520 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
521 addThemeToAttribute(uuid, attr, t, context); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
522 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
523 return attr; |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
524 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
525 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
526 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
527 /** |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
528 * Sets the attribute of a CollectionItem specified by <i>uuid</i> to a new |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
529 * value <i>attr</i>. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
530 * |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
531 * @param uuid The uuid of the CollectionItem. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
532 * @param attr The new attribute for the CollectionItem. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
533 * @param context The CallContext. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
534 */ |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
535 public void setCollectionItemAttribute( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
536 String uuid, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
537 Document attr, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
538 CallContext context) |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
539 throws ArtifactDatabaseException |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
540 { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
541 Document doc = ClientProtocolUtils.newSetItemAttributeDocument( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
542 uuid, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
543 attr); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
544 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
545 if (doc == null) { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
546 log.warn("Cannot set item attribute: No attribute found."); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
547 return; |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
548 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
549 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
550 ArtifactDatabase db = context.getDatabase(); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
551 CallMeta meta = context.getMeta(); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
552 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
553 db.setCollectionItemAttribute(identifier(), uuid, doc, meta); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
554 } |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
555 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
556 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
557 /** |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
558 * Returns the theme of a specific facet. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
559 * |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
560 * @param uuid The uuid of an artifact. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
561 * @param facet The name of the facet. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
562 * @param context The CallContext object. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
563 * |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
564 * @return the desired theme. |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
565 */ |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
566 protected Theme getThemeForFacet( |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
567 String uuid, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
568 String facet, |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
569 CallContext context) |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
570 { |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
571 log.info("FLYSArtifactCollection.getThemeForFacet: " + facet); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
572 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
573 FLYSContext flysContext = context instanceof FLYSContext |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
574 ? (FLYSContext) context |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
575 : (FLYSContext) context.globalContext(); |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
576 |
2465dc296395
The OutGenerator gets the theme of a facet while output creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
577 return ThemeFactory.getTheme(flysContext, facet); |
300
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
578 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
579 |
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 |
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 * Returns the OutGenerator for a specified <i>type</i>. |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
583 * |
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 * @param name The name of the output type. |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
585 * @param type Defines the type of the desired OutGenerator. |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
586 * |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
587 * @return The OutGenerator specified by <i>type</i>. |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
588 */ |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
589 protected OutGenerator getOutGenerator( |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
590 CallContext context, |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
591 String name, |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
592 String type) |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
593 { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
594 FLYSContext flysContext = context instanceof FLYSContext |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
595 ? (FLYSContext) context |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
596 : (FLYSContext) context.globalContext(); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
597 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
598 Map<String, Class> generators = (Map<String, Class>) |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
599 flysContext.get(FLYSContext.OUTGENERATORS_KEY); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
600 |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
601 if (generators == null) { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
602 log.error("No output generators found in the running application!"); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
603 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
|
604 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
605 |
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 Class clazz = generators.get(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
|
607 |
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 try { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
609 return clazz != null ? (OutGenerator) clazz.newInstance() : null; |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
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 catch (InstantiationException ie) { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
612 log.error(ie, ie); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
613 } |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
614 catch (IllegalAccessException iae) { |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
615 log.error(iae, iae); |
9a0e1289bab6
The FLYSArtifactCollection overrides out() and uses OutGenerators to create output for this operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
296
diff
changeset
|
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 |
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 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
|
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 |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
622 protected Element buildArtifactNode( |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
623 ArtifactDatabase database, |
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
624 String uuid, |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
625 CallContext context, |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
626 XMLUtils.ElementCreator ec) |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
627 throws ArtifactDatabaseException |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
628 { |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
629 log.debug("Append artifact '" + uuid + "' to collection description"); |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
630 |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
631 // TODO |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
632 String hash = "MYHASH"; |
156
d03b8bbeb853
Added the hash code of an artifact to the artifact part of the collection's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
148
diff
changeset
|
633 |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
634 Element ci = ec.create("artifact"); |
148
2649ada6b053
Bugfix: Added a missing artifact namespace prefix in the DESCRIBE document of a FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
147
diff
changeset
|
635 ec.addAttr(ci, "uuid", uuid, true); |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
636 ec.addAttr(ci, "hash", hash, true); |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
637 |
346
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
638 // XXX I am not sure if it works well every time with an empty document |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
639 // in the describe operation of an artifact. |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
640 Document description = database.describe(uuid, null, context.getMeta()); |
16161de47662
The Attributes of a collection are written into its DESCRIBE now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
641 |
293
3419b1c8ca28
Removed the Backend reference from FLYSArtifactCollection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
156
diff
changeset
|
642 Node outputModes = (Node) XMLUtils.xpath( |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
643 description, |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
644 XPATH_ARTIFACT_OUTPUTMODES, |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
645 XPathConstants.NODE, |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
646 ArtifactNamespaceContext.INSTANCE); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
647 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
648 if (outputModes != null) { |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
649 Document doc = ci.getOwnerDocument(); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
650 ci.appendChild(doc.importNode(outputModes, true)); |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
651 } |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
652 |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
653 return ci; |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
654 } |
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
|
655 |
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
|
656 |
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
|
657 /** |
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
|
658 * Inner class to structure/order the themes of a chart. |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
659 */ |
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
|
660 private class ThemeList { |
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
|
661 private Logger logger = Logger.getLogger(ThemeList.class); |
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
|
662 protected Map<Integer, ManagedFacet> themes; |
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
|
663 |
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
|
664 public ThemeList(Document output) { |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
665 themes = new HashMap<Integer, ManagedFacet>(); |
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
|
666 parse(output); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
667 } |
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
|
668 |
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
|
669 protected void parse(Document output) { |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
670 NodeList themes = (NodeList) 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
|
671 output, |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
672 "art:output/art:theme", |
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
|
673 XPathConstants.NODESET, |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
674 ArtifactNamespaceContext.INSTANCE); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
675 |
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
|
676 int num = themes != null ? themes.getLength() : 0; |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
677 |
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
|
678 logger.debug("Output has " + num + " elements."); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
679 |
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
|
680 if (num == 0) { |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
681 return; |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
682 } |
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
|
683 |
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
|
684 for (int i = 0; i < num; i++) { |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
685 Node theme = themes.item(i); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
686 |
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
|
687 String name = XMLUtils.xpathString( |
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
|
688 theme, "@art:facet", ArtifactNamespaceContext.INSTANCE); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
689 |
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
|
690 String uuid = XMLUtils.xpathString( |
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
|
691 theme, "@art:artifact", ArtifactNamespaceContext.INSTANCE); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
692 |
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
|
693 String pos = XMLUtils.xpathString( |
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
|
694 theme, "@art:pos", ArtifactNamespaceContext.INSTANCE); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
695 |
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
|
696 String active = XMLUtils.xpathString( |
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
|
697 theme, "@art:active", ArtifactNamespaceContext.INSTANCE); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
698 |
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
|
699 addTheme(uuid, name, pos, active); |
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
|
700 } |
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
|
701 } |
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
|
702 |
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
|
703 protected void addTheme( |
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
|
704 String uuid, |
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
|
705 String name, |
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
|
706 String position, |
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
|
707 String active) |
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
|
708 { |
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
|
709 if (logger.isDebugEnabled()) { |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
710 logger.debug("Add theme: "); |
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
|
711 logger.debug(".. name: " + name); |
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
|
712 logger.debug(".. uuid: " + uuid); |
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
|
713 logger.debug(".. position: " + position); |
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
|
714 logger.debug(".. active: " + active); |
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
|
715 } |
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
|
716 |
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
|
717 try { |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
718 Integer pos = new Integer(position); |
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
|
719 Integer act = new Integer(active); |
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
|
720 |
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
|
721 themes.put(pos, new ManagedFacet(name, null, uuid, pos, act)); |
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
|
722 } |
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
|
723 catch (NumberFormatException nfe) { |
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
|
724 // do nothing |
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
|
725 } |
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
|
726 } |
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
|
727 |
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
|
728 public ManagedFacet get(int idx) { |
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
|
729 return themes.get(new Integer(idx)); |
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
|
730 } |
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
|
731 |
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
|
732 public int size() { |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
733 return themes.size(); |
a63d8bdb2d79
Improved the out() operation of a Collection - the OutGenerator gets to know about the facets and its theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
346
diff
changeset
|
734 } |
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
|
735 } |
147
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
736 } |
76cc1a66a05f
Implemented a FLYSArtifactCollection that will be used in this application now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
737 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |