comparison flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java @ 1780:b503d92dd709

Cosmetics, docs. flys-artifacts/trunk@3102 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 28 Oct 2011 09:22:34 +0000
parents f643ea084213
children 661dfad9910a
comparison
equal deleted inserted replaced
1779:2fe270661b20 1780:b503d92dd709
24 import de.intevation.flys.artifacts.model.ManagedFacet; 24 import de.intevation.flys.artifacts.model.ManagedFacet;
25 25
26 /** 26 /**
27 * Create attribute- element of describe document of an ArtifactCollection. 27 * Create attribute- element of describe document of an ArtifactCollection.
28 * The attribute-element contains the merged output of all outputmodes and 28 * The attribute-element contains the merged output of all outputmodes and
29 * facets that are part of the collection. 29 * facets that are part of the collection.
30 */ 30 */
31 public class AttributeWriter { 31 public class AttributeWriter {
32 32
33 /** ArtifactDatabase used to fetch Artifacts. */ 33 /** ArtifactDatabase used to fetch Artifacts. */
34 protected ArtifactDatabase db = null; 34 protected ArtifactDatabase db = null;
43 /** 43 /**
44 * Create a AttributeWriter. 44 * Create a AttributeWriter.
45 * Attributes not present in newAttr will not be included in the document. 45 * Attributes not present in newAttr will not be included in the document.
46 * @param db Database to fetch artifacts. 46 * @param db Database to fetch artifacts.
47 * @param oldAttr "Old" (possibly user-changed) outputs. 47 * @param oldAttr "Old" (possibly user-changed) outputs.
48 * @param newAttr "New" (eventually re-read in its original, unchagnged 48 * @param newAttr "New" (eventually re-read in its original, unchanged
49 * form) outputs. 49 * form) outputs.
50 */ 50 */
51 public AttributeWriter( 51 public AttributeWriter(
52 ArtifactDatabase db, 52 ArtifactDatabase db,
53 Map<String, Output> oldAttr, 53 Map<String, Output> oldAttr,
60 60
61 61
62 /** 62 /**
63 * Create document by merging outputs given in 63 * Create document by merging outputs given in
64 * constructor. 64 * constructor.
65 *
65 * The "new" set rules about existance of attributes, so anything not 66 * The "new" set rules about existance of attributes, so anything not
66 * present in it will not be included in the resulting document. 67 * present in it will not be included in the resulting document.
67 * The "old" set rules about the content of attributes (as user changes 68 * The "old" set rules about the content of attributes (as user changes
68 * are recorded here and not in the new set). 69 * are recorded here and not in the new set).
70 *
69 * @return document with merged outputs as described. 71 * @return document with merged outputs as described.
70 */ 72 */
71 protected Document write() { 73 protected Document write() {
72 Document doc = XMLUtils.newDocument(); 74 Document doc = XMLUtils.newDocument();
73 75
178 conflicts = false; 180 conflicts = false;
179 for (ManagedFacet oldMF: currentFacets) { 181 for (ManagedFacet oldMF: currentFacets) {
180 if (newMF.getPosition() == oldMF.getPosition()) { 182 if (newMF.getPosition() == oldMF.getPosition()) {
181 conflicts = true; 183 conflicts = true;
182 logger.debug("Positional conflict while merging " + 184 logger.debug("Positional conflict while merging " +
183 "facets, pushing newest facet 1 up ("+newMF.getPosition()+")"); 185 "facets, pushing newest facet 1 up (" + newMF.getPosition() + ")");
184 newMF.setPosition(newMF.getPosition() + 1); 186 newMF.setPosition(newMF.getPosition() + 1);
185 break; 187 break;
186 } 188 }
187 } 189 }
188 } 190 }

http://dive4elements.wald.intevation.org