comparison flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java @ 1171:a3108f0a2fe7

Bugfix: merge facets for the Collection's attribute only if the new and old facet's name and owner artifact are equal. flys-artifacts/trunk@2736 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 14 Sep 2011 10:04:19 +0000
parents 59ae2a823e73
children 16c74ca3586e
comparison
equal deleted inserted replaced
1170:1e1ef8b750db 1171:a3108f0a2fe7
65 65
66 protected void writeOutput( 66 protected void writeOutput(
67 Document doc, 67 Document doc,
68 Node outs, 68 Node outs,
69 ElementCreator cr, 69 ElementCreator cr,
70 Output a, 70 Output a, /* new output */
71 Output b) 71 Output b) /* old output */
72 { 72 {
73 Element output = cr.create("output"); 73 Element output = cr.create("output");
74 cr.addAttr(output, "name", a.getName()); 74 cr.addAttr(output, "name", a.getName());
75 75
76 outs.appendChild(output); 76 outs.appendChild(output);
88 88
89 protected void writeFacets( 89 protected void writeFacets(
90 Document doc, 90 Document doc,
91 ElementCreator cr, 91 ElementCreator cr,
92 Element output, 92 Element output,
93 List<Facet> a, 93 List<Facet> a, /* new facets */
94 List<Facet> b) 94 List<Facet> b) /* old facets */
95 { 95 {
96 int num = a.size(); 96 int num = a.size();
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);
111 111
112 protected boolean mergeFacets( 112 protected boolean mergeFacets(
113 Document doc, 113 Document doc,
114 ElementCreator cr, 114 ElementCreator cr,
115 Element output, 115 Element output,
116 ManagedFacet a, 116 ManagedFacet a, /* new facets */
117 List<Facet> list) 117 List<Facet> list) /* old facets */
118 { 118 {
119 String nameA = a.getName() + a.getIndex(); 119 String nameA = a.getName() + a.getIndex();
120 120
121 if (list == null) { 121 if (list == null) {
122 logger.debug("No old facets found."); 122 logger.debug("No old facets found.");
125 125
126 for (Facet facet: list) { 126 for (Facet facet: list) {
127 String nameB = facet.getName() + facet.getIndex(); 127 String nameB = facet.getName() + facet.getIndex();
128 128
129 if (nameA.equals(nameB)) { 129 if (nameA.equals(nameB)) {
130 ManagedFacet b = (ManagedFacet) facet;
131
132 if (!b.getArtifact().equals(a.getArtifact())) {
133 continue;
134 }
135
130 Node n = facet.toXML(doc); 136 Node n = facet.toXML(doc);
131 137
132 if (n != null) { 138 if (n != null) {
133 output.appendChild(n); 139 output.appendChild(n);
134 } 140 }

http://dive4elements.wald.intevation.org