comparison flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java @ 1634:cc47828a1390

Added documentation. flys-artifacts/trunk@2813 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 23 Sep 2011 04:21:16 +0000
parents 16c74ca3586e
children 1b5204203e18
comparison
equal deleted inserted replaced
1633:f84ddc205c8b 1634:cc47828a1390
17 import de.intevation.artifacts.common.utils.XMLUtils; 17 import de.intevation.artifacts.common.utils.XMLUtils;
18 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; 18 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
19 19
20 import de.intevation.flys.artifacts.model.ManagedFacet; 20 import de.intevation.flys.artifacts.model.ManagedFacet;
21 21
22 22 /**
23 * Create attribute- element of describe document of an ArtifactCollection.
24 * The attribute-element contains the merged output of all outputmodes and
25 * facets that are part of the collection.
26 */
23 public class AttributeWriter { 27 public class AttributeWriter {
24 28
25 protected Map<String, Output> oldAttr; 29 protected Map<String, Output> oldAttr;
26 protected Map<String, Output> newAttr; 30 protected Map<String, Output> newAttr;
27 31
28 private static Logger logger = Logger.getLogger(AttributeWriter.class); 32 private static Logger logger = Logger.getLogger(AttributeWriter.class);
29 33
30 34
35 /**
36 * Create a AttributeWriter.
37 * Attributes not present in newAttr will not be included in the document.
38 * @param oldAttr "Old" (possibly user-changed) outputs.
39 * @param newAttr "New" (eventually re-read in its original, unchagnged
40 * form) outputs.
41 */
31 public AttributeWriter( 42 public AttributeWriter(
32 Map<String, Output> oldAttr, 43 Map<String, Output> oldAttr,
33 Map<String, Output> newAttr) 44 Map<String, Output> newAttr)
34 { 45 {
35 this.oldAttr = oldAttr; 46 this.oldAttr = oldAttr;
36 this.newAttr = newAttr; 47 this.newAttr = newAttr;
37 } 48 }
38 49
39 50
40 /** 51 /**
41 * Create document 52 * Create document by merging outputs given in
53 * constructor.
54 * The "new" set rules about existance of attributes, so anything not
55 * present in it will not be included in the resulting document.
56 * The "old" set rules about the content of attributes (as user changes
57 * are recorded here and not in the new set).
58 * @return document with merged outputs as described.
42 */ 59 */
43 protected Document write() { 60 protected Document write() {
44 Document doc = XMLUtils.newDocument(); 61 Document doc = XMLUtils.newDocument();
45 62
46 ElementCreator cr = new ElementCreator( 63 ElementCreator cr = new ElementCreator(
62 writeOutput(doc, outs, cr, a, b); 79 writeOutput(doc, outs, cr, a, b);
63 } 80 }
64 81
65 return doc; 82 return doc;
66 } 83 }
84
67 85
68 /** 86 /**
69 * @param doc Document to add output nodes to 87 * @param doc Document to add output nodes to
70 * @param outs Node in Document to add output nodes to 88 * @param outs Node in Document to add output nodes to
71 * @param a the new output 89 * @param a the new output

http://dive4elements.wald.intevation.org