1 | |
package org.apache.maven.archetype.common; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
import org.apache.maven.archetype.common.util.Format; |
31 | |
import org.apache.maven.archetype.common.util.XMLOutputter; |
32 | |
import org.apache.maven.model.Activation; |
33 | |
import org.apache.maven.model.ActivationFile; |
34 | |
import org.apache.maven.model.ActivationOS; |
35 | |
import org.apache.maven.model.ActivationProperty; |
36 | |
import org.apache.maven.model.Build; |
37 | |
import org.apache.maven.model.BuildBase; |
38 | |
import org.apache.maven.model.CiManagement; |
39 | |
import org.apache.maven.model.ConfigurationContainer; |
40 | |
import org.apache.maven.model.Contributor; |
41 | |
import org.apache.maven.model.Dependency; |
42 | |
import org.apache.maven.model.DependencyManagement; |
43 | |
import org.apache.maven.model.DeploymentRepository; |
44 | |
import org.apache.maven.model.Developer; |
45 | |
import org.apache.maven.model.DistributionManagement; |
46 | |
import org.apache.maven.model.Exclusion; |
47 | |
import org.apache.maven.model.Extension; |
48 | |
import org.apache.maven.model.FileSet; |
49 | |
import org.apache.maven.model.IssueManagement; |
50 | |
import org.apache.maven.model.License; |
51 | |
import org.apache.maven.model.MailingList; |
52 | |
import org.apache.maven.model.Model; |
53 | |
import org.apache.maven.model.ModelBase; |
54 | |
import org.apache.maven.model.Notifier; |
55 | |
import org.apache.maven.model.Organization; |
56 | |
import org.apache.maven.model.Parent; |
57 | |
import org.apache.maven.model.PatternSet; |
58 | |
import org.apache.maven.model.Plugin; |
59 | |
import org.apache.maven.model.PluginConfiguration; |
60 | |
import org.apache.maven.model.PluginContainer; |
61 | |
import org.apache.maven.model.PluginExecution; |
62 | |
import org.apache.maven.model.PluginManagement; |
63 | |
import org.apache.maven.model.Prerequisites; |
64 | |
import org.apache.maven.model.Profile; |
65 | |
import org.apache.maven.model.Relocation; |
66 | |
import org.apache.maven.model.ReportPlugin; |
67 | |
import org.apache.maven.model.ReportSet; |
68 | |
import org.apache.maven.model.Reporting; |
69 | |
import org.apache.maven.model.Repository; |
70 | |
import org.apache.maven.model.RepositoryBase; |
71 | |
import org.apache.maven.model.RepositoryPolicy; |
72 | |
import org.apache.maven.model.Resource; |
73 | |
import org.apache.maven.model.Scm; |
74 | |
import org.apache.maven.model.Site; |
75 | |
import org.codehaus.plexus.util.xml.Xpp3Dom; |
76 | |
import org.jdom.Content; |
77 | |
import org.jdom.DefaultJDOMFactory; |
78 | |
import org.jdom.Document; |
79 | |
import org.jdom.Element; |
80 | |
import org.jdom.Text; |
81 | |
|
82 | |
import java.io.OutputStream; |
83 | |
import java.io.OutputStreamWriter; |
84 | |
import java.io.Writer; |
85 | |
import java.util.ArrayList; |
86 | |
import java.util.Collection; |
87 | |
import java.util.Iterator; |
88 | |
import java.util.ListIterator; |
89 | |
import java.util.Map; |
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
public class MavenJDOMWriter |
97 | |
{ |
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
private DefaultJDOMFactory factory; |
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
private String lineSeparator; |
111 | |
|
112 | 1 | private static final String LS = System.getProperty( "line.separator" ); |
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
public MavenJDOMWriter() |
119 | 28 | { |
120 | 28 | factory = new DefaultJDOMFactory(); |
121 | 28 | lineSeparator = "\n"; |
122 | 28 | } |
123 | |
|
124 | |
|
125 | |
|
126 | |
|
127 | |
|
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | |
public void write( Model project, Document document, OutputStream stream ) |
133 | |
throws java.io.IOException |
134 | |
{ |
135 | 0 | updateModel( project, "project", new Counter( 0 ), document.getRootElement() ); |
136 | |
|
137 | 0 | XMLOutputter outputter = new XMLOutputter(); |
138 | 0 | outputter.setFormat( Format.getPrettyFormat().setIndent( " " ).setLineSeparator( LS ) ); |
139 | 0 | outputter.output( document, stream ); |
140 | 0 | } |
141 | |
|
142 | |
|
143 | |
|
144 | |
|
145 | |
|
146 | |
|
147 | |
|
148 | |
|
149 | |
public void write( Model project, Document document, OutputStreamWriter writer ) |
150 | |
throws java.io.IOException |
151 | |
{ |
152 | 0 | Format format = Format.getRawFormat().setEncoding( writer.getEncoding() ).setLineSeparator( LS ); |
153 | 0 | write( project, document, writer, format ); |
154 | 0 | } |
155 | |
|
156 | |
|
157 | |
|
158 | |
|
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
|
164 | |
public void write( Model project, Document document, Writer writer, Format jdomFormat ) |
165 | |
throws java.io.IOException |
166 | |
{ |
167 | 28 | updateModel( project, "project", new Counter( 0 ), document.getRootElement() ); |
168 | |
|
169 | 28 | XMLOutputter outputter = new XMLOutputter(); |
170 | 28 | outputter.setFormat( jdomFormat ); |
171 | 28 | outputter.output( document, writer ); |
172 | 28 | } |
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
|
178 | |
|
179 | |
|
180 | |
|
181 | |
|
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
protected Element findAndReplaceProperties( Counter counter, Element parent, String name, Map props ) |
187 | |
{ |
188 | 28 | boolean shouldExist = ( props != null ) && !props.isEmpty(); |
189 | 28 | Element element = updateElement( counter, parent, name, shouldExist ); |
190 | 28 | if ( shouldExist ) |
191 | |
{ |
192 | 1 | Iterator it = props.keySet().iterator(); |
193 | 1 | Counter innerCounter = new Counter( counter.getDepth() + 1 ); |
194 | 2 | while ( it.hasNext() ) |
195 | |
{ |
196 | 1 | String key = (String) it.next(); |
197 | 1 | findAndReplaceSimpleElement( innerCounter, element, key, (String) props.get( key ), null ); |
198 | 1 | } |
199 | |
|
200 | 1 | ArrayList lst = new ArrayList( props.keySet() ); |
201 | 1 | it = element.getChildren().iterator(); |
202 | 1 | while ( it.hasNext() ) |
203 | |
{ |
204 | 0 | Element elem = (Element) it.next(); |
205 | 0 | String key = elem.getName(); |
206 | 0 | if ( !lst.contains( key ) ) |
207 | |
{ |
208 | 0 | it.remove(); |
209 | |
} |
210 | 0 | } |
211 | |
} |
212 | 28 | return element; |
213 | |
} |
214 | |
|
215 | |
|
216 | |
|
217 | |
|
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
|
224 | |
protected Element findAndReplaceSimpleElement( Counter counter, Element parent, String name, String text, |
225 | |
String defaultValue ) |
226 | |
{ |
227 | 562 | if ( ( defaultValue != null ) && ( text != null ) && defaultValue.equals( text ) ) |
228 | |
{ |
229 | 54 | Element element = parent.getChild( name, parent.getNamespace() ); |
230 | |
|
231 | 54 | if ( ( ( element != null ) && defaultValue.equals( element.getText() ) ) || ( element == null ) ) |
232 | |
{ |
233 | 54 | return element; |
234 | |
} |
235 | |
} |
236 | |
|
237 | 508 | boolean shouldExist = ( text != null ) && ( text.trim().length() > 0 ); |
238 | 508 | Element element = updateElement( counter, parent, name, shouldExist ); |
239 | 508 | if ( shouldExist ) |
240 | |
{ |
241 | 258 | element.setText( text ); |
242 | |
} |
243 | 508 | return element; |
244 | |
} |
245 | |
|
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
|
252 | |
|
253 | |
|
254 | |
|
255 | |
protected Element findAndReplaceSimpleLists( Counter counter, Element parent, java.util.Collection list, |
256 | |
String parentName, String childName ) |
257 | |
{ |
258 | 37 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
259 | 37 | Element element = updateElement( counter, parent, parentName, shouldExist ); |
260 | 37 | if ( shouldExist ) |
261 | |
{ |
262 | 0 | Iterator it = list.iterator(); |
263 | 0 | Iterator elIt = element.getChildren( childName, element.getNamespace() ).iterator(); |
264 | 0 | if ( !elIt.hasNext() ) |
265 | |
{ |
266 | 0 | elIt = null; |
267 | |
} |
268 | |
|
269 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
270 | 0 | while ( it.hasNext() ) |
271 | |
{ |
272 | 0 | String value = (String) it.next(); |
273 | |
Element el; |
274 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
275 | |
{ |
276 | 0 | el = (Element) elIt.next(); |
277 | 0 | if ( !elIt.hasNext() ) |
278 | |
{ |
279 | 0 | elIt = null; |
280 | |
} |
281 | |
} |
282 | |
else |
283 | |
{ |
284 | 0 | el = factory.element( childName, element.getNamespace() ); |
285 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
286 | |
} |
287 | 0 | el.setText( value ); |
288 | 0 | innerCount.increaseCount(); |
289 | 0 | } |
290 | 0 | if ( elIt != null ) |
291 | |
{ |
292 | 0 | while ( elIt.hasNext() ) |
293 | |
{ |
294 | 0 | elIt.next(); |
295 | 0 | elIt.remove(); |
296 | |
} |
297 | |
} |
298 | |
} |
299 | 37 | return element; |
300 | |
} |
301 | |
|
302 | |
|
303 | |
|
304 | |
|
305 | |
|
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | |
|
311 | |
protected Element findAndReplaceXpp3DOM( Counter counter, Element parent, String name, Xpp3Dom dom ) |
312 | |
{ |
313 | 49 | boolean shouldExist = ( dom != null ) && ( ( dom.getChildCount() > 0 ) || ( dom.getValue() != null ) ); |
314 | 49 | Element element = updateElement( counter, parent, name, shouldExist ); |
315 | 49 | if ( shouldExist ) |
316 | |
{ |
317 | 0 | replaceXpp3DOM( element, dom, new Counter( counter.getDepth() + 1 ) ); |
318 | |
} |
319 | 49 | return element; |
320 | |
} |
321 | |
|
322 | |
|
323 | |
|
324 | |
|
325 | |
|
326 | |
|
327 | |
|
328 | |
|
329 | |
protected void insertAtPreferredLocation( Element parent, Element child, Counter counter ) |
330 | |
{ |
331 | 78 | int contentIndex = 0; |
332 | 78 | int elementCounter = 0; |
333 | 78 | Iterator it = parent.getContent().iterator(); |
334 | 78 | Text lastText = null; |
335 | 78 | int offset = 0; |
336 | 312 | while ( it.hasNext() && ( elementCounter <= counter.getCurrentIndex() ) ) |
337 | |
{ |
338 | 234 | Object next = it.next(); |
339 | 234 | offset = offset + 1; |
340 | 234 | if ( next instanceof Element ) |
341 | |
{ |
342 | 97 | elementCounter = elementCounter + 1; |
343 | 97 | contentIndex = contentIndex + offset; |
344 | 97 | offset = 0; |
345 | |
} |
346 | 234 | if ( ( next instanceof Text ) && it.hasNext() ) |
347 | |
{ |
348 | 97 | lastText = (Text) next; |
349 | |
} |
350 | 234 | } |
351 | 78 | if ( ( lastText != null ) && ( lastText.getTextTrim().length() == 0 ) ) |
352 | |
{ |
353 | 37 | lastText = (Text) lastText.clone(); |
354 | |
} |
355 | |
else |
356 | |
{ |
357 | 41 | StringBuilder starter = new StringBuilder( lineSeparator ); |
358 | 185 | for ( int i = 0; i < counter.getDepth(); i++ ) |
359 | |
{ |
360 | 144 | starter.append( " " ); |
361 | |
} |
362 | 41 | lastText = factory.text( starter.toString() ); |
363 | |
} |
364 | 78 | if ( parent.getContentSize() == 0 ) |
365 | |
{ |
366 | 29 | Text finalText = (Text) lastText.clone(); |
367 | 29 | finalText.setText( finalText.getText().substring( 0, finalText.getText().length() - " ".length() ) ); |
368 | 29 | parent.addContent( contentIndex, finalText ); |
369 | |
} |
370 | 78 | parent.addContent( contentIndex, child ); |
371 | 78 | parent.addContent( contentIndex, lastText ); |
372 | 78 | } |
373 | |
|
374 | |
|
375 | |
|
376 | |
|
377 | |
|
378 | |
|
379 | |
|
380 | |
|
381 | |
|
382 | |
|
383 | |
protected void iterateContributor( Counter counter, Element parent, java.util.Collection list, |
384 | |
java.lang.String parentTag, java.lang.String childTag ) |
385 | |
{ |
386 | 28 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
387 | 28 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
388 | 28 | if ( shouldExist ) |
389 | |
{ |
390 | 0 | Iterator it = list.iterator(); |
391 | 0 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
392 | 0 | if ( !elIt.hasNext() ) |
393 | |
{ |
394 | 0 | elIt = null; |
395 | |
} |
396 | |
|
397 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
398 | 0 | while ( it.hasNext() ) |
399 | |
{ |
400 | 0 | Contributor value = (Contributor) it.next(); |
401 | |
Element el; |
402 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
403 | |
{ |
404 | 0 | el = (Element) elIt.next(); |
405 | 0 | if ( !elIt.hasNext() ) |
406 | |
{ |
407 | 0 | elIt = null; |
408 | |
} |
409 | |
} |
410 | |
else |
411 | |
{ |
412 | 0 | el = factory.element( childTag, element.getNamespace() ); |
413 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
414 | |
} |
415 | 0 | updateContributor( value, childTag, innerCount, el ); |
416 | 0 | innerCount.increaseCount(); |
417 | 0 | } |
418 | 0 | if ( elIt != null ) |
419 | |
{ |
420 | 0 | while ( elIt.hasNext() ) |
421 | |
{ |
422 | 0 | elIt.next(); |
423 | 0 | elIt.remove(); |
424 | |
} |
425 | |
} |
426 | |
} |
427 | 28 | } |
428 | |
|
429 | |
|
430 | |
|
431 | |
|
432 | |
|
433 | |
|
434 | |
|
435 | |
|
436 | |
|
437 | |
|
438 | |
|
439 | |
protected void iterateDependency( Counter counter, Element parent, java.util.Collection list, |
440 | |
java.lang.String parentTag, java.lang.String childTag ) |
441 | |
{ |
442 | 37 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
443 | 37 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
444 | 37 | if ( shouldExist ) |
445 | |
{ |
446 | 10 | Iterator it = list.iterator(); |
447 | 10 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
448 | 10 | if ( !elIt.hasNext() ) |
449 | |
{ |
450 | 2 | elIt = null; |
451 | |
} |
452 | |
|
453 | 10 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
454 | 22 | while ( it.hasNext() ) |
455 | |
{ |
456 | 12 | Dependency value = (Dependency) it.next(); |
457 | |
Element el; |
458 | 12 | if ( ( elIt != null ) && elIt.hasNext() ) |
459 | |
{ |
460 | 10 | el = (Element) elIt.next(); |
461 | 10 | if ( !elIt.hasNext() ) |
462 | |
{ |
463 | 8 | elIt = null; |
464 | |
} |
465 | |
} |
466 | |
else |
467 | |
{ |
468 | 2 | el = factory.element( childTag, element.getNamespace() ); |
469 | 2 | insertAtPreferredLocation( element, el, innerCount ); |
470 | |
} |
471 | 12 | updateDependency( value, childTag, innerCount, el ); |
472 | 12 | innerCount.increaseCount(); |
473 | 12 | } |
474 | 10 | if ( elIt != null ) |
475 | |
{ |
476 | 0 | while ( elIt.hasNext() ) |
477 | |
{ |
478 | 0 | elIt.next(); |
479 | 0 | elIt.remove(); |
480 | |
} |
481 | |
} |
482 | |
} |
483 | 37 | } |
484 | |
|
485 | |
|
486 | |
|
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
|
493 | |
|
494 | |
|
495 | |
protected void iterateDeveloper( Counter counter, Element parent, java.util.Collection list, |
496 | |
java.lang.String parentTag, java.lang.String childTag ) |
497 | |
{ |
498 | 28 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
499 | 28 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
500 | 28 | if ( shouldExist ) |
501 | |
{ |
502 | 0 | Iterator it = list.iterator(); |
503 | 0 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
504 | 0 | if ( !elIt.hasNext() ) |
505 | |
{ |
506 | 0 | elIt = null; |
507 | |
} |
508 | |
|
509 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
510 | 0 | while ( it.hasNext() ) |
511 | |
{ |
512 | 0 | Developer value = (Developer) it.next(); |
513 | |
Element el; |
514 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
515 | |
{ |
516 | 0 | el = (Element) elIt.next(); |
517 | 0 | if ( !elIt.hasNext() ) |
518 | |
{ |
519 | 0 | elIt = null; |
520 | |
} |
521 | |
} |
522 | |
else |
523 | |
{ |
524 | 0 | el = factory.element( childTag, element.getNamespace() ); |
525 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
526 | |
} |
527 | 0 | updateDeveloper( value, childTag, innerCount, el ); |
528 | 0 | innerCount.increaseCount(); |
529 | 0 | } |
530 | 0 | if ( elIt != null ) |
531 | |
{ |
532 | 0 | while ( elIt.hasNext() ) |
533 | |
{ |
534 | 0 | elIt.next(); |
535 | 0 | elIt.remove(); |
536 | |
} |
537 | |
} |
538 | |
} |
539 | 28 | } |
540 | |
|
541 | |
|
542 | |
|
543 | |
|
544 | |
|
545 | |
|
546 | |
|
547 | |
|
548 | |
|
549 | |
|
550 | |
|
551 | |
protected void iterateExclusion( Counter counter, Element parent, java.util.Collection list, |
552 | |
java.lang.String parentTag, java.lang.String childTag ) |
553 | |
{ |
554 | 12 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
555 | 12 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
556 | 12 | if ( shouldExist ) |
557 | |
{ |
558 | 0 | Iterator it = list.iterator(); |
559 | 0 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
560 | 0 | if ( !elIt.hasNext() ) |
561 | |
{ |
562 | 0 | elIt = null; |
563 | |
} |
564 | |
|
565 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
566 | 0 | while ( it.hasNext() ) |
567 | |
{ |
568 | 0 | Exclusion value = (Exclusion) it.next(); |
569 | |
Element el; |
570 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
571 | |
{ |
572 | 0 | el = (Element) elIt.next(); |
573 | 0 | if ( !elIt.hasNext() ) |
574 | |
{ |
575 | 0 | elIt = null; |
576 | |
} |
577 | |
} |
578 | |
else |
579 | |
{ |
580 | 0 | el = factory.element( childTag, element.getNamespace() ); |
581 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
582 | |
} |
583 | 0 | updateExclusion( value, childTag, innerCount, el ); |
584 | 0 | innerCount.increaseCount(); |
585 | 0 | } |
586 | 0 | if ( elIt != null ) |
587 | |
{ |
588 | 0 | while ( elIt.hasNext() ) |
589 | |
{ |
590 | 0 | elIt.next(); |
591 | 0 | elIt.remove(); |
592 | |
} |
593 | |
} |
594 | |
} |
595 | 12 | } |
596 | |
|
597 | |
|
598 | |
|
599 | |
|
600 | |
|
601 | |
|
602 | |
|
603 | |
|
604 | |
|
605 | |
|
606 | |
|
607 | |
protected void iterateExtension( Counter counter, Element parent, java.util.Collection list, |
608 | |
java.lang.String parentTag, java.lang.String childTag ) |
609 | |
{ |
610 | 9 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
611 | 9 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
612 | 9 | if ( shouldExist ) |
613 | |
{ |
614 | 6 | Iterator it = list.iterator(); |
615 | 6 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
616 | 6 | if ( !elIt.hasNext() ) |
617 | |
{ |
618 | 6 | elIt = null; |
619 | |
} |
620 | |
|
621 | 6 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
622 | 12 | while ( it.hasNext() ) |
623 | |
{ |
624 | 6 | Extension value = (Extension) it.next(); |
625 | |
Element el; |
626 | 6 | if ( ( elIt != null ) && elIt.hasNext() ) |
627 | |
{ |
628 | 0 | el = (Element) elIt.next(); |
629 | 0 | if ( !elIt.hasNext() ) |
630 | |
{ |
631 | 0 | elIt = null; |
632 | |
} |
633 | |
} |
634 | |
else |
635 | |
{ |
636 | 6 | el = factory.element( childTag, element.getNamespace() ); |
637 | 6 | insertAtPreferredLocation( element, el, innerCount ); |
638 | |
} |
639 | 6 | updateExtension( value, childTag, innerCount, el ); |
640 | 6 | innerCount.increaseCount(); |
641 | 6 | } |
642 | 6 | if ( elIt != null ) |
643 | |
{ |
644 | 0 | while ( elIt.hasNext() ) |
645 | |
{ |
646 | 0 | elIt.next(); |
647 | 0 | elIt.remove(); |
648 | |
} |
649 | |
} |
650 | |
} |
651 | 9 | } |
652 | |
|
653 | |
|
654 | |
|
655 | |
|
656 | |
|
657 | |
|
658 | |
|
659 | |
|
660 | |
|
661 | |
|
662 | |
|
663 | |
protected void iterateLicense( Counter counter, Element parent, java.util.Collection list, |
664 | |
java.lang.String parentTag, java.lang.String childTag ) |
665 | |
{ |
666 | 28 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
667 | 28 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
668 | 28 | if ( shouldExist ) |
669 | |
{ |
670 | 0 | Iterator it = list.iterator(); |
671 | 0 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
672 | 0 | if ( !elIt.hasNext() ) |
673 | |
{ |
674 | 0 | elIt = null; |
675 | |
} |
676 | |
|
677 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
678 | 0 | while ( it.hasNext() ) |
679 | |
{ |
680 | 0 | License value = (License) it.next(); |
681 | |
Element el; |
682 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
683 | |
{ |
684 | 0 | el = (Element) elIt.next(); |
685 | 0 | if ( !elIt.hasNext() ) |
686 | |
{ |
687 | 0 | elIt = null; |
688 | |
} |
689 | |
} |
690 | |
else |
691 | |
{ |
692 | 0 | el = factory.element( childTag, element.getNamespace() ); |
693 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
694 | |
} |
695 | 0 | updateLicense( value, childTag, innerCount, el ); |
696 | 0 | innerCount.increaseCount(); |
697 | 0 | } |
698 | 0 | if ( elIt != null ) |
699 | |
{ |
700 | 0 | while ( elIt.hasNext() ) |
701 | |
{ |
702 | 0 | elIt.next(); |
703 | 0 | elIt.remove(); |
704 | |
} |
705 | |
} |
706 | |
} |
707 | 28 | } |
708 | |
|
709 | |
|
710 | |
|
711 | |
|
712 | |
|
713 | |
|
714 | |
|
715 | |
|
716 | |
|
717 | |
|
718 | |
|
719 | |
protected void iterateMailingList( Counter counter, Element parent, java.util.Collection list, |
720 | |
java.lang.String parentTag, java.lang.String childTag ) |
721 | |
{ |
722 | 28 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
723 | 28 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
724 | 28 | if ( shouldExist ) |
725 | |
{ |
726 | 0 | Iterator it = list.iterator(); |
727 | 0 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
728 | 0 | if ( !elIt.hasNext() ) |
729 | |
{ |
730 | 0 | elIt = null; |
731 | |
} |
732 | |
|
733 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
734 | 0 | while ( it.hasNext() ) |
735 | |
{ |
736 | 0 | MailingList value = (MailingList) it.next(); |
737 | |
Element el; |
738 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
739 | |
{ |
740 | 0 | el = (Element) elIt.next(); |
741 | 0 | if ( !elIt.hasNext() ) |
742 | |
{ |
743 | 0 | elIt = null; |
744 | |
} |
745 | |
} |
746 | |
else |
747 | |
{ |
748 | 0 | el = factory.element( childTag, element.getNamespace() ); |
749 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
750 | |
} |
751 | 0 | updateMailingList( value, childTag, innerCount, el ); |
752 | 0 | innerCount.increaseCount(); |
753 | 0 | } |
754 | 0 | if ( elIt != null ) |
755 | |
{ |
756 | 0 | while ( elIt.hasNext() ) |
757 | |
{ |
758 | 0 | elIt.next(); |
759 | 0 | elIt.remove(); |
760 | |
} |
761 | |
} |
762 | |
} |
763 | 28 | } |
764 | |
|
765 | |
|
766 | |
|
767 | |
|
768 | |
|
769 | |
|
770 | |
|
771 | |
|
772 | |
|
773 | |
|
774 | |
|
775 | |
protected void iterateNotifier( Counter counter, Element parent, java.util.Collection list, |
776 | |
java.lang.String parentTag, java.lang.String childTag ) |
777 | |
{ |
778 | 0 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
779 | 0 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
780 | 0 | if ( shouldExist ) |
781 | |
{ |
782 | 0 | Iterator it = list.iterator(); |
783 | 0 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
784 | 0 | if ( !elIt.hasNext() ) |
785 | |
{ |
786 | 0 | elIt = null; |
787 | |
} |
788 | |
|
789 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
790 | 0 | while ( it.hasNext() ) |
791 | |
{ |
792 | 0 | Notifier value = (Notifier) it.next(); |
793 | |
Element el; |
794 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
795 | |
{ |
796 | 0 | el = (Element) elIt.next(); |
797 | 0 | if ( !elIt.hasNext() ) |
798 | |
{ |
799 | 0 | elIt = null; |
800 | |
} |
801 | |
} |
802 | |
else |
803 | |
{ |
804 | 0 | el = factory.element( childTag, element.getNamespace() ); |
805 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
806 | |
} |
807 | 0 | updateNotifier( value, childTag, innerCount, el ); |
808 | 0 | innerCount.increaseCount(); |
809 | 0 | } |
810 | 0 | if ( elIt != null ) |
811 | |
{ |
812 | 0 | while ( elIt.hasNext() ) |
813 | |
{ |
814 | 0 | elIt.next(); |
815 | 0 | elIt.remove(); |
816 | |
} |
817 | |
} |
818 | |
} |
819 | 0 | } |
820 | |
|
821 | |
|
822 | |
|
823 | |
|
824 | |
|
825 | |
|
826 | |
|
827 | |
|
828 | |
|
829 | |
|
830 | |
|
831 | |
protected void iteratePlugin( Counter counter, Element parent, java.util.Collection list, |
832 | |
java.lang.String parentTag, java.lang.String childTag ) |
833 | |
{ |
834 | 15 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
835 | 15 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
836 | 15 | if ( shouldExist ) |
837 | |
{ |
838 | 9 | Iterator it = list.iterator(); |
839 | 9 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
840 | 9 | if ( !elIt.hasNext() ) |
841 | |
{ |
842 | 8 | elIt = null; |
843 | |
} |
844 | |
|
845 | 9 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
846 | 18 | while ( it.hasNext() ) |
847 | |
{ |
848 | 9 | Plugin value = (Plugin) it.next(); |
849 | |
Element el; |
850 | 9 | if ( ( elIt != null ) && elIt.hasNext() ) |
851 | |
{ |
852 | 1 | el = (Element) elIt.next(); |
853 | 1 | if ( !elIt.hasNext() ) |
854 | |
{ |
855 | 1 | elIt = null; |
856 | |
} |
857 | |
} |
858 | |
else |
859 | |
{ |
860 | 8 | el = factory.element( childTag, element.getNamespace() ); |
861 | 8 | insertAtPreferredLocation( element, el, innerCount ); |
862 | |
} |
863 | 9 | updatePlugin( value, childTag, innerCount, el ); |
864 | 9 | innerCount.increaseCount(); |
865 | 9 | } |
866 | 9 | if ( elIt != null ) |
867 | |
{ |
868 | 0 | while ( elIt.hasNext() ) |
869 | |
{ |
870 | 0 | elIt.next(); |
871 | 0 | elIt.remove(); |
872 | |
} |
873 | |
} |
874 | |
} |
875 | 15 | } |
876 | |
|
877 | |
|
878 | |
|
879 | |
|
880 | |
|
881 | |
|
882 | |
|
883 | |
|
884 | |
|
885 | |
|
886 | |
|
887 | |
protected void iteratePluginExecution( Counter counter, Element parent, java.util.Collection list, |
888 | |
java.lang.String parentTag, java.lang.String childTag ) |
889 | |
{ |
890 | 9 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
891 | 9 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
892 | 9 | if ( shouldExist ) |
893 | |
{ |
894 | 0 | Iterator it = list.iterator(); |
895 | 0 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
896 | 0 | if ( !elIt.hasNext() ) |
897 | |
{ |
898 | 0 | elIt = null; |
899 | |
} |
900 | |
|
901 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
902 | 0 | while ( it.hasNext() ) |
903 | |
{ |
904 | 0 | PluginExecution value = (PluginExecution) it.next(); |
905 | |
Element el; |
906 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
907 | |
{ |
908 | 0 | el = (Element) elIt.next(); |
909 | 0 | if ( !elIt.hasNext() ) |
910 | |
{ |
911 | 0 | elIt = null; |
912 | |
} |
913 | |
} |
914 | |
else |
915 | |
{ |
916 | 0 | el = factory.element( childTag, element.getNamespace() ); |
917 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
918 | |
} |
919 | 0 | updatePluginExecution( value, childTag, innerCount, el ); |
920 | 0 | innerCount.increaseCount(); |
921 | 0 | } |
922 | 0 | if ( elIt != null ) |
923 | |
{ |
924 | 0 | while ( elIt.hasNext() ) |
925 | |
{ |
926 | 0 | elIt.next(); |
927 | 0 | elIt.remove(); |
928 | |
} |
929 | |
} |
930 | |
} |
931 | 9 | } |
932 | |
|
933 | |
|
934 | |
|
935 | |
|
936 | |
|
937 | |
|
938 | |
|
939 | |
|
940 | |
|
941 | |
|
942 | |
|
943 | |
protected void iterateProfile( Counter counter, Element parent, java.util.Collection list, |
944 | |
java.lang.String parentTag, java.lang.String childTag ) |
945 | |
{ |
946 | 28 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
947 | 28 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
948 | 28 | if ( shouldExist ) |
949 | |
{ |
950 | 0 | Iterator it = list.iterator(); |
951 | 0 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
952 | 0 | if ( !elIt.hasNext() ) |
953 | |
{ |
954 | 0 | elIt = null; |
955 | |
} |
956 | |
|
957 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
958 | 0 | while ( it.hasNext() ) |
959 | |
{ |
960 | 0 | Profile value = (Profile) it.next(); |
961 | |
Element el; |
962 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
963 | |
{ |
964 | 0 | el = (Element) elIt.next(); |
965 | 0 | if ( !elIt.hasNext() ) |
966 | |
{ |
967 | 0 | elIt = null; |
968 | |
} |
969 | |
} |
970 | |
else |
971 | |
{ |
972 | 0 | el = factory.element( childTag, element.getNamespace() ); |
973 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
974 | |
} |
975 | 0 | updateProfile( value, childTag, innerCount, el ); |
976 | 0 | innerCount.increaseCount(); |
977 | 0 | } |
978 | 0 | if ( elIt != null ) |
979 | |
{ |
980 | 0 | while ( elIt.hasNext() ) |
981 | |
{ |
982 | 0 | elIt.next(); |
983 | 0 | elIt.remove(); |
984 | |
} |
985 | |
} |
986 | |
} |
987 | 28 | } |
988 | |
|
989 | |
|
990 | |
|
991 | |
|
992 | |
|
993 | |
|
994 | |
|
995 | |
|
996 | |
|
997 | |
|
998 | |
|
999 | |
protected void iterateReportPlugin( Counter counter, Element parent, java.util.Collection list, |
1000 | |
java.lang.String parentTag, java.lang.String childTag ) |
1001 | |
{ |
1002 | 3 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
1003 | 3 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
1004 | 3 | if ( shouldExist ) |
1005 | |
{ |
1006 | 3 | Iterator it = list.iterator(); |
1007 | 3 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
1008 | 3 | if ( !elIt.hasNext() ) |
1009 | |
{ |
1010 | 2 | elIt = null; |
1011 | |
} |
1012 | |
|
1013 | 3 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1014 | 6 | while ( it.hasNext() ) |
1015 | |
{ |
1016 | 3 | ReportPlugin value = (ReportPlugin) it.next(); |
1017 | |
Element el; |
1018 | 3 | if ( ( elIt != null ) && elIt.hasNext() ) |
1019 | |
{ |
1020 | 1 | el = (Element) elIt.next(); |
1021 | 1 | if ( !elIt.hasNext() ) |
1022 | |
{ |
1023 | 1 | elIt = null; |
1024 | |
} |
1025 | |
} |
1026 | |
else |
1027 | |
{ |
1028 | 2 | el = factory.element( childTag, element.getNamespace() ); |
1029 | 2 | insertAtPreferredLocation( element, el, innerCount ); |
1030 | |
} |
1031 | 3 | updateReportPlugin( value, childTag, innerCount, el ); |
1032 | 3 | innerCount.increaseCount(); |
1033 | 3 | } |
1034 | 3 | if ( elIt != null ) |
1035 | |
{ |
1036 | 0 | while ( elIt.hasNext() ) |
1037 | |
{ |
1038 | 0 | elIt.next(); |
1039 | 0 | elIt.remove(); |
1040 | |
} |
1041 | |
} |
1042 | |
} |
1043 | 3 | } |
1044 | |
|
1045 | |
|
1046 | |
|
1047 | |
|
1048 | |
|
1049 | |
|
1050 | |
|
1051 | |
|
1052 | |
|
1053 | |
|
1054 | |
|
1055 | |
protected void iterateReportSet( Counter counter, Element parent, java.util.Collection list, |
1056 | |
java.lang.String parentTag, java.lang.String childTag ) |
1057 | |
{ |
1058 | 3 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
1059 | 3 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
1060 | 3 | if ( shouldExist ) |
1061 | |
{ |
1062 | 0 | Iterator it = list.iterator(); |
1063 | 0 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
1064 | 0 | if ( !elIt.hasNext() ) |
1065 | |
{ |
1066 | 0 | elIt = null; |
1067 | |
} |
1068 | |
|
1069 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1070 | 0 | while ( it.hasNext() ) |
1071 | |
{ |
1072 | 0 | ReportSet value = (ReportSet) it.next(); |
1073 | |
Element el; |
1074 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
1075 | |
{ |
1076 | 0 | el = (Element) elIt.next(); |
1077 | 0 | if ( !elIt.hasNext() ) |
1078 | |
{ |
1079 | 0 | elIt = null; |
1080 | |
} |
1081 | |
} |
1082 | |
else |
1083 | |
{ |
1084 | 0 | el = factory.element( childTag, element.getNamespace() ); |
1085 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
1086 | |
} |
1087 | 0 | updateReportSet( value, childTag, innerCount, el ); |
1088 | 0 | innerCount.increaseCount(); |
1089 | 0 | } |
1090 | 0 | if ( elIt != null ) |
1091 | |
{ |
1092 | 0 | while ( elIt.hasNext() ) |
1093 | |
{ |
1094 | 0 | elIt.next(); |
1095 | 0 | elIt.remove(); |
1096 | |
} |
1097 | |
} |
1098 | |
} |
1099 | 3 | } |
1100 | |
|
1101 | |
|
1102 | |
|
1103 | |
|
1104 | |
|
1105 | |
|
1106 | |
|
1107 | |
|
1108 | |
|
1109 | |
|
1110 | |
|
1111 | |
protected void iterateRepository( Counter counter, Element parent, java.util.Collection list, |
1112 | |
java.lang.String parentTag, java.lang.String childTag ) |
1113 | |
{ |
1114 | 56 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
1115 | 56 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
1116 | 56 | if ( shouldExist ) |
1117 | |
{ |
1118 | 0 | Iterator it = list.iterator(); |
1119 | 0 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
1120 | 0 | if ( !elIt.hasNext() ) |
1121 | |
{ |
1122 | 0 | elIt = null; |
1123 | |
} |
1124 | |
|
1125 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1126 | 0 | while ( it.hasNext() ) |
1127 | |
{ |
1128 | 0 | Repository value = (Repository) it.next(); |
1129 | |
Element el; |
1130 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
1131 | |
{ |
1132 | 0 | el = (Element) elIt.next(); |
1133 | 0 | if ( !elIt.hasNext() ) |
1134 | |
{ |
1135 | 0 | elIt = null; |
1136 | |
} |
1137 | |
} |
1138 | |
else |
1139 | |
{ |
1140 | 0 | el = factory.element( childTag, element.getNamespace() ); |
1141 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
1142 | |
} |
1143 | 0 | updateRepository( value, childTag, innerCount, el ); |
1144 | 0 | innerCount.increaseCount(); |
1145 | 0 | } |
1146 | 0 | if ( elIt != null ) |
1147 | |
{ |
1148 | 0 | while ( elIt.hasNext() ) |
1149 | |
{ |
1150 | 0 | elIt.next(); |
1151 | 0 | elIt.remove(); |
1152 | |
} |
1153 | |
} |
1154 | |
} |
1155 | 56 | } |
1156 | |
|
1157 | |
|
1158 | |
|
1159 | |
|
1160 | |
|
1161 | |
|
1162 | |
|
1163 | |
|
1164 | |
|
1165 | |
|
1166 | |
|
1167 | |
protected void iterateResource( Counter counter, Element parent, java.util.Collection list, |
1168 | |
java.lang.String parentTag, java.lang.String childTag ) |
1169 | |
{ |
1170 | 18 | boolean shouldExist = ( list != null ) && ( list.size() > 0 ); |
1171 | 18 | Element element = updateElement( counter, parent, parentTag, shouldExist ); |
1172 | 18 | if ( shouldExist ) |
1173 | |
{ |
1174 | 0 | Iterator it = list.iterator(); |
1175 | 0 | Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator(); |
1176 | 0 | if ( !elIt.hasNext() ) |
1177 | |
{ |
1178 | 0 | elIt = null; |
1179 | |
} |
1180 | |
|
1181 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1182 | 0 | while ( it.hasNext() ) |
1183 | |
{ |
1184 | 0 | Resource value = (Resource) it.next(); |
1185 | |
Element el; |
1186 | 0 | if ( ( elIt != null ) && elIt.hasNext() ) |
1187 | |
{ |
1188 | 0 | el = (Element) elIt.next(); |
1189 | 0 | if ( !elIt.hasNext() ) |
1190 | |
{ |
1191 | 0 | elIt = null; |
1192 | |
} |
1193 | |
} |
1194 | |
else |
1195 | |
{ |
1196 | 0 | el = factory.element( childTag, element.getNamespace() ); |
1197 | 0 | insertAtPreferredLocation( element, el, innerCount ); |
1198 | |
} |
1199 | 0 | updateResource( value, childTag, innerCount, el ); |
1200 | 0 | innerCount.increaseCount(); |
1201 | 0 | } |
1202 | 0 | if ( elIt != null ) |
1203 | |
{ |
1204 | 0 | while ( elIt.hasNext() ) |
1205 | |
{ |
1206 | 0 | elIt.next(); |
1207 | 0 | elIt.remove(); |
1208 | |
} |
1209 | |
} |
1210 | |
} |
1211 | 18 | } |
1212 | |
|
1213 | |
|
1214 | |
|
1215 | |
|
1216 | |
|
1217 | |
|
1218 | |
|
1219 | |
|
1220 | |
|
1221 | |
protected void replaceXpp3DOM( Element parent, Xpp3Dom parentDom, Counter counter ) |
1222 | |
{ |
1223 | 0 | if ( parentDom.getChildCount() > 0 ) |
1224 | |
{ |
1225 | 0 | Xpp3Dom[] childs = parentDom.getChildren(); |
1226 | 0 | Collection domChilds = new ArrayList(); |
1227 | 0 | for ( int i = 0; i < childs.length; i++ ) |
1228 | |
{ |
1229 | 0 | domChilds.add( childs[i] ); |
1230 | |
} |
1231 | |
|
1232 | 0 | int domIndex = 0; |
1233 | 0 | ListIterator it = parent.getChildren().listIterator(); |
1234 | 0 | while ( it.hasNext() ) |
1235 | |
{ |
1236 | 0 | Element elem = (Element) it.next(); |
1237 | 0 | Iterator it2 = domChilds.iterator(); |
1238 | 0 | Xpp3Dom corrDom = null; |
1239 | 0 | while ( it2.hasNext() ) |
1240 | |
{ |
1241 | 0 | Xpp3Dom dm = (Xpp3Dom) it2.next(); |
1242 | 0 | if ( dm.getName().equals( elem.getName() ) ) |
1243 | |
{ |
1244 | 0 | corrDom = dm; |
1245 | 0 | break; |
1246 | |
} |
1247 | 0 | } |
1248 | 0 | if ( corrDom != null ) |
1249 | |
{ |
1250 | 0 | domChilds.remove( corrDom ); |
1251 | 0 | replaceXpp3DOM( elem, corrDom, new Counter( counter.getDepth() + 1 ) ); |
1252 | 0 | counter.increaseCount(); |
1253 | |
} |
1254 | |
else |
1255 | |
{ |
1256 | 0 | parent.removeContent( elem ); |
1257 | |
} |
1258 | 0 | } |
1259 | |
|
1260 | 0 | Iterator it2 = domChilds.iterator(); |
1261 | 0 | while ( it2.hasNext() ) |
1262 | |
{ |
1263 | 0 | Xpp3Dom dm = (Xpp3Dom) it2.next(); |
1264 | 0 | Element elem = factory.element( dm.getName(), parent.getNamespace() ); |
1265 | 0 | insertAtPreferredLocation( parent, elem, counter ); |
1266 | 0 | counter.increaseCount(); |
1267 | 0 | replaceXpp3DOM( elem, dm, new Counter( counter.getDepth() + 1 ) ); |
1268 | 0 | } |
1269 | 0 | } |
1270 | 0 | else if ( parentDom.getValue() != null ) |
1271 | |
{ |
1272 | 0 | parent.setText( parentDom.getValue() ); |
1273 | |
} |
1274 | 0 | } |
1275 | |
|
1276 | |
|
1277 | |
|
1278 | |
|
1279 | |
|
1280 | |
|
1281 | |
|
1282 | |
|
1283 | |
|
1284 | |
protected void updateActivation( Activation value, String xmlTag, Counter counter, Element element ) |
1285 | |
{ |
1286 | 0 | boolean shouldExist = value != null; |
1287 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1288 | 0 | if ( shouldExist ) |
1289 | |
{ |
1290 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1291 | 0 | findAndReplaceSimpleElement( innerCount, root, "activeByDefault", ( value.isActiveByDefault() == false ) |
1292 | |
? null |
1293 | |
: String.valueOf( value.isActiveByDefault() ), "false" ); |
1294 | 0 | findAndReplaceSimpleElement( innerCount, root, "jdk", value.getJdk(), null ); |
1295 | 0 | updateActivationOS( value.getOs(), "os", innerCount, root ); |
1296 | 0 | updateActivationProperty( value.getProperty(), "property", innerCount, root ); |
1297 | 0 | updateActivationFile( value.getFile(), "file", innerCount, root ); |
1298 | |
} |
1299 | 0 | } |
1300 | |
|
1301 | |
|
1302 | |
|
1303 | |
|
1304 | |
|
1305 | |
|
1306 | |
|
1307 | |
|
1308 | |
|
1309 | |
protected void updateActivationFile( ActivationFile value, String xmlTag, Counter counter, Element element ) |
1310 | |
{ |
1311 | 0 | boolean shouldExist = value != null; |
1312 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1313 | 0 | if ( shouldExist ) |
1314 | |
{ |
1315 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1316 | 0 | findAndReplaceSimpleElement( innerCount, root, "missing", value.getMissing(), null ); |
1317 | 0 | findAndReplaceSimpleElement( innerCount, root, "exists", value.getExists(), null ); |
1318 | |
} |
1319 | 0 | } |
1320 | |
|
1321 | |
|
1322 | |
|
1323 | |
|
1324 | |
|
1325 | |
|
1326 | |
|
1327 | |
|
1328 | |
|
1329 | |
protected void updateActivationOS( ActivationOS value, String xmlTag, Counter counter, Element element ) |
1330 | |
{ |
1331 | 0 | boolean shouldExist = value != null; |
1332 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1333 | 0 | if ( shouldExist ) |
1334 | |
{ |
1335 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1336 | 0 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
1337 | 0 | findAndReplaceSimpleElement( innerCount, root, "family", value.getFamily(), null ); |
1338 | 0 | findAndReplaceSimpleElement( innerCount, root, "arch", value.getArch(), null ); |
1339 | 0 | findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); |
1340 | |
} |
1341 | 0 | } |
1342 | |
|
1343 | |
|
1344 | |
|
1345 | |
|
1346 | |
|
1347 | |
|
1348 | |
|
1349 | |
|
1350 | |
|
1351 | |
protected void updateActivationProperty( ActivationProperty value, String xmlTag, Counter counter, Element element ) |
1352 | |
{ |
1353 | 0 | boolean shouldExist = value != null; |
1354 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1355 | 0 | if ( shouldExist ) |
1356 | |
{ |
1357 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1358 | 0 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
1359 | 0 | findAndReplaceSimpleElement( innerCount, root, "value", value.getValue(), null ); |
1360 | |
} |
1361 | 0 | } |
1362 | |
|
1363 | |
|
1364 | |
|
1365 | |
|
1366 | |
|
1367 | |
|
1368 | |
|
1369 | |
|
1370 | |
|
1371 | |
protected void updateBuild( Build value, String xmlTag, Counter counter, Element element ) |
1372 | |
{ |
1373 | 28 | boolean shouldExist = value != null; |
1374 | 28 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1375 | 28 | if ( shouldExist ) |
1376 | |
{ |
1377 | 9 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1378 | 9 | findAndReplaceSimpleElement( innerCount, root, "sourceDirectory", value.getSourceDirectory(), null ); |
1379 | 9 | findAndReplaceSimpleElement( innerCount, root, "scriptSourceDirectory", value.getScriptSourceDirectory(), |
1380 | |
null ); |
1381 | 9 | findAndReplaceSimpleElement( innerCount, root, "testSourceDirectory", value.getTestSourceDirectory(), |
1382 | |
null ); |
1383 | 9 | findAndReplaceSimpleElement( innerCount, root, "outputDirectory", value.getOutputDirectory(), null ); |
1384 | 9 | findAndReplaceSimpleElement( innerCount, root, "testOutputDirectory", value.getTestOutputDirectory(), |
1385 | |
null ); |
1386 | 9 | iterateExtension( innerCount, root, value.getExtensions(), "extensions", "extension" ); |
1387 | 9 | findAndReplaceSimpleElement( innerCount, root, "defaultGoal", value.getDefaultGoal(), null ); |
1388 | 9 | iterateResource( innerCount, root, value.getResources(), "resources", "resource" ); |
1389 | 9 | iterateResource( innerCount, root, value.getTestResources(), "testResources", "testResource" ); |
1390 | 9 | findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null ); |
1391 | 9 | findAndReplaceSimpleElement( innerCount, root, "finalName", value.getFinalName(), null ); |
1392 | 9 | findAndReplaceSimpleLists( innerCount, root, value.getFilters(), "filters", "filter" ); |
1393 | 9 | updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root ); |
1394 | 9 | iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); |
1395 | |
} |
1396 | 28 | } |
1397 | |
|
1398 | |
|
1399 | |
|
1400 | |
|
1401 | |
|
1402 | |
|
1403 | |
|
1404 | |
|
1405 | |
|
1406 | |
protected void updateBuildBase( BuildBase value, String xmlTag, Counter counter, Element element ) |
1407 | |
{ |
1408 | 0 | boolean shouldExist = value != null; |
1409 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1410 | 0 | if ( shouldExist ) |
1411 | |
{ |
1412 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1413 | 0 | findAndReplaceSimpleElement( innerCount, root, "defaultGoal", value.getDefaultGoal(), null ); |
1414 | 0 | iterateResource( innerCount, root, value.getResources(), "resources", "resource" ); |
1415 | 0 | iterateResource( innerCount, root, value.getTestResources(), "testResources", "testResource" ); |
1416 | 0 | findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null ); |
1417 | 0 | findAndReplaceSimpleElement( innerCount, root, "finalName", value.getFinalName(), null ); |
1418 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getFilters(), "filters", "filter" ); |
1419 | 0 | updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root ); |
1420 | 0 | iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); |
1421 | |
} |
1422 | 0 | } |
1423 | |
|
1424 | |
|
1425 | |
|
1426 | |
|
1427 | |
|
1428 | |
|
1429 | |
|
1430 | |
|
1431 | |
|
1432 | |
protected void updateCiManagement( CiManagement value, String xmlTag, Counter counter, Element element ) |
1433 | |
{ |
1434 | 28 | boolean shouldExist = value != null; |
1435 | 28 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1436 | 28 | if ( shouldExist ) |
1437 | |
{ |
1438 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1439 | 0 | findAndReplaceSimpleElement( innerCount, root, "system", value.getSystem(), null ); |
1440 | 0 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
1441 | 0 | iterateNotifier( innerCount, root, value.getNotifiers(), "notifiers", "notifier" ); |
1442 | |
} |
1443 | 28 | } |
1444 | |
|
1445 | |
|
1446 | |
|
1447 | |
|
1448 | |
|
1449 | |
|
1450 | |
|
1451 | |
|
1452 | |
|
1453 | |
protected void updateConfigurationContainer( ConfigurationContainer value, String xmlTag, Counter counter, |
1454 | |
Element element ) |
1455 | |
{ |
1456 | 0 | boolean shouldExist = value != null; |
1457 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1458 | 0 | if ( shouldExist ) |
1459 | |
{ |
1460 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1461 | 0 | findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); |
1462 | 0 | findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); |
1463 | |
} |
1464 | 0 | } |
1465 | |
|
1466 | |
|
1467 | |
|
1468 | |
|
1469 | |
|
1470 | |
|
1471 | |
|
1472 | |
|
1473 | |
|
1474 | |
protected void updateContributor( Contributor value, String xmlTag, Counter counter, Element element ) |
1475 | |
{ |
1476 | 0 | Element root = element; |
1477 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1478 | 0 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
1479 | 0 | findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null ); |
1480 | 0 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
1481 | 0 | findAndReplaceSimpleElement( innerCount, root, "organization", value.getOrganization(), null ); |
1482 | 0 | findAndReplaceSimpleElement( innerCount, root, "organizationUrl", value.getOrganizationUrl(), null ); |
1483 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" ); |
1484 | 0 | findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null ); |
1485 | 0 | findAndReplaceProperties( innerCount, root, "properties", value.getProperties() ); |
1486 | 0 | } |
1487 | |
|
1488 | |
|
1489 | |
|
1490 | |
|
1491 | |
|
1492 | |
|
1493 | |
|
1494 | |
|
1495 | |
|
1496 | |
protected void updateDependency( Dependency value, String xmlTag, Counter counter, Element element ) |
1497 | |
{ |
1498 | 12 | Element root = element; |
1499 | 12 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1500 | 12 | findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); |
1501 | 12 | findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); |
1502 | 12 | findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); |
1503 | 12 | findAndReplaceSimpleElement( innerCount, root, "type", value.getType(), "jar" ); |
1504 | 12 | findAndReplaceSimpleElement( innerCount, root, "classifier", value.getClassifier(), null ); |
1505 | 12 | findAndReplaceSimpleElement( innerCount, root, "scope", value.getScope(), null ); |
1506 | 12 | findAndReplaceSimpleElement( innerCount, root, "systemPath", value.getSystemPath(), null ); |
1507 | 12 | iterateExclusion( innerCount, root, value.getExclusions(), "exclusions", "exclusion" ); |
1508 | 12 | findAndReplaceSimpleElement( innerCount, root, "optional", |
1509 | |
( value.isOptional() == false ) ? null : String.valueOf( value.isOptional() ), |
1510 | |
"false" ); |
1511 | 12 | } |
1512 | |
|
1513 | |
|
1514 | |
|
1515 | |
|
1516 | |
|
1517 | |
|
1518 | |
|
1519 | |
|
1520 | |
|
1521 | |
protected void updateDependencyManagement( DependencyManagement value, String xmlTag, Counter counter, |
1522 | |
Element element ) |
1523 | |
{ |
1524 | 28 | boolean shouldExist = value != null; |
1525 | 28 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1526 | 28 | if ( shouldExist ) |
1527 | |
{ |
1528 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1529 | 0 | iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" ); |
1530 | |
} |
1531 | 28 | } |
1532 | |
|
1533 | |
|
1534 | |
|
1535 | |
|
1536 | |
|
1537 | |
|
1538 | |
|
1539 | |
|
1540 | |
|
1541 | |
protected void updateDeploymentRepository( DeploymentRepository value, String xmlTag, Counter counter, |
1542 | |
Element element ) |
1543 | |
{ |
1544 | 0 | boolean shouldExist = value != null; |
1545 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1546 | 0 | if ( shouldExist ) |
1547 | |
{ |
1548 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1549 | 0 | findAndReplaceSimpleElement( innerCount, root, "uniqueVersion", ( value.isUniqueVersion() == true ) |
1550 | |
? null |
1551 | |
: String.valueOf( value.isUniqueVersion() ), "true" ); |
1552 | 0 | findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); |
1553 | 0 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
1554 | 0 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
1555 | 0 | findAndReplaceSimpleElement( innerCount, root, "layout", value.getLayout(), "default" ); |
1556 | |
} |
1557 | 0 | } |
1558 | |
|
1559 | |
|
1560 | |
|
1561 | |
|
1562 | |
|
1563 | |
|
1564 | |
|
1565 | |
|
1566 | |
|
1567 | |
protected void updateDeveloper( Developer value, String xmlTag, Counter counter, Element element ) |
1568 | |
{ |
1569 | 0 | Element root = element; |
1570 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1571 | 0 | findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); |
1572 | 0 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
1573 | 0 | findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null ); |
1574 | 0 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
1575 | 0 | findAndReplaceSimpleElement( innerCount, root, "organization", value.getOrganization(), null ); |
1576 | 0 | findAndReplaceSimpleElement( innerCount, root, "organizationUrl", value.getOrganizationUrl(), null ); |
1577 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" ); |
1578 | 0 | findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null ); |
1579 | 0 | findAndReplaceProperties( innerCount, root, "properties", value.getProperties() ); |
1580 | 0 | } |
1581 | |
|
1582 | |
|
1583 | |
|
1584 | |
|
1585 | |
|
1586 | |
|
1587 | |
|
1588 | |
|
1589 | |
|
1590 | |
protected void updateDistributionManagement( DistributionManagement value, String xmlTag, Counter counter, |
1591 | |
Element element ) |
1592 | |
{ |
1593 | 28 | boolean shouldExist = value != null; |
1594 | 28 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1595 | 28 | if ( shouldExist ) |
1596 | |
{ |
1597 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1598 | 0 | updateDeploymentRepository( value.getRepository(), "repository", innerCount, root ); |
1599 | 0 | updateDeploymentRepository( value.getSnapshotRepository(), "snapshotRepository", innerCount, root ); |
1600 | 0 | updateSite( value.getSite(), "site", innerCount, root ); |
1601 | 0 | findAndReplaceSimpleElement( innerCount, root, "downloadUrl", value.getDownloadUrl(), null ); |
1602 | 0 | updateRelocation( value.getRelocation(), "relocation", innerCount, root ); |
1603 | 0 | findAndReplaceSimpleElement( innerCount, root, "status", value.getStatus(), null ); |
1604 | |
} |
1605 | 28 | } |
1606 | |
|
1607 | |
|
1608 | |
|
1609 | |
|
1610 | |
|
1611 | |
|
1612 | |
|
1613 | |
|
1614 | |
|
1615 | |
protected Element updateElement( Counter counter, Element parent, String name, boolean shouldExist ) |
1616 | |
{ |
1617 | 1213 | Element element = parent.getChild( name, parent.getNamespace() ); |
1618 | 1213 | if ( ( element != null ) && shouldExist ) |
1619 | |
{ |
1620 | 260 | counter.increaseCount(); |
1621 | |
} |
1622 | 1213 | if ( ( element == null ) && shouldExist ) |
1623 | |
{ |
1624 | 60 | element = factory.element( name, parent.getNamespace() ); |
1625 | 60 | insertAtPreferredLocation( parent, element, counter ); |
1626 | 60 | counter.increaseCount(); |
1627 | |
} |
1628 | 1213 | if ( !shouldExist && ( element != null ) ) |
1629 | |
{ |
1630 | 7 | int index = parent.indexOf( element ); |
1631 | 7 | if ( index > 0 ) |
1632 | |
{ |
1633 | 7 | Content previous = parent.getContent( index - 1 ); |
1634 | 7 | if ( previous instanceof Text ) |
1635 | |
{ |
1636 | 7 | Text txt = (Text) previous; |
1637 | 7 | if ( txt.getTextTrim().length() == 0 ) |
1638 | |
{ |
1639 | 7 | parent.removeContent( txt ); |
1640 | |
} |
1641 | |
} |
1642 | |
} |
1643 | 7 | parent.removeContent( element ); |
1644 | |
} |
1645 | 1213 | return element; |
1646 | |
} |
1647 | |
|
1648 | |
|
1649 | |
|
1650 | |
|
1651 | |
|
1652 | |
|
1653 | |
|
1654 | |
|
1655 | |
|
1656 | |
protected void updateExclusion( Exclusion value, String xmlTag, Counter counter, Element element ) |
1657 | |
{ |
1658 | 0 | Element root = element; |
1659 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1660 | 0 | findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); |
1661 | 0 | findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); |
1662 | 0 | } |
1663 | |
|
1664 | |
|
1665 | |
|
1666 | |
|
1667 | |
|
1668 | |
|
1669 | |
|
1670 | |
|
1671 | |
|
1672 | |
protected void updateExtension( Extension value, String xmlTag, Counter counter, Element element ) |
1673 | |
{ |
1674 | 6 | Element root = element; |
1675 | 6 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1676 | 6 | findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); |
1677 | 6 | findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); |
1678 | 6 | findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); |
1679 | 6 | } |
1680 | |
|
1681 | |
|
1682 | |
|
1683 | |
|
1684 | |
|
1685 | |
|
1686 | |
|
1687 | |
|
1688 | |
|
1689 | |
protected void updateFileSet( FileSet value, String xmlTag, Counter counter, Element element ) |
1690 | |
{ |
1691 | 0 | boolean shouldExist = value != null; |
1692 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1693 | 0 | if ( shouldExist ) |
1694 | |
{ |
1695 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1696 | 0 | findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null ); |
1697 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getIncludes(), "includes", "include" ); |
1698 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getExcludes(), "excludes", "exclude" ); |
1699 | |
} |
1700 | 0 | } |
1701 | |
|
1702 | |
|
1703 | |
|
1704 | |
|
1705 | |
|
1706 | |
|
1707 | |
|
1708 | |
|
1709 | |
|
1710 | |
protected void updateIssueManagement( IssueManagement value, String xmlTag, Counter counter, Element element ) |
1711 | |
{ |
1712 | 28 | boolean shouldExist = value != null; |
1713 | 28 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1714 | 28 | if ( shouldExist ) |
1715 | |
{ |
1716 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1717 | 0 | findAndReplaceSimpleElement( innerCount, root, "system", value.getSystem(), null ); |
1718 | 0 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
1719 | |
} |
1720 | 28 | } |
1721 | |
|
1722 | |
|
1723 | |
|
1724 | |
|
1725 | |
|
1726 | |
|
1727 | |
|
1728 | |
|
1729 | |
|
1730 | |
protected void updateLicense( License value, String xmlTag, Counter counter, Element element ) |
1731 | |
{ |
1732 | 0 | Element root = element; |
1733 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1734 | 0 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
1735 | 0 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
1736 | 0 | findAndReplaceSimpleElement( innerCount, root, "distribution", value.getDistribution(), null ); |
1737 | 0 | findAndReplaceSimpleElement( innerCount, root, "comments", value.getComments(), null ); |
1738 | 0 | } |
1739 | |
|
1740 | |
|
1741 | |
|
1742 | |
|
1743 | |
|
1744 | |
|
1745 | |
|
1746 | |
|
1747 | |
|
1748 | |
protected void updateMailingList( MailingList value, String xmlTag, Counter counter, Element element ) |
1749 | |
{ |
1750 | 0 | Element root = element; |
1751 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1752 | 0 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
1753 | 0 | findAndReplaceSimpleElement( innerCount, root, "subscribe", value.getSubscribe(), null ); |
1754 | 0 | findAndReplaceSimpleElement( innerCount, root, "unsubscribe", value.getUnsubscribe(), null ); |
1755 | 0 | findAndReplaceSimpleElement( innerCount, root, "post", value.getPost(), null ); |
1756 | 0 | findAndReplaceSimpleElement( innerCount, root, "archive", value.getArchive(), null ); |
1757 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getOtherArchives(), "otherArchives", "otherArchive" ); |
1758 | 0 | } |
1759 | |
|
1760 | |
|
1761 | |
|
1762 | |
|
1763 | |
|
1764 | |
|
1765 | |
|
1766 | |
|
1767 | |
|
1768 | |
protected void updateModel( Model value, String xmlTag, Counter counter, Element element ) |
1769 | |
{ |
1770 | 28 | Element root = element; |
1771 | 28 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1772 | 28 | updateParent( value.getParent(), "parent", innerCount, root ); |
1773 | 28 | findAndReplaceSimpleElement( innerCount, root, "modelVersion", value.getModelVersion(), null ); |
1774 | 28 | findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); |
1775 | 28 | findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); |
1776 | 28 | findAndReplaceSimpleElement( innerCount, root, "packaging", value.getPackaging(), "jar" ); |
1777 | 28 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
1778 | 28 | findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); |
1779 | 28 | findAndReplaceSimpleElement( innerCount, root, "description", value.getDescription(), null ); |
1780 | 28 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
1781 | 28 | updatePrerequisites( value.getPrerequisites(), "prerequisites", innerCount, root ); |
1782 | 28 | updateIssueManagement( value.getIssueManagement(), "issueManagement", innerCount, root ); |
1783 | 28 | updateCiManagement( value.getCiManagement(), "ciManagement", innerCount, root ); |
1784 | 28 | findAndReplaceSimpleElement( innerCount, root, "inceptionYear", value.getInceptionYear(), null ); |
1785 | 28 | iterateMailingList( innerCount, root, value.getMailingLists(), "mailingLists", "mailingList" ); |
1786 | 28 | iterateDeveloper( innerCount, root, value.getDevelopers(), "developers", "developer" ); |
1787 | 28 | iterateContributor( innerCount, root, value.getContributors(), "contributors", "contributor" ); |
1788 | 28 | iterateLicense( innerCount, root, value.getLicenses(), "licenses", "license" ); |
1789 | 28 | updateScm( value.getScm(), "scm", innerCount, root ); |
1790 | 28 | updateOrganization( value.getOrganization(), "organization", innerCount, root ); |
1791 | 28 | updateBuild( value.getBuild(), "build", innerCount, root ); |
1792 | 28 | iterateProfile( innerCount, root, value.getProfiles(), "profiles", "profile" ); |
1793 | 28 | findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" ); |
1794 | 28 | iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" ); |
1795 | 28 | iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository" ); |
1796 | 28 | iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" ); |
1797 | 28 | findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() ); |
1798 | 28 | updateReporting( value.getReporting(), "reporting", innerCount, root ); |
1799 | 28 | updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root ); |
1800 | 28 | updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root ); |
1801 | 28 | findAndReplaceProperties( innerCount, root, "properties", value.getProperties() ); |
1802 | 28 | } |
1803 | |
|
1804 | |
|
1805 | |
|
1806 | |
|
1807 | |
|
1808 | |
|
1809 | |
|
1810 | |
|
1811 | |
|
1812 | |
protected void updateModelBase( ModelBase value, String xmlTag, Counter counter, Element element ) |
1813 | |
{ |
1814 | 0 | boolean shouldExist = value != null; |
1815 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1816 | 0 | if ( shouldExist ) |
1817 | |
{ |
1818 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1819 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" ); |
1820 | 0 | iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" ); |
1821 | 0 | iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", |
1822 | |
"pluginRepository" ); |
1823 | 0 | iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" ); |
1824 | 0 | findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() ); |
1825 | 0 | updateReporting( value.getReporting(), "reporting", innerCount, root ); |
1826 | 0 | updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root ); |
1827 | 0 | updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, |
1828 | |
root ); |
1829 | 0 | findAndReplaceProperties( innerCount, root, "properties", value.getProperties() ); |
1830 | |
} |
1831 | 0 | } |
1832 | |
|
1833 | |
|
1834 | |
|
1835 | |
|
1836 | |
|
1837 | |
|
1838 | |
|
1839 | |
|
1840 | |
|
1841 | |
protected void updateNotifier( Notifier value, String xmlTag, Counter counter, Element element ) |
1842 | |
{ |
1843 | 0 | Element root = element; |
1844 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1845 | 0 | findAndReplaceSimpleElement( innerCount, root, "type", value.getType(), "mail" ); |
1846 | 0 | findAndReplaceSimpleElement( innerCount, root, "sendOnError", |
1847 | |
( value.isSendOnError() == true ) ? null : String.valueOf( value.isSendOnError() ), |
1848 | |
"true" ); |
1849 | 0 | findAndReplaceSimpleElement( innerCount, root, "sendOnFailure", ( value.isSendOnFailure() == true ) |
1850 | |
? null |
1851 | |
: String.valueOf( value.isSendOnFailure() ), "true" ); |
1852 | 0 | findAndReplaceSimpleElement( innerCount, root, "sendOnSuccess", ( value.isSendOnSuccess() == true ) |
1853 | |
? null |
1854 | |
: String.valueOf( value.isSendOnSuccess() ), "true" ); |
1855 | 0 | findAndReplaceSimpleElement( innerCount, root, "sendOnWarning", ( value.isSendOnWarning() == true ) |
1856 | |
? null |
1857 | |
: String.valueOf( value.isSendOnWarning() ), "true" ); |
1858 | 0 | findAndReplaceSimpleElement( innerCount, root, "address", value.getAddress(), null ); |
1859 | 0 | findAndReplaceProperties( innerCount, root, "configuration", value.getConfiguration() ); |
1860 | 0 | } |
1861 | |
|
1862 | |
|
1863 | |
|
1864 | |
|
1865 | |
|
1866 | |
|
1867 | |
|
1868 | |
|
1869 | |
|
1870 | |
protected void updateOrganization( Organization value, String xmlTag, Counter counter, Element element ) |
1871 | |
{ |
1872 | 28 | boolean shouldExist = value != null; |
1873 | 28 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1874 | 28 | if ( shouldExist ) |
1875 | |
{ |
1876 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1877 | 0 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
1878 | 0 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
1879 | |
} |
1880 | 28 | } |
1881 | |
|
1882 | |
|
1883 | |
|
1884 | |
|
1885 | |
|
1886 | |
|
1887 | |
|
1888 | |
|
1889 | |
|
1890 | |
protected void updateParent( Parent value, String xmlTag, Counter counter, Element element ) |
1891 | |
{ |
1892 | 28 | boolean shouldExist = value != null; |
1893 | 28 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1894 | 28 | if ( shouldExist ) |
1895 | |
{ |
1896 | 15 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1897 | 15 | findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); |
1898 | 15 | findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); |
1899 | 15 | findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); |
1900 | 15 | findAndReplaceSimpleElement( innerCount, root, "relativePath", value.getRelativePath(), "../pom.xml" ); |
1901 | |
} |
1902 | 28 | } |
1903 | |
|
1904 | |
|
1905 | |
|
1906 | |
|
1907 | |
|
1908 | |
|
1909 | |
|
1910 | |
|
1911 | |
|
1912 | |
protected void updatePatternSet( PatternSet value, String xmlTag, Counter counter, Element element ) |
1913 | |
{ |
1914 | 0 | boolean shouldExist = value != null; |
1915 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1916 | 0 | if ( shouldExist ) |
1917 | |
{ |
1918 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1919 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getIncludes(), "includes", "include" ); |
1920 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getExcludes(), "excludes", "exclude" ); |
1921 | |
} |
1922 | 0 | } |
1923 | |
|
1924 | |
|
1925 | |
|
1926 | |
|
1927 | |
|
1928 | |
|
1929 | |
|
1930 | |
|
1931 | |
|
1932 | |
protected void updatePlugin( Plugin value, String xmlTag, Counter counter, Element element ) |
1933 | |
{ |
1934 | 9 | Element root = element; |
1935 | 9 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1936 | 9 | findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), "org.apache.maven.plugins" ); |
1937 | 9 | findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); |
1938 | 9 | findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); |
1939 | 9 | findAndReplaceSimpleElement( innerCount, root, "extensions", |
1940 | |
( value.isExtensions() == false ) ? null : String.valueOf( value.isExtensions() ), |
1941 | |
"false" ); |
1942 | 9 | iteratePluginExecution( innerCount, root, value.getExecutions(), "executions", "execution" ); |
1943 | 9 | iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" ); |
1944 | 9 | findAndReplaceXpp3DOM( innerCount, root, "goals", (Xpp3Dom) value.getGoals() ); |
1945 | 9 | findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); |
1946 | 9 | findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); |
1947 | 9 | } |
1948 | |
|
1949 | |
|
1950 | |
|
1951 | |
|
1952 | |
|
1953 | |
|
1954 | |
|
1955 | |
|
1956 | |
|
1957 | |
protected void updatePluginConfiguration( PluginConfiguration value, String xmlTag, Counter counter, |
1958 | |
Element element ) |
1959 | |
{ |
1960 | 0 | boolean shouldExist = value != null; |
1961 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1962 | 0 | if ( shouldExist ) |
1963 | |
{ |
1964 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1965 | 0 | updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root ); |
1966 | 0 | iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); |
1967 | |
} |
1968 | 0 | } |
1969 | |
|
1970 | |
|
1971 | |
|
1972 | |
|
1973 | |
|
1974 | |
|
1975 | |
|
1976 | |
|
1977 | |
|
1978 | |
protected void updatePluginContainer( PluginContainer value, String xmlTag, Counter counter, Element element ) |
1979 | |
{ |
1980 | 0 | boolean shouldExist = value != null; |
1981 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
1982 | 0 | if ( shouldExist ) |
1983 | |
{ |
1984 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
1985 | 0 | iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); |
1986 | |
} |
1987 | 0 | } |
1988 | |
|
1989 | |
|
1990 | |
|
1991 | |
|
1992 | |
|
1993 | |
|
1994 | |
|
1995 | |
|
1996 | |
|
1997 | |
protected void updatePluginExecution( PluginExecution value, String xmlTag, Counter counter, Element element ) |
1998 | |
{ |
1999 | 0 | Element root = element; |
2000 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2001 | 0 | findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" ); |
2002 | 0 | findAndReplaceSimpleElement( innerCount, root, "phase", value.getPhase(), null ); |
2003 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getGoals(), "goals", "goal" ); |
2004 | 0 | findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); |
2005 | 0 | findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); |
2006 | 0 | } |
2007 | |
|
2008 | |
|
2009 | |
|
2010 | |
|
2011 | |
|
2012 | |
|
2013 | |
|
2014 | |
|
2015 | |
|
2016 | |
protected void updatePluginManagement( PluginManagement value, String xmlTag, Counter counter, Element element ) |
2017 | |
{ |
2018 | 9 | boolean shouldExist = value != null; |
2019 | 9 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
2020 | 9 | if ( shouldExist ) |
2021 | |
{ |
2022 | 6 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2023 | 6 | iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); |
2024 | |
} |
2025 | 9 | } |
2026 | |
|
2027 | |
|
2028 | |
|
2029 | |
|
2030 | |
|
2031 | |
|
2032 | |
|
2033 | |
|
2034 | |
|
2035 | |
protected void updatePrerequisites( Prerequisites value, String xmlTag, Counter counter, Element element ) |
2036 | |
{ |
2037 | 28 | boolean shouldExist = value != null; |
2038 | 28 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
2039 | 28 | if ( shouldExist ) |
2040 | |
{ |
2041 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2042 | 0 | findAndReplaceSimpleElement( innerCount, root, "maven", value.getMaven(), "2.0" ); |
2043 | |
} |
2044 | 28 | } |
2045 | |
|
2046 | |
|
2047 | |
|
2048 | |
|
2049 | |
|
2050 | |
|
2051 | |
|
2052 | |
|
2053 | |
|
2054 | |
protected void updateProfile( Profile value, String xmlTag, Counter counter, Element element ) |
2055 | |
{ |
2056 | 0 | Element root = element; |
2057 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2058 | 0 | findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); |
2059 | 0 | updateActivation( value.getActivation(), "activation", innerCount, root ); |
2060 | 0 | updateBuildBase( value.getBuild(), "build", innerCount, root ); |
2061 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" ); |
2062 | 0 | iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" ); |
2063 | 0 | iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository" ); |
2064 | 0 | iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" ); |
2065 | 0 | findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() ); |
2066 | 0 | updateReporting( value.getReporting(), "reporting", innerCount, root ); |
2067 | 0 | updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root ); |
2068 | 0 | updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root ); |
2069 | 0 | findAndReplaceProperties( innerCount, root, "properties", value.getProperties() ); |
2070 | 0 | } |
2071 | |
|
2072 | |
|
2073 | |
|
2074 | |
|
2075 | |
|
2076 | |
|
2077 | |
|
2078 | |
|
2079 | |
|
2080 | |
protected void updateRelocation( Relocation value, String xmlTag, Counter counter, Element element ) |
2081 | |
{ |
2082 | 0 | boolean shouldExist = value != null; |
2083 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
2084 | 0 | if ( shouldExist ) |
2085 | |
{ |
2086 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2087 | 0 | findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null ); |
2088 | 0 | findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); |
2089 | 0 | findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); |
2090 | 0 | findAndReplaceSimpleElement( innerCount, root, "message", value.getMessage(), null ); |
2091 | |
} |
2092 | 0 | } |
2093 | |
|
2094 | |
|
2095 | |
|
2096 | |
|
2097 | |
|
2098 | |
|
2099 | |
|
2100 | |
|
2101 | |
|
2102 | |
protected void updateReporting( Reporting value, String xmlTag, Counter counter, Element element ) |
2103 | |
{ |
2104 | 28 | boolean shouldExist = value != null; |
2105 | 28 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
2106 | 28 | if ( shouldExist ) |
2107 | |
{ |
2108 | 3 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2109 | 3 | findAndReplaceSimpleElement( innerCount, root, "excludeDefaults", ( value.isExcludeDefaults() == false ) |
2110 | |
? null |
2111 | |
: String.valueOf( value.isExcludeDefaults() ), "false" ); |
2112 | 3 | findAndReplaceSimpleElement( innerCount, root, "outputDirectory", value.getOutputDirectory(), null ); |
2113 | 3 | iterateReportPlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); |
2114 | |
} |
2115 | 28 | } |
2116 | |
|
2117 | |
|
2118 | |
|
2119 | |
|
2120 | |
|
2121 | |
|
2122 | |
|
2123 | |
|
2124 | |
|
2125 | |
protected void updateReportPlugin( ReportPlugin value, String xmlTag, Counter counter, Element element ) |
2126 | |
{ |
2127 | 3 | Element root = element; |
2128 | 3 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2129 | 3 | findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), "org.apache.maven.plugins" ); |
2130 | 3 | findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null ); |
2131 | 3 | findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null ); |
2132 | 3 | findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); |
2133 | 3 | findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); |
2134 | 3 | iterateReportSet( innerCount, root, value.getReportSets(), "reportSets", "reportSet" ); |
2135 | 3 | } |
2136 | |
|
2137 | |
|
2138 | |
|
2139 | |
|
2140 | |
|
2141 | |
|
2142 | |
|
2143 | |
|
2144 | |
|
2145 | |
protected void updateReportSet( ReportSet value, String xmlTag, Counter counter, Element element ) |
2146 | |
{ |
2147 | 0 | Element root = element; |
2148 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2149 | 0 | findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" ); |
2150 | 0 | findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() ); |
2151 | 0 | findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null ); |
2152 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getReports(), "reports", "report" ); |
2153 | 0 | } |
2154 | |
|
2155 | |
|
2156 | |
|
2157 | |
|
2158 | |
|
2159 | |
|
2160 | |
|
2161 | |
|
2162 | |
|
2163 | |
protected void updateRepository( Repository value, String xmlTag, Counter counter, Element element ) |
2164 | |
{ |
2165 | 0 | Element root = element; |
2166 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2167 | 0 | updateRepositoryPolicy( value.getReleases(), "releases", innerCount, root ); |
2168 | 0 | updateRepositoryPolicy( value.getSnapshots(), "snapshots", innerCount, root ); |
2169 | 0 | findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); |
2170 | 0 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
2171 | 0 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
2172 | 0 | findAndReplaceSimpleElement( innerCount, root, "layout", value.getLayout(), "default" ); |
2173 | 0 | } |
2174 | |
|
2175 | |
|
2176 | |
|
2177 | |
|
2178 | |
|
2179 | |
|
2180 | |
|
2181 | |
|
2182 | |
|
2183 | |
protected void updateRepositoryBase( RepositoryBase value, String xmlTag, Counter counter, Element element ) |
2184 | |
{ |
2185 | 0 | boolean shouldExist = value != null; |
2186 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
2187 | 0 | if ( shouldExist ) |
2188 | |
{ |
2189 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2190 | 0 | findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); |
2191 | 0 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
2192 | 0 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
2193 | 0 | findAndReplaceSimpleElement( innerCount, root, "layout", value.getLayout(), "default" ); |
2194 | |
} |
2195 | 0 | } |
2196 | |
|
2197 | |
|
2198 | |
|
2199 | |
|
2200 | |
|
2201 | |
|
2202 | |
|
2203 | |
|
2204 | |
|
2205 | |
protected void updateRepositoryPolicy( RepositoryPolicy value, String xmlTag, Counter counter, Element element ) |
2206 | |
{ |
2207 | 0 | boolean shouldExist = value != null; |
2208 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
2209 | 0 | if ( shouldExist ) |
2210 | |
{ |
2211 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2212 | 0 | findAndReplaceSimpleElement( innerCount, root, "enabled", |
2213 | |
( value.isEnabled() == true ) ? null : String.valueOf( value.isEnabled() ), |
2214 | |
"true" ); |
2215 | 0 | findAndReplaceSimpleElement( innerCount, root, "updatePolicy", value.getUpdatePolicy(), null ); |
2216 | 0 | findAndReplaceSimpleElement( innerCount, root, "checksumPolicy", value.getChecksumPolicy(), null ); |
2217 | |
} |
2218 | 0 | } |
2219 | |
|
2220 | |
|
2221 | |
|
2222 | |
|
2223 | |
|
2224 | |
|
2225 | |
|
2226 | |
|
2227 | |
|
2228 | |
protected void updateResource( Resource value, String xmlTag, Counter counter, Element element ) |
2229 | |
{ |
2230 | 0 | Element root = element; |
2231 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2232 | 0 | findAndReplaceSimpleElement( innerCount, root, "targetPath", value.getTargetPath(), null ); |
2233 | 0 | findAndReplaceSimpleElement( innerCount, root, "filtering", |
2234 | |
( value.isFiltering() == false ) ? null : String.valueOf( value.isFiltering() ), |
2235 | |
"false" ); |
2236 | 0 | findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null ); |
2237 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getIncludes(), "includes", "include" ); |
2238 | 0 | findAndReplaceSimpleLists( innerCount, root, value.getExcludes(), "excludes", "exclude" ); |
2239 | 0 | } |
2240 | |
|
2241 | |
|
2242 | |
|
2243 | |
|
2244 | |
|
2245 | |
|
2246 | |
|
2247 | |
|
2248 | |
|
2249 | |
protected void updateScm( Scm value, String xmlTag, Counter counter, Element element ) |
2250 | |
{ |
2251 | 28 | boolean shouldExist = value != null; |
2252 | 28 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
2253 | 28 | if ( shouldExist ) |
2254 | |
{ |
2255 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2256 | 0 | findAndReplaceSimpleElement( innerCount, root, "connection", value.getConnection(), null ); |
2257 | 0 | findAndReplaceSimpleElement( innerCount, root, "developerConnection", value.getDeveloperConnection(), |
2258 | |
null ); |
2259 | 0 | findAndReplaceSimpleElement( innerCount, root, "tag", value.getTag(), "HEAD" ); |
2260 | 0 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
2261 | |
} |
2262 | 28 | } |
2263 | |
|
2264 | |
|
2265 | |
|
2266 | |
|
2267 | |
|
2268 | |
|
2269 | |
|
2270 | |
|
2271 | |
|
2272 | |
protected void updateSite( Site value, String xmlTag, Counter counter, Element element ) |
2273 | |
{ |
2274 | 0 | boolean shouldExist = value != null; |
2275 | 0 | Element root = updateElement( counter, element, xmlTag, shouldExist ); |
2276 | 0 | if ( shouldExist ) |
2277 | |
{ |
2278 | 0 | Counter innerCount = new Counter( counter.getDepth() + 1 ); |
2279 | 0 | findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null ); |
2280 | 0 | findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null ); |
2281 | 0 | findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null ); |
2282 | |
} |
2283 | 0 | } |
2284 | |
|
2285 | |
|
2286 | |
|
2287 | |
|
2288 | |
|
2289 | |
|
2290 | |
|
2291 | |
|
2292 | |
|
2293 | |
|
2294 | |
public class Counter |
2295 | |
{ |
2296 | |
|
2297 | |
|
2298 | |
|
2299 | |
|
2300 | |
|
2301 | |
|
2302 | |
|
2303 | 148 | private int currentIndex = 0; |
2304 | |
|
2305 | |
|
2306 | |
|
2307 | |
|
2308 | |
private int level; |
2309 | |
|
2310 | |
|
2311 | |
|
2312 | |
|
2313 | |
|
2314 | |
public Counter( int depthLevel ) |
2315 | 148 | { |
2316 | 148 | level = depthLevel; |
2317 | 148 | } |
2318 | |
|
2319 | |
|
2320 | |
|
2321 | |
|
2322 | |
|
2323 | |
|
2324 | |
|
2325 | |
|
2326 | |
public int getCurrentIndex() |
2327 | |
{ |
2328 | 243 | return currentIndex; |
2329 | |
} |
2330 | |
|
2331 | |
|
2332 | |
|
2333 | |
|
2334 | |
public int getDepth() |
2335 | |
{ |
2336 | 305 | return level; |
2337 | |
} |
2338 | |
|
2339 | |
|
2340 | |
|
2341 | |
|
2342 | |
public void increaseCount() |
2343 | |
{ |
2344 | 350 | currentIndex = currentIndex + 1; |
2345 | 350 | } |
2346 | |
} |
2347 | |
} |