Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java @ 945:59ae2a823e73
Use the Facet.toXML() method to write facet elements into the DESCRIBE document of the Collection.
flys-artifacts/trunk@2360 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 19 Jul 2011 10:37:57 +0000 |
parents | 853dceead0f4 |
children | a3108f0a2fe7 |
comparison
equal
deleted
inserted
replaced
944:c256061287d7 | 945:59ae2a823e73 |
---|---|
53 | 53 |
54 for (String outName: newAttr.keySet()) { | 54 for (String outName: newAttr.keySet()) { |
55 | 55 |
56 Output a = newAttr.get(outName); | 56 Output a = newAttr.get(outName); |
57 Output b = oldAttr.get(outName); | 57 Output b = oldAttr.get(outName); |
58 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 58 |
59 writeOutput(doc, outs, cr, a, b); | 59 writeOutput(doc, outs, cr, a, b); |
60 } | 60 } |
61 | 61 |
62 return doc; | 62 return doc; |
63 } | 63 } |
97 | 97 |
98 for (int i = 0; i < num; i++) { | 98 for (int i = 0; i < num; i++) { |
99 ManagedFacet fA = (ManagedFacet) a.get(i); | 99 ManagedFacet fA = (ManagedFacet) a.get(i); |
100 | 100 |
101 if (!mergeFacets(doc, cr, output, fA, b)) { | 101 if (!mergeFacets(doc, cr, output, fA, b)) { |
102 writeFacet(doc, cr, output, fA); | 102 Node n = fA.toXML(doc); |
103 | |
104 if (n != null) { | |
105 output.appendChild(n); | |
106 } | |
103 } | 107 } |
104 } | 108 } |
105 } | 109 } |
106 | 110 |
107 | 111 |
110 ElementCreator cr, | 114 ElementCreator cr, |
111 Element output, | 115 Element output, |
112 ManagedFacet a, | 116 ManagedFacet a, |
113 List<Facet> list) | 117 List<Facet> list) |
114 { | 118 { |
115 String name = a.getName() + a.getIndex(); | 119 String nameA = a.getName() + a.getIndex(); |
116 | 120 |
117 if (list == null) { | 121 if (list == null) { |
118 logger.debug("No old facets found."); | 122 logger.debug("No old facets found."); |
119 return false; | 123 return false; |
120 } | 124 } |
121 | 125 |
122 for (Facet facet: list) { | 126 for (Facet facet: list) { |
123 if (name.equals(facet.getName() + facet.getIndex())) { | 127 String nameB = facet.getName() + facet.getIndex(); |
124 writeFacet(doc, cr, output, (ManagedFacet) facet); | 128 |
129 if (nameA.equals(nameB)) { | |
130 Node n = facet.toXML(doc); | |
131 | |
132 if (n != null) { | |
133 output.appendChild(n); | |
134 } | |
135 | |
125 return true; | 136 return true; |
126 } | 137 } |
127 } | 138 } |
128 | 139 |
129 return false; | 140 return false; |
130 } | 141 } |
131 | |
132 | |
133 protected void writeFacet( | |
134 Document doc, | |
135 ElementCreator cr, | |
136 Node output, | |
137 ManagedFacet f) | |
138 { | |
139 Element theme = cr.create("theme"); | |
140 cr.addAttr(theme, "artifact", f.getArtifact(), true); | |
141 cr.addAttr(theme, "facet", f.getName(), true); | |
142 cr.addAttr(theme, "pos", Integer.toString(f.getPosition()), true); | |
143 cr.addAttr(theme, "active", Integer.toString(f.getActive()), true); | |
144 cr.addAttr(theme, "index", Integer.toString(f.getIndex()), true); | |
145 cr.addAttr(theme, "description", f.getDescription(), true); | |
146 | |
147 output.appendChild(theme); | |
148 } | |
149 } | 142 } |
150 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 143 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |