View Javadoc

1   package org.devaki.nextobjects.util;
2   /*
3    *  nextobjects Copyright (C) 2001-2005 Emmanuel Florent
4    *  This program is free software; you can redistribute it and/or modify
5    *  it under the terms of the GNU General Public License as published by the
6    *  Free Software Foundation; either version 2 of the License, or (at your
7    *  option) any later version.
8    *  This program is distributed in the hope that it will
9    *  be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
10   *  of MERCHANinTABILITY or FITNESS FOR A PARTICULAR
11   *  PURPOSE. See the GNU General Public License for more details.
12   *  You should have received a copy of the GNU General Public License along
13   *  with this program; if not, write to the Free Software Foundation, Inc., 59
14   *  Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15   */
16  import java.io.IOException;
17  import java.io.OutputStream;
18  import java.util.Iterator;
19  import java.util.List;
20  
21  import org.apache.commons.logging.Log;
22  import org.apache.commons.logging.LogFactory;
23  import org.apache.maven.project.Build;
24  import org.apache.maven.project.Contributor;
25  import org.apache.maven.project.Dependency;
26  import org.apache.maven.project.Developer;
27  import org.apache.maven.project.License;
28  import org.apache.maven.project.MailingList;
29  import org.apache.maven.project.Resource;
30  import org.apache.maven.project.UnitTest;
31  import org.apache.xerces.dom.DOMImplementationImpl;
32  import org.apache.xerces.dom.DocumentImpl;
33  import org.apache.xerces.dom.DocumentTypeImpl;
34  import org.apache.xml.serialize.OutputFormat;
35  import org.apache.xml.serialize.XMLSerializer;
36  import org.devaki.nextobjects.workspace.models.BaseModel;
37  import org.devaki.nextobjects.workspace.models.ConceptualModel;
38  import org.devaki.nextobjects.workspace.models.PhysicalModel;
39  import org.devaki.nextobjects.workspace.models.Property;
40  import org.devaki.nextobjects.workspace.models.columns.Column;
41  import org.devaki.nextobjects.workspace.models.graphics.ClassView;
42  import org.devaki.nextobjects.workspace.models.graphics.LabelView;
43  import org.devaki.nextobjects.workspace.models.graphics.LineView;
44  import org.devaki.nextobjects.workspace.models.graphics.ModelTitleView;
45  import org.devaki.nextobjects.workspace.models.objects.Association;
46  import org.devaki.nextobjects.workspace.models.objects.AssociationLink;
47  import org.devaki.nextobjects.workspace.models.objects.BaseClass;
48  import org.devaki.nextobjects.workspace.models.objects.Constraint;
49  import org.devaki.nextobjects.workspace.models.objects.Entity;
50  import org.devaki.nextobjects.workspace.models.objects.InheritanceLink;
51  import org.devaki.nextobjects.workspace.models.objects.Label;
52  import org.devaki.nextobjects.workspace.models.objects.Table;
53  import org.devaki.nextobjects.workspace.models.styles.ClassStyle;
54  import org.devaki.nextobjects.workspace.models.styles.LineStyle;
55  import org.w3c.dom.DOMImplementation;
56  import org.w3c.dom.Document;
57  import org.w3c.dom.Element;
58  import org.w3c.dom.Node;
59  /***
60   *  this class is responsible for devaki-nextobjects XML output
61   *  <ul>this class generate :
62   *    <li> CDM , conceptuals models
63   *    <li> PDM, physicals models
64   *    <li> [TORQUE] XML, so called <code>${project}-schema.xml</code>, suited to
65   *    the torque DTD, in that case there may not exist location and style
66   *    information
67   *    <li> [MAVEN] XML, so called <code>project.xml</code>, in that case there
68   *    may not exist any database information
69   *  </ul>
70   *  additionaly the DOM tree might be checked against a DTD (not implemented)
71   *  This class may cause problem as at time of writing the static instance can
72   *  make only one I/O at at time
73   *
74   * @author     <a href="mailto:eflorent@devaki.org">Emmanuel Florent</a>
75   * @created    December 27, 2003
76   * @todo       Fix inheritance IO
77   * @todo       refactor includes/excludes
78   * @todo       fix constraint defaults
79   * @fix        linecolor in style
80   */
81  public class NOXMLOutputer
82  {
83      /***  the logger */
84      private static Log logger =
85          LogFactory.getLog(NOXMLOutputer.class.getName());
86      /***  The document */
87      private static Document doc = null;
88  
89  
90      /***
91       *  Write a model to an XML stream.
92       *
93       * @param  pCDM            the conceptual Model to write
94       * @param  out             the output stream
95       * @throws  IOException
96       * @throws  JDOMException
97       */
98      public static void writeModel(
99          final ConceptualModel pCDM,
100         final OutputStream out)
101     {
102     DOMImplementation dom = new DOMImplementationImpl();
103     DocumentTypeImpl docType =
104             new DocumentTypeImpl(
105             null,
106             "cdm",
107             null,
108             NODTDResolver.WEB_SITE_DTD_CDM);
109 
110         doc = new DocumentImpl(docType);
111 
112     Element root = doc.createElement("cdm");
113 
114         doc.appendChild(root);
115         writeBaseModel(root, pCDM);
116 
117     // work on entities
118     Iterator itEnt = pCDM.getEntities().iterator();
119 
120         while (itEnt.hasNext())
121         {
122         // write the entity content.
123         Entity ent = (Entity) itEnt.next();
124         Element eltEnt = writeBaseClass(ent, "entity");
125 
126             root.appendChild(eltEnt);
127         }
128 
129     // work on association
130     Iterator itAsso = pCDM.getAssociations().iterator();
131 
132         while (itAsso.hasNext())
133         {
134         //Association
135         BaseClass asso = (BaseClass) itAsso.next();
136         Element eltAsso = writeBaseClass(asso, "association");
137 
138             root.appendChild(eltAsso);
139 
140         //Association links
141         Iterator itLinks =
142                 ((Association) asso).getAssociationLinks().iterator();
143 
144             while (itLinks.hasNext())
145             {
146             AssociationLink assoLink = (AssociationLink) itLinks.next();
147             Element eltLink = doc.createElement("associationLink");
148 
149                 eltLink.setAttribute(
150                     "linkedEntity",
151                     assoLink.getChildClass().getCode());
152                 eltLink.setAttribute(
153                     "cardinality",
154                     new Integer(assoLink.getCard()).toString());
155                 eltLink.setAttribute(
156                     "localCtrlPoint",
157                     Integer.toString(
158                     ((LineView) assoLink.getObjectView())
159                     .getLocalPosition()));
160                 eltLink.setAttribute(
161                     "foreignCtrlPoint",
162                     Integer.toString(
163                     ((LineView) assoLink.getObjectView())
164                     .getForeignPosition()));
165                 // saves the style
166                 eltLink.setAttribute(
167                     "lineColor",
168                     NOGraphicsUtil.color2HexString(
169                     (((LineView) assoLink.getObjectView()).getStyle())
170                     .getLineColor()));
171                 // implement optional controlPoint here.
172                 eltAsso.appendChild(eltLink);
173             }
174         }
175 
176     // work on Inheritance Link
177     Iterator itInher = pCDM.getInheritanceLinks().iterator();
178 
179         while (itInher.hasNext())
180         {
181             root.appendChild(
182                 writeInheritanceLink((InheritanceLink) itInher.next()));
183         }
184 
185     OutputFormat format = new OutputFormat(doc);
186 
187         format.setIndenting(true);
188 
189     //Serialize DOM
190     XMLSerializer serial = new XMLSerializer(out, format);
191 
192         try
193         {
194             serial.asDOMSerializer();
195             serial.serialize(doc.getDocumentElement());
196         }
197         catch (IOException ioex)
198         {
199             logger.error(ioex);
200         }
201     }
202 
203 
204     /***
205      *  Save a PDM to an XML stream
206      *
207      * @param  pPDM            the physical model toi write
208      * @param  out             the output stream
209      * @throws  IOException
210      * @throws  JDOMException
211      */
212     public static void writeModel(
213         final PhysicalModel pPDM,
214         final OutputStream out)
215     {
216     DOMImplementation dom = new DOMImplementationImpl();
217     DocumentTypeImpl docType =
218             new DocumentTypeImpl(
219             null,
220             "pdm",
221             null,
222             NODTDResolver.WEB_SITE_DTD_PDM);
223 
224         doc = new DocumentImpl(docType);
225 
226     Element root = doc.createElement("pdm");
227 
228         doc.appendChild(root);
229         writeBaseModel(root, pPDM);
230 
231     // work on entities
232     Iterator itTable = pPDM.getTables().iterator();
233 
234         while (itTable.hasNext())
235         {
236         Table table = (Table) itTable.next();
237         Element eltTable = writeBaseClass(table, "table");
238         // work on table foreign-key
239         Iterator itConstraint = table.getConstraints().iterator();
240 
241             while (itConstraint.hasNext())
242             {
243                 eltTable.appendChild(
244                     writeForeignKey((Constraint) itConstraint.next()));
245             }
246             root.appendChild(eltTable);
247             // work on association
248         }
249 
250     // work on Inheritance Link
251     Iterator itInher = pPDM.getInheritanceLinks().iterator();
252 
253         while (itInher.hasNext())
254         {
255             root.appendChild(
256                 writeInheritanceLink((InheritanceLink) itInher.next()));
257         }
258 
259     //finaly output the whole tree
260     OutputFormat format = new OutputFormat(doc);
261 
262         format.setIndenting(true);
263 
264     //Serialize DOM
265     XMLSerializer serial = new XMLSerializer(out, format);
266 
267         try
268         {
269             serial.asDOMSerializer();
270             serial.serialize(doc.getDocumentElement());
271         }
272         catch (IOException ioex)
273         {
274             logger.error(ioex);
275         }
276     }
277 
278 
279     /***
280      *  Write a project.xml file.
281      *
282      * @param  pBaseModel       the related model
283      * @param  out              Description of the Parameter
284      * @exception  IOException  Description of the Exception
285      */
286     public static void writeProjectDotXml(
287         final BaseModel pBaseModel,
288         final OutputStream out)
289         throws IOException
290     {
291         doc = new DocumentImpl();
292 
293     //Whaou , load the whole tree
294     Element project = writeProjectDotXml(pBaseModel);
295 
296         doc.appendChild(project);
297 
298     //Output the whole tree
299     OutputFormat format = new OutputFormat(doc);
300 
301         format.setIndenting(true);
302 
303     //Serialize DOM
304     XMLSerializer serial = new XMLSerializer(out, format);
305 
306         try
307         {
308             serial.asDOMSerializer();
309             serial.serialize(doc.getDocumentElement());
310         }
311         catch (IOException ioex)
312         {
313             logger.error(ioex);
314         }
315     }
316 
317 
318     /***
319      *  Convert an ClassStyle into a JDom Element
320      *
321      * @param  pClassStyle  the ClassStyle to be written,
322      * @return              a tree node
323      */
324     private static Element writeClassStyle(final ClassStyle pClassStyle)
325     {
326     Element tmpElementClassStyle = doc.createElement("style");
327 
328         tmpElementClassStyle.setAttribute(
329             "adjusted",
330             new Boolean(pClassStyle.isTextAdjusted()).toString());
331         tmpElementClassStyle.setAttribute(
332             "backgroundColor",
333             NOGraphicsUtil.color2HexString(pClassStyle.getBackgroundColor()));
334         tmpElementClassStyle.setAttribute(
335             "borderColor",
336             NOGraphicsUtil.color2HexString(pClassStyle.getBorderColor()));
337         return tmpElementClassStyle;
338     }
339 
340 
341     /***
342      *  write a base class object to an ouput stream
343      *
344      * @param  pBaseClass  the base class to write
345      * @param  pClassType  the class type (table,association,entity)
346      * @return             the tree node
347      */
348     private static Element writeBaseClass(
349         final BaseClass pBaseClass,
350         final String pClassType)
351     {
352     Element tmpElementBaseClass = doc.createElement(pClassType);
353 
354         tmpElementBaseClass.setAttribute("name", pBaseClass.getName());
355         if (!pBaseClass.getJavaName().equals(""))
356         {
357             tmpElementBaseClass.setAttribute(
358                 "javaName",
359                 pBaseClass.getJavaName());
360         }
361         if (!pBaseClass.getIdMethod().equals(""))
362         {
363             tmpElementBaseClass.setAttribute(
364                 "idMethod",
365                 pBaseClass.getIdMethod());
366         }
367         tmpElementBaseClass.setAttribute(
368             "skipSql",
369             new Boolean(pBaseClass.getSkipSql()).toString());
370         tmpElementBaseClass.setAttribute(
371             "abstract",
372             new Boolean(pBaseClass.getAbstractClass()).toString());
373         if (!pBaseClass.getBaseClass().equals(""))
374         {
375             tmpElementBaseClass.setAttribute(
376                 "baseClass",
377                 pBaseClass.getBaseClass());
378         }
379         if (!pBaseClass.getBasePeer().equals(""))
380         {
381             tmpElementBaseClass.setAttribute(
382                 "basePeer",
383                 pBaseClass.getBasePeer());
384         }
385         tmpElementBaseClass.setAttribute("alias", pBaseClass.getAlias());
386         tmpElementBaseClass.setAttribute(
387             "javaNamingMethod",
388             pBaseClass.getJavaNamingMethod());
389         tmpElementBaseClass.setAttribute(
390             "heavyIndexing",
391             new Boolean(pBaseClass.getHeavyIndexing()).toString());
392         tmpElementBaseClass.setAttribute(
393             "description",
394             pBaseClass.getDescription());
395         //position
396         tmpElementBaseClass.setAttribute(
397             "x",
398             new Integer((int) pBaseClass.getObjectView().getLocation().getX())
399             .toString());
400         tmpElementBaseClass.setAttribute(
401             "y",
402             new Integer((int) pBaseClass.getObjectView().getLocation().getY())
403             .toString());
404         tmpElementBaseClass.setAttribute(
405             "width",
406             new Integer((int) pBaseClass.getObjectView().getSize().getWidth())
407             .toString());
408         tmpElementBaseClass.setAttribute(
409             "height",
410             new Integer((int) pBaseClass.getObjectView().getSize().getHeight())
411             .toString());
412 
413     Element code = doc.createElement("code");
414 
415         code.appendChild(doc.createTextNode(pBaseClass.getCode()));
416         tmpElementBaseClass.appendChild(code);
417         if (pBaseClass.getNotes().length() > 0)
418         {
419         Element notes = doc.createElement("notes");
420 
421             notes.appendChild(doc.createTextNode(pBaseClass.getNotes()));
422             tmpElementBaseClass.appendChild(notes);
423         }
424 
425     // write the columns infos
426     Iterator itCols = pBaseClass.getData().iterator();
427 
428         while (itCols.hasNext())
429         {
430             tmpElementBaseClass.appendChild(
431                 writeColumn(((Column) itCols.next())));
432         }
433 
434     //work on unique constraint
435     Iterator itUniques = pBaseClass.getUniques().iterator();
436 
437         while (itUniques.hasNext())
438         {
439             tmpElementBaseClass.appendChild(
440                 writeUnique((Column) itUniques.next()));
441         }
442 
443     //work on indexes
444     Iterator itIndexes = pBaseClass.getIndexes().iterator();
445 
446         while (itIndexes.hasNext())
447         {
448             tmpElementBaseClass.appendChild(
449                 writeIndex((Column) itIndexes.next()));
450         }
451         // write the style
452         tmpElementBaseClass.appendChild(
453             writeClassStyle(
454             ((ClassView) pBaseClass.getObjectView()).getStyle()));
455         return tmpElementBaseClass;
456     }
457 
458 
459     /***
460      *  Convert a Column into a JDom Elment
461      *
462      * @param  pColumn  the column to be written,
463      * @return          a tree node
464      */
465     private static Element writeColumn(final Column pColumn)
466     {
467     Element tmpElementColumn = doc.createElement("column");
468 
469         tmpElementColumn.setAttribute("name", pColumn.getName());
470         tmpElementColumn.setAttribute("javaName", pColumn.getJavaName());
471         tmpElementColumn.setAttribute("code", pColumn.getCode());
472         tmpElementColumn.setAttribute(
473             "primaryKey",
474             new Boolean(pColumn.isPk()).toString());
475         tmpElementColumn.setAttribute(
476             "required",
477             new Boolean(pColumn.isRequired()).toString());
478         tmpElementColumn.setAttribute("type", pColumn.getType().toString());
479         tmpElementColumn.setAttribute("javaType", pColumn.getJavaType());
480         tmpElementColumn.setAttribute("size", pColumn.getSize());
481         tmpElementColumn.setAttribute("default", pColumn.getDefaultValue());
482         tmpElementColumn.setAttribute(
483             "autoIncrement",
484             new Boolean(pColumn.isAutoIncrement()).toString());
485         tmpElementColumn.setAttribute("inheritance", pColumn.getInheritance());
486         // not implemented
487         tmpElementColumn.setAttribute(
488             "inputValidator",
489             pColumn.getInputValidator());
490         //ni
491         tmpElementColumn.setAttribute(
492             "javaNamingMethod",
493             pColumn.getJavaNamingMethod());
494         tmpElementColumn.setAttribute("description", pColumn.getDescription());
495         return tmpElementColumn;
496     }
497 
498 
499     /***
500      *  Convert an Element into a BaseModel
501      *
502      * @param  root        the tree element
503      * @param  pBaseModel  the base model
504      */
505     private static void writeBaseModel(
506         final Element root,
507         final BaseModel pBaseModel)
508     {
509         root.setAttribute("name", pBaseModel.getName());
510         root.setAttribute("id", pBaseModel.getId());
511         // Object Model
512         if (!pBaseModel.getDefaultIdMethod().equals("")
513              && !pBaseModel.getDefaultIdMethod().equals("none"))
514         {
515             root.setAttribute(
516                 "defaultIdMethod",
517                 pBaseModel.getDefaultIdMethod());
518         }
519         if (!pBaseModel.getDefaultJavaType().equals("")
520              && !pBaseModel.getDefaultJavaType().equals("primitive"))
521         {
522             root.setAttribute(
523                 "defaultJavaType",
524                 pBaseModel.getDefaultJavaType());
525         }
526         root.setAttribute("package", pBaseModel.getPackageName());
527         root.setAttribute("baseClass", pBaseModel.getBaseClass());
528         root.setAttribute("basePeer", pBaseModel.getBasePeer());
529         if (!pBaseModel.getDefaultJavaNamingMethod().equals("")
530              && !pBaseModel.getDefaultJavaNamingMethod().equals("underscore"))
531         {
532             root.setAttribute(
533                 "defaultJavaNamingMethod",
534                 pBaseModel.getDefaultJavaNamingMethod());
535         }
536         if (pBaseModel.getHeavyIndexing())
537         {
538             root.setAttribute(
539                 "heavyIndexing",
540                 new String(
541                 new Boolean(pBaseModel.getHeavyIndexing()).toString()));
542         }
543         if (!pBaseModel.getNotes().equals(""))
544         {
545         Element tmpElement = doc.createElement("notes");
546 
547             tmpElement.appendChild(doc.createTextNode(pBaseModel.getNotes()));
548             root.appendChild(tmpElement);
549         }
550 
551     // Database
552     Element tmpElement = doc.createElement("databaseProperties");
553     Element tmpElement2 = doc.createElement("dbType");
554 
555         tmpElement2.appendChild(
556             doc.createTextNode(new Integer(pBaseModel.getDbType()).toString()));
557         tmpElement.appendChild(tmpElement2);
558         if (!pBaseModel.getDatabaseHost().equals(""))
559         {
560             tmpElement2 = doc.createElement("databaseHost");
561             tmpElement2.appendChild(
562                 doc.createTextNode(pBaseModel.getDatabaseHost()));
563             tmpElement.appendChild(tmpElement2);
564         }
565         if (!pBaseModel.getCreateDatabaseUrl().equals(""))
566         {
567             tmpElement2 = doc.createElement("createDatabaseUrl");
568             tmpElement2.appendChild(
569                 doc.createTextNode(pBaseModel.getCreateDatabaseUrl()));
570             tmpElement.appendChild(tmpElement2);
571         }
572         if (!pBaseModel.getBuildDatabaseUrl().equals(""))
573         {
574             tmpElement2 = doc.createElement("buildDatabaseUrl");
575             tmpElement2.appendChild(
576                 doc.createTextNode(pBaseModel.getBuildDatabaseUrl()));
577             tmpElement.appendChild(tmpElement2);
578         }
579         if (!pBaseModel.getSchema().equals(""))
580         {
581             tmpElement2 = doc.createElement("schema");
582             tmpElement2.appendChild(doc.createTextNode(pBaseModel.getSchema()));
583             tmpElement.appendChild(tmpElement2);
584         }
585         if (!pBaseModel.getDatabaseUser().equals(""))
586         {
587             tmpElement2 = doc.createElement("databaseUser");
588             tmpElement2.appendChild(
589                 doc.createTextNode(pBaseModel.getDatabaseUser()));
590             tmpElement.appendChild(tmpElement2);
591         }
592         if (!pBaseModel.getDatabasePassword().equals(""))
593         {
594             tmpElement2 = doc.createElement("databasePassword");
595             tmpElement2.appendChild(
596                 doc.createTextNode(pBaseModel.getDatabasePassword()));
597             tmpElement.appendChild(tmpElement2);
598         }
599         root.appendChild(tmpElement);
600         //work on project information
601         root.appendChild(writeProjectDotXml(pBaseModel));
602         // work on Labels
603         root.appendChild(
604             writeModelTitleView(
605             (ModelTitleView) pBaseModel.getLabels().elementAt(0)));
606         // start at 1 cause 0 is ModelTitleView.
607         for (int i = 1; i < pBaseModel.getLabels().size(); i++)
608         {
609         Element tmpElementEntity =
610                 writeLabel(
611                 (Label) ((LabelView) pBaseModel.getLabels().elementAt(i))
612                 .getBaseObject());
613 
614             root.appendChild(tmpElementEntity);
615         }
616     }
617 
618 
619     /***
620      *  Write a Label to a tree
621      *
622      * @param  lbl  The label to be writtent
623      * @return      theElement
624      */
625     private static Element writeLabel(final Label lbl)
626     {
627     Element tmpElement = doc.createElement("label");
628 
629         tmpElement.setAttribute(
630             "x",
631             new Integer(lbl.getObjectView().getLocation().x).toString());
632         tmpElement.setAttribute(
633             "y",
634             new Integer(lbl.getObjectView().getLocation().y).toString());
635         tmpElement.setAttribute(
636             "width",
637             new Integer((int) lbl.getObjectView().getSize().getWidth())
638             .toString());
639         tmpElement.setAttribute(
640             "height",
641             new Integer((int) lbl.getObjectView().getSize().getHeight())
642             .toString());
643         tmpElement.setAttribute("name", lbl.getName());
644 
645     Element tmpElement2 = doc.createElement("notes");
646 
647         tmpElement2.appendChild(doc.createTextNode(lbl.getNotes()));
648         tmpElement.appendChild(tmpElement2);
649         return tmpElement;
650     }
651 
652 
653     /***
654      *  Write a Model Title View to a tree
655      *
656      * @param  pModelTitleView  the model title view
657      * @return                  theElement
658      */
659     private static Element writeModelTitleView(final ModelTitleView pModelTitleView)
660     {
661     Element tmpElement = doc.createElement("modelTitleView");
662 
663         tmpElement.setAttribute(
664             "x",
665             new Integer(pModelTitleView.getLocation().x).toString());
666         tmpElement.setAttribute(
667             "y",
668             new Integer(pModelTitleView.getLocation().y).toString());
669         tmpElement.setAttribute(
670             "width",
671             new Integer((int) pModelTitleView.getSize().getWidth()).toString());
672         tmpElement.setAttribute(
673             "height",
674             new Integer((int) pModelTitleView.getSize().getHeight())
675             .toString());
676         return tmpElement;
677     }
678 
679 
680     /***
681      *  Write a project.xml file to a jDOM element
682      *
683      * @param  pBaseModel  the related model
684      * @return             A project dom element
685      */
686     private static Element writeProjectDotXml(final BaseModel pBaseModel)
687     {
688     Element project = doc.createElement("project");
689 
690         if (pBaseModel.getParentProject() != null)
691         {
692         Element extend = doc.createElement("extend");
693 
694             extend.appendChild(
695                 doc.createTextNode(pBaseModel.getParentProject()));
696         }
697 
698     Element pomVersion = doc.createElement("pomVersion");
699 
700         pomVersion.appendChild(doc.createTextNode("3"));
701         project.appendChild(pomVersion);
702 
703     Element id = doc.createElement("id");
704 
705         id.appendChild(doc.createTextNode(pBaseModel.getId()));
706         project.appendChild(id);
707 
708     Element name = doc.createElement("name");
709 
710         name.appendChild(doc.createTextNode(pBaseModel.getName()));
711         project.appendChild(name);
712         if (!pBaseModel.getGroupId().equals(""))
713         {
714         Element groupId = doc.createElement("groupId");
715 
716             groupId.appendChild(doc.createTextNode(pBaseModel.getGroupId()));
717             project.appendChild(groupId);
718         }
719 
720     Element currentVersion = doc.createElement("currentVersion");
721 
722         currentVersion.appendChild(
723             doc.createTextNode(pBaseModel.getCurrentVersion()));
724         project.appendChild(currentVersion);
725         if (!pBaseModel.getOrganizationName().equals(""))
726         {
727         Element organization = doc.createElement("organization");
728         Element orgName = doc.createElement("name");
729 
730             orgName.appendChild(
731                 doc.createTextNode(pBaseModel.getOrganizationName()));
732             organization.appendChild(orgName);
733             if (!pBaseModel.getOrganizationUrl().equals(""))
734             {
735             Element orgUrl = doc.createElement("url");
736 
737                 orgUrl.appendChild(
738                     doc.createTextNode(pBaseModel.getOrganizationUrl()));
739                 organization.appendChild(orgUrl);
740             }
741             if (!pBaseModel.getOrganizationLogo().equals(""))
742             {
743             Element orgLogo = doc.createElement("logo");
744 
745                 orgLogo.appendChild(
746                     doc.createTextNode(pBaseModel.getOrganizationLogo()));
747                 organization.appendChild(orgLogo);
748             }
749             project.appendChild(organization);
750         }
751         if (!pBaseModel.getInceptionYear().equals(""))
752         {
753         Element inceptionYear = doc.createElement("inceptionYear");
754 
755             inceptionYear.appendChild(
756                 doc.createTextNode(pBaseModel.getInceptionYear()));
757             project.appendChild(inceptionYear);
758         }
759         if (!pBaseModel.getPackageName().equals(""))
760         {
761         Element eltPackage = doc.createElement("package");
762 
763             eltPackage.appendChild(
764                 doc.createTextNode(pBaseModel.getPackageName()));
765             project.appendChild(eltPackage);
766         }
767         if (!pBaseModel.getLogo().equals(""))
768         {
769         Element logo = doc.createElement("logo");
770 
771             logo.appendChild(doc.createTextNode(pBaseModel.getLogo()));
772             project.appendChild(logo);
773         }
774         if (!pBaseModel.getNotes().equals(""))
775         {
776         Element altId = doc.createElement("gumpRepositoryId");
777 
778             altId.appendChild(
779                 doc.createTextNode(pBaseModel.getAlternateProjectId()));
780             project.appendChild(altId);
781         }
782         if (!pBaseModel.getDescription().equals(""))
783         {
784         Element description = doc.createElement("description");
785 
786             description.appendChild(
787                 doc.createTextNode(pBaseModel.getDescription()));
788             project.appendChild(description);
789         }
790         if (!pBaseModel.getShortDescription().equals(""))
791         {
792         Element shortDescription = doc.createElement("shortDescription");
793 
794             shortDescription.appendChild(
795                 doc.createTextNode(pBaseModel.getShortDescription()));
796             project.appendChild(shortDescription);
797         }
798         if (!pBaseModel.getProjectURL().equals(""))
799         {
800         Element url = doc.createElement("url");
801 
802             url.appendChild(doc.createTextNode(pBaseModel.getProjectURL()));
803             project.appendChild(url);
804         }
805         if (!pBaseModel.getIssueTrackingUrl().equals(""))
806         {
807         Element issueTrackingUrl = doc.createElement("issueTrackingUrl");
808 
809             issueTrackingUrl.appendChild(
810                 doc.createTextNode(pBaseModel.getIssueTrackingUrl()));
811             project.appendChild(issueTrackingUrl);
812         }
813         if (!pBaseModel.getSiteAddress().equals(""))
814         {
815         Element siteAddress = doc.createElement("siteAddress");
816 
817             siteAddress.appendChild(
818                 doc.createTextNode(pBaseModel.getSiteAddress()));
819             project.appendChild(siteAddress);
820         }
821         if (!pBaseModel.getSiteDirectory().equals(""))
822         {
823         Element siteDirectory = doc.createElement("siteDirectory");
824 
825             siteDirectory.appendChild(
826                 doc.createTextNode(pBaseModel.getSiteDirectory()));
827             project.appendChild(siteDirectory);
828         }
829         if (!pBaseModel.getDistributionDirectory().equals(""))
830         {
831         Element distributionDirectory =
832                 doc.createElement("distributionDirectory");
833 
834             distributionDirectory.appendChild(
835                 doc.createTextNode(pBaseModel.getDistributionDirectory()));
836             project.appendChild(distributionDirectory);
837         }
838 
839     Element repository = doc.createElement("repository");
840     Element connection = doc.createElement("connection");
841 
842         if (!pBaseModel.getRepositoryConnection().equals(""))
843         {
844             connection.appendChild(
845                 doc.createTextNode(pBaseModel.getRepositoryConnection()));
846             repository.appendChild(connection);
847         }
848         if (!pBaseModel.getRepositoryUrl().equals(""))
849         {
850         Element eltUrl = doc.createElement("url");
851 
852             eltUrl.appendChild(
853                 doc.createTextNode(pBaseModel.getRepositoryUrl()));
854             repository.appendChild(eltUrl);
855         }
856         if (pBaseModel.getMailingLists().size() > 0)
857         {
858             project.appendChild(
859                 writeMailingLists(pBaseModel.getMailingLists()));
860         }
861         if (pBaseModel.getDevelopers().size() > 0)
862         {
863             project.appendChild(writeDevelopers(pBaseModel.getDevelopers()));
864         }
865         if (pBaseModel.getContributors().size() > 0)
866         {
867             project.appendChild(
868                 writeContributors(pBaseModel.getContributors()));
869         }
870         if (pBaseModel.getLicenses().size() > 0)
871         {
872             project.appendChild(writeLicenses(pBaseModel.getLicenses()));
873         }
874         if (pBaseModel.getDependencies().size() > 0)
875         {
876             project.appendChild(
877                 writeDependencies(pBaseModel.getDependencies()));
878         }
879         project.appendChild(writeBuild(pBaseModel.getBuild()));
880 
881     Iterator itProps = pBaseModel.getProperties().iterator();
882 
883         while (itProps.hasNext())
884         {
885             writeProperty(project, (Property) itProps.next());
886         }
887         return project;
888     }
889 
890 
891     /***
892      *  Convert a FK into a JDom Elment
893      *
894      * @param  pForeignKey  the foreign key
895      * @return              a dom element representing the FK
896      */
897     private static Element writeForeignKey(final Constraint pForeignKey)
898     {
899     Element tmpEltFK = doc.createElement("foreign-key");
900 
901         tmpEltFK.setAttribute(
902             "foreignTable",
903             pForeignKey.getChildClass().getCode());
904         tmpEltFK.setAttribute(
905             "onDelete",
906             pForeignKey.getOnDelete());
907         tmpEltFK.setAttribute(
908             "onUpdate",
909             pForeignKey.getOnUpdate());
910 
911     //Vector ForeignTablePrimaryKeys =
912     // ((Table) pForeignKey.getChildClass()).getPrimaryKeys();
913     Iterator itRef = pForeignKey.getReferences().iterator();
914 
915         //Iterator itLoc = pForeignKey.getLocalColumns().iterator();
916         while (itRef.hasNext())
917         {
918         Element tmpElementReference = doc.createElement("reference");
919 
920             tmpElementReference.setAttribute(
921                 "local",
922                 ((Column) pForeignKey.getLocalColumns().get(0)).getCode());
923             tmpElementReference.setAttribute(
924                 "foreign",
925                 ((Column) itRef.next()).getCode());
926             tmpEltFK.appendChild(tmpElementReference);
927         }
928 
929     Element tmpElementStyle = doc.createElement("style");
930     LineStyle lineStyle =
931             ((LineView) pForeignKey.getObjectView()).getStyle();
932 
933         tmpElementStyle.setAttribute(
934             "lineColor",
935             NOGraphicsUtil.color2HexString(lineStyle.getLineColor()));
936         tmpEltFK.appendChild(tmpElementStyle);
937         // Control point
938         tmpEltFK.setAttribute(
939             "localCtrlPoint",
940             Integer.toString(
941             ((LineView) pForeignKey.getObjectView()).getLocalPosition()));
942         tmpEltFK.setAttribute(
943             "foreignCtrlPoint",
944             Integer.toString(
945             ((LineView) pForeignKey.getObjectView()).getForeignPosition()));
946         return tmpEltFK;
947     }
948 
949 
950     /***
951      *  Convert a Column into a JDom Elment
952      *
953      * @param  pInheritanceLink  the inheritance link
954      * @return                   the element
955      */
956     private static Element writeInheritanceLink(final InheritanceLink pInheritanceLink)
957     {
958     Element tmpElement = doc.createElement("inheritanceLink");
959 
960         tmpElement.setAttribute(
961             "childClass",
962             pInheritanceLink.getChildClass().getCode());
963         tmpElement.setAttribute(
964             "parentClass",
965             pInheritanceLink.getParentClass().getCode());
966         tmpElement.setAttribute(
967             "localCtrlPoint",
968             Integer.toString(
969             ((LineView) pInheritanceLink.getObjectView())
970             .getLocalPosition()));
971         tmpElement.setAttribute(
972             "foreignCtrlPoint",
973             Integer.toString(
974             ((LineView) pInheritanceLink.getObjectView())
975             .getForeignPosition()));
976         tmpElement.setAttribute(
977             "lineColor",
978             NOGraphicsUtil.color2HexString(
979             (((LineView) pInheritanceLink.getObjectView()).getStyle())
980             .getLineColor()));
981         return tmpElement;
982     }
983 
984 
985     /***
986      *  Write table's unicity constraint information to a DOM element
987      *
988      * @param  pColumn  the column to be unique
989      * @return          the element
990      */
991     private static Element writeUnique(final Column pColumn)
992     {
993     Element eltUnique = doc.createElement("unique");
994     Element eltUniqueCol = doc.createElement("unique-column");
995 
996         eltUniqueCol.setAttribute("name", pColumn.getCode());
997         eltUnique.appendChild(eltUniqueCol);
998         return eltUnique;
999     }
1000 
1001 
1002     /***
1003      *  Write table's indexes to a DOM element
1004      *
1005      * @param  pColumn  the column to be indexed
1006      * @return          the element.
1007      */
1008     private static Element writeIndex(final Column pColumn)
1009     {
1010     Element eltIndex = doc.createElement("index");
1011     Element eltIndexCol = doc.createElement("index-column");
1012 
1013         // at the moment unique index doesn't implement their possible naming.
1014         //eltIndex.setAttribute(new Attribute("name",new String(""))));
1015         eltIndexCol.setAttribute("name", pColumn.getCode());
1016         eltIndex.appendChild(eltIndexCol);
1017         return eltIndex;
1018     }
1019 
1020 
1021     /***
1022      *  Write the mailing lists informations as XML
1023      *
1024      * @param  pMailingLists  the mailing lists
1025      * @return                the element.
1026      */
1027     private static Element writeMailingLists(final List pMailingLists)
1028     {
1029         if (pMailingLists.size() > 0)
1030         {
1031         Element elements = doc.createElement("mailingLists");
1032         Iterator it = pMailingLists.iterator();
1033 
1034             while (it.hasNext())
1035             {
1036             MailingList mailingList = (MailingList) it.next();
1037             Element element = doc.createElement("mailingList");
1038 
1039                 if (mailingList.getName() != null)
1040                 {
1041                 Element name = doc.createElement("name");
1042 
1043                     name.appendChild(doc.createTextNode(mailingList.getName()));
1044                     element.appendChild(name);
1045                     elements.appendChild(element);
1046                 }
1047                 if (mailingList.getSubscribe() != null)
1048                 {
1049                 Element subscribe = doc.createElement("subscribe");
1050 
1051                     subscribe.appendChild(
1052                         doc.createTextNode(mailingList.getSubscribe()));
1053                     element.appendChild(subscribe);
1054                 }
1055                 if (mailingList.getUnsubscribe() != null)
1056                 {
1057                 Element unsubscribe = doc.createElement("unsubscribe");
1058 
1059                     unsubscribe.appendChild(
1060                         doc.createTextNode(mailingList.getUnsubscribe()));
1061                     element.appendChild(unsubscribe);
1062                 }
1063                 if (mailingList.getArchive() != null)
1064                 {
1065                 Element archive = doc.createElement("archive");
1066 
1067                     archive.appendChild(
1068                         doc.createTextNode(mailingList.getArchive()));
1069                     element.appendChild(archive);
1070                 }
1071             }
1072             return elements;
1073         }
1074         else
1075         {
1076             return null;
1077             //return doc.createComment("No mailing lists");
1078         }
1079     }
1080 
1081 
1082     /***
1083      *  Write Licenses Informations as XML
1084      *
1085      * @param  pLicenses  the licenses
1086      * @return            a dom element representing the licenses objects
1087      */
1088     private static Element writeLicenses(final List pLicenses)
1089     {
1090     Iterator it = pLicenses.iterator();
1091     Element elements = doc.createElement("licenses");
1092 
1093         while (it.hasNext())
1094         {
1095         License license = (License) it.next();
1096         Element element = doc.createElement("license");
1097 
1098             if (license.getName() != null)
1099             {
1100             Element name = doc.createElement("name");
1101 
1102                 elements.appendChild(element);
1103                 name.appendChild(doc.createTextNode(license.getName()));
1104                 element.appendChild(name);
1105             }
1106             if (license.getUrl() != null)
1107             {
1108             Element url = doc.createElement("url");
1109 
1110                 url.appendChild(doc.createTextNode(license.getUrl()));
1111                 element.appendChild(url);
1112             }
1113             if (license.getDistribution() != null)
1114             {
1115             Element distribution = doc.createElement("distribution");
1116 
1117                 distribution.appendChild(
1118                     doc.createTextNode(license.getDistribution()));
1119                 element.appendChild(distribution);
1120             }
1121         }
1122         return elements;
1123     }
1124 
1125 
1126     /***
1127      *  Write developers Informations as XML
1128      *
1129      * @param  pDevelopers  the developer
1130      * @return              a dom element representing the developer.
1131      */
1132     private static Element writeDevelopers(final List pDevelopers)
1133     {
1134     Element elements = doc.createElement("developers");
1135     Iterator it = pDevelopers.iterator();
1136 
1137         while (it.hasNext())
1138         {
1139         Developer pDeveloper = (Developer) it.next();
1140         Element eltDeveloper = doc.createElement("developer");
1141 
1142             if (pDeveloper.getName() != null)
1143             {
1144             Element name = doc.createElement("name");
1145 
1146                 name.appendChild(doc.createTextNode(pDeveloper.getName()));
1147                 eltDeveloper.appendChild(name);
1148                 elements.appendChild(eltDeveloper);
1149             }
1150             if (pDeveloper.getId() != null)
1151             {
1152             Element id = doc.createElement("id");
1153 
1154                 id.appendChild(doc.createTextNode(pDeveloper.getId()));
1155                 eltDeveloper.appendChild(id);
1156             }
1157             else if (pDeveloper.getName() != null)
1158             {
1159             Element id = doc.createElement("id");
1160 
1161                 id.appendChild(doc.createTextNode(pDeveloper.getName()));
1162                 eltDeveloper.appendChild(id);
1163             }
1164             if (pDeveloper.getEmail() != null)
1165             {
1166             Element email = doc.createElement("email");
1167 
1168                 email.appendChild(doc.createTextNode(pDeveloper.getEmail()));
1169                 eltDeveloper.appendChild(email);
1170             }
1171             if (pDeveloper.getOrganization() != null)
1172             {
1173             Element organization = doc.createElement("organization");
1174 
1175                 organization.appendChild(
1176                     doc.createTextNode(pDeveloper.getOrganization()));
1177                 eltDeveloper.appendChild(organization);
1178             }
1179             if (pDeveloper.getUrl() != null)
1180             {
1181             Element url = doc.createElement("url");
1182 
1183                 url.appendChild(doc.createTextNode(pDeveloper.getUrl()));
1184                 eltDeveloper.appendChild(url);
1185             }
1186 
1187         Iterator itRoles = pDeveloper.getRoles().iterator();
1188         Element eltRoles = doc.createElement("roles");
1189 
1190             while (itRoles.hasNext())
1191             {
1192             Element role = doc.createElement("role");
1193             String strRole = itRoles.next().toString();
1194 
1195                 role.appendChild(doc.createTextNode(strRole));
1196                 eltRoles.appendChild(role);
1197             }
1198             eltDeveloper.appendChild(eltRoles);
1199         }
1200         return elements;
1201     }
1202 
1203 
1204     /***
1205      *  Write contributor Informations as XML
1206      *
1207      * @param  pContributors  the contributors
1208      * @return                a dom element representing the contributors
1209      */
1210     private static Node writeContributors(final List pContributors)
1211     {
1212         if (pContributors.size() > 0)
1213         {
1214         Element elements = doc.createElement("contributors");
1215         Iterator it = pContributors.iterator();
1216 
1217             while (it.hasNext())
1218             {
1219             Contributor pContributor = (Contributor) it.next();
1220             Element eltContributor = doc.createElement("contributor");
1221 
1222                 if (pContributor.getName() != null)
1223                 {
1224                 Element name = doc.createElement("name");
1225 
1226                     name.appendChild(
1227                         doc.createTextNode(pContributor.getName()));
1228                     eltContributor.appendChild(name);
1229                     elements.appendChild(eltContributor);
1230                 }
1231                 if (pContributor.getEmail() != null)
1232                 {
1233                 Element email = doc.createElement("email");
1234 
1235                     email.appendChild(
1236                         doc.createTextNode(pContributor.getEmail()));
1237                     eltContributor.appendChild(email);
1238                 }
1239                 if (pContributor.getOrganization() != null)
1240                 {
1241                 Element organization = doc.createElement("organization");
1242 
1243                     organization.appendChild(
1244                         doc.createTextNode(pContributor.getOrganization()));
1245                     eltContributor.appendChild(organization);
1246                 }
1247 
1248             Iterator itRoles = pContributor.getRoles().iterator();
1249             Element eltRoles = doc.createElement("roles");
1250 
1251                 while (itRoles.hasNext())
1252                 {
1253                 Element role = doc.createElement("role");
1254 
1255                     role.appendChild(
1256                         doc.createTextNode(itRoles.next().toString()));
1257                     eltRoles.appendChild(role);
1258                 }
1259                 eltContributor.appendChild(eltRoles);
1260             }
1261             return elements;
1262         }
1263         else
1264         {
1265             return null;
1266         }
1267     }
1268 
1269 
1270     /***
1271      *  Write dependencies Informations as XML
1272      *
1273      * @param  pDependencies  the deps
1274      * @return                a dom element
1275      */
1276     private static Node writeDependencies(final List pDependencies)
1277     {
1278         if (pDependencies.size() > 0)
1279         {
1280         Element elements = doc.createElement("dependencies");
1281         Iterator it = pDependencies.iterator();
1282 
1283             while (it.hasNext())
1284             {
1285             Dependency pDependency = (Dependency) it.next();
1286             Element element = doc.createElement("dependency");
1287 
1288                 if (pDependency.getId() != null)
1289                 {
1290                 Element id = doc.createElement("id");
1291 
1292                     id.appendChild(doc.createTextNode(pDependency.getId()));
1293                     element.appendChild(id);
1294                 }
1295                 if (pDependency.getVersion() != null)
1296                 {
1297                 Element version = doc.createElement("version");
1298 
1299                     version.appendChild(
1300                         doc.createTextNode(pDependency.getVersion()));
1301                     element.appendChild(version);
1302                     elements.appendChild(element);
1303                 }
1304                 if (pDependency.getJar() != null)
1305                 {
1306                 Element jar = doc.createElement("jar");
1307 
1308                     jar.appendChild(doc.createTextNode(pDependency.getJar()));
1309                     element.appendChild(jar);
1310                 }
1311                 if (pDependency.getUrl() != null)
1312                 {
1313                 Element url = doc.createElement("url");
1314 
1315                     url.appendChild(doc.createTextNode(pDependency.getUrl()));
1316                     element.appendChild(url);
1317                 }
1318             }
1319             return elements;
1320         }
1321         else
1322         {
1323             return doc.createComment("no dependencies");
1324         }
1325     }
1326 
1327 
1328     /***
1329      *  Write a resource to XML
1330      *
1331      * @param  pResources  the resources
1332      * @return             the element
1333      */
1334     private static Node writeResources(final List pResources)
1335     {
1336     Node elements;
1337 
1338         if (pResources.size() > 0)
1339         {
1340             elements = doc.createElement("resources");
1341 
1342         Iterator it = pResources.iterator();
1343 
1344             while (it.hasNext())
1345             {
1346             Resource resource = (Resource) it.next();
1347             Element element = doc.createElement("resource");
1348 
1349                 if (resource.getDirectory() != ""
1350                      && resource.getTargetPath() != "")
1351                 {
1352                 Element directory = doc.createElement("directory");
1353 
1354                     directory.appendChild(
1355                         doc.createTextNode(resource.getDirectory()));
1356                     element.appendChild(directory);
1357 
1358                 Element targetPath = doc.createElement("targetPath");
1359 
1360                     targetPath.appendChild(
1361                         doc.createTextNode(resource.getTargetPath()));
1362                     element.appendChild(targetPath);
1363                     element.appendChild(writeIncludes(resource.getIncludes()));
1364                     element.appendChild(writeExcludes(resource.getExcludes()));
1365                     elements.appendChild(element);
1366                 }
1367             }
1368         }
1369         else
1370         {
1371             elements = doc.createComment("no resources");
1372         }
1373         return elements;
1374     }
1375 
1376 
1377     /***
1378      *  Write unit test to a XML element
1379      *
1380      * @param  pUnitTest  the unit-test
1381      * @return            the element
1382      */
1383     private static Element writeUnitTest(final UnitTest pUnitTest)
1384     {
1385     Element element = doc.createElement("unitTest");
1386 
1387         element.appendChild(writeResources(pUnitTest.getResources()));
1388         return element;
1389     }
1390 
1391 
1392     /***
1393      *  Write build Informations as XML
1394      *
1395      * @param  pBuild  the build
1396      * @return         a dom element representing the build
1397      */
1398     private static Element writeBuild(final Build pBuild)
1399     {
1400     Element element = doc.createElement("build");
1401 
1402         if (pBuild.getNagEmailAddress() != null)
1403         {
1404         Element nagEmailAddress = doc.createElement("nagEmailAddress");
1405 
1406             nagEmailAddress.appendChild(
1407                 doc.createTextNode(pBuild.getNagEmailAddress()));
1408             element.appendChild(nagEmailAddress);
1409         }
1410         if (pBuild.getSourceDirectory() != null)
1411         {
1412         Element srcDir = doc.createElement("sourceDirectory");
1413 
1414             srcDir.appendChild(doc.createTextNode(pBuild.getSourceDirectory()));
1415             element.appendChild(srcDir);
1416         }
1417         if (pBuild.getUnitTestSourceDirectory() != null)
1418         {
1419         Element uTSrcDir = doc.createElement("unitTestSourceDirectory");
1420 
1421             uTSrcDir.appendChild(
1422                 doc.createTextNode(pBuild.getUnitTestSourceDirectory()));
1423             element.appendChild(uTSrcDir);
1424         }
1425         if (pBuild.getAspectSourceDirectory() != null)
1426         {
1427         Element aspctSrc = doc.createElement("aspectSourceDirectory");
1428 
1429             aspctSrc.appendChild(
1430                 doc.createTextNode(pBuild.getAspectSourceDirectory()));
1431             element.appendChild(aspctSrc);
1432         }
1433         element.appendChild(writeUnitTest(pBuild.getUnitTest()));
1434         element.appendChild(writeResources(pBuild.getResources()));
1435         return element;
1436     }
1437 
1438 
1439     /***
1440      *  Write a model property in project.xml
1441      *
1442      * @param  pRoot  The DOM element
1443      * @param  prop   the property
1444      */
1445     private static void writeProperty(final Element pRoot, final Property prop)
1446     {
1447     Element eltProp = doc.createElement("property");
1448 
1449         eltProp.setAttribute("name", prop.getName());
1450         eltProp.setAttribute("value", prop.getValue());
1451         pRoot.appendChild(eltProp);
1452     }
1453 
1454 
1455     /***
1456      *  Writes includes elements
1457      *
1458      * @param  vctIncludes  the list of includes
1459      * @return              a DOM element
1460      */
1461     private static Node writeIncludes(final List vctIncludes)
1462     {
1463         if (vctIncludes.size() > 0)
1464         {
1465         Element eltIncludes = doc.createElement("includes");
1466         Iterator itIncludes = vctIncludes.iterator();
1467 
1468             while (itIncludes.hasNext())
1469             {
1470             Element eltInclude = doc.createElement("include");
1471 
1472                 eltInclude.appendChild(
1473                     doc.createTextNode(itIncludes.next().toString()));
1474                 eltIncludes.appendChild(eltInclude);
1475             }
1476             return eltIncludes;
1477         }
1478         else
1479         {
1480             return doc.createComment("no includes");
1481         }
1482     }
1483 
1484 
1485     /***
1486      *  Write excludes element
1487      *
1488      * @param  vctExcludes  a list of excludes as string
1489      * @return              the element
1490      */
1491     private static Node writeExcludes(final List vctExcludes)
1492     {
1493         if (vctExcludes.size() > 0)
1494         {
1495         Element eltExcludes = doc.createElement("excludes");
1496         Iterator itExcludes = vctExcludes.iterator();
1497 
1498             while (itExcludes.hasNext())
1499             {
1500             Element eltExclude = doc.createElement("exclude");
1501 
1502                 eltExclude.appendChild(
1503                     doc.createTextNode(itExcludes.next().toString()));
1504                 eltExcludes.appendChild(eltExclude);
1505             }
1506             return eltExcludes;
1507         }
1508         else
1509         {
1510             return doc.createComment("no excludes");
1511         }
1512     }
1513 }
1514