Source Code Cross Referenced for FromXmlToExcel.java in  » Test-Coverage » salome-tmf » salomeTMF_plug » pluginxlsxml » Export » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Test Coverage » salome tmf » salomeTMF_plug.pluginxlsxml.Export 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * SalomeTMF is a Test Management Framework
0003:         * Copyright (C) 2007 EDF / France Telecom R&D
0004:         *
0005:         * This library is free software; you can redistribute it and/or
0006:         * modify it under the terms of the GNU Lesser General Public
0007:         * License as published by the Free Software Foundation; either
0008:         * version 2 of the License, or (at your option) any later version.
0009:         *
0010:         * This library is distributed in the hope that it will be useful,
0011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013:         * Lesser General Public License for more details.
0014:         *
0015:         * You should have received a copy of the GNU Lesser General Public
0016:         * License along with this library; if not, write to the Free Software
0017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0018:         *
0019:         * @author Jérémie DEFAYE
0020:         *
0021:         * Contact: mikael.marche@rd.francetelecom.com
0022:         */
0023:
0024:        package salomeTMF_plug.pluginxlsxml.Export;
0025:
0026:        import java.io.File;
0027:        import java.io.IOException;
0028:
0029:        import java.util.Iterator;
0030:        import java.util.List;
0031:        import java.util.StringTokenizer;
0032:
0033:        import jxl.Cell;
0034:        import jxl.write.WritableSheet;
0035:
0036:        import org.dom4j.Document;
0037:        import org.dom4j.DocumentException;
0038:        import org.dom4j.DocumentHelper;
0039:        import org.dom4j.Element;
0040:        import org.dom4j.XPath;
0041:        import org.dom4j.io.SAXReader;
0042:
0043:        import jxl.write.Number;
0044:        import jxl.CellView;
0045:        import jxl.write.Formula;
0046:        import jxl.write.Label;
0047:        import jxl.write.WritableWorkbook;
0048:        import jxl.write.WriteException;
0049:        import jxl.write.biff.RowsExceededException;
0050:
0051:        import salomeTMF_plug.pluginxlsxml.Commun.EcritEntete;
0052:        import salomeTMF_plug.pluginxlsxml.Commun.TestPresencePlugin;
0053:        import salomeTMF_plug.pluginxlsxml.language.Language;
0054:
0055:        /**
0056:         * Read a XML file, generated by SalomeTMF via DocXML Plugin, having
0057:         * requirements ans test cases, and transform it in XLS file
0058:         * 
0059:         * @author adm_dfej
0060:         */
0061:        public class FromXmlToExcel {
0062:            private WritableWorkbook workbook;
0063:            private WritableSheet requirementSheet;
0064:            private WritableSheet testSheet;
0065:            private WritableSheet paramSheet;
0066:            private WritableSheet enviroSheet;
0067:            private WritableSheet campagneSheet;
0068:            private WritableSheet execCampSheet;
0069:            private WritableSheet anomaliesSheet;
0070:
0071:            private Document documentXml;
0072:            private File fichierDeSortieXLS;
0073:            private int numeroColonne = 0;
0074:            private int numeroLigne = 0;
0075:            private int nombreLigneRequirementLu = 0;
0076:            private int numeroColonneSheetExigence = 0;
0077:            private int numeroColonneSheetBranche = 0;
0078:            private int numeroColonneSheetTest = 0;
0079:            private int nombreExigenceParCasDeTests = 0;
0080:            private int nombreActionsParCasDeTests = 0;
0081:            private Label label;
0082:            private Number nombre;
0083:            private String nomFichierXLS;
0084:            private String themeValue;
0085:            private EcritEntete ecritEntete;
0086:            private String resulEffectif = "";
0087:            private String resulActionEffectif = "";
0088:            private boolean isErreurEcritureXLS = false;
0089:            private boolean masquageColonne = true;
0090:            private String xmlDir;
0091:            //	private String[] nomFeuilles;
0092:
0093:            /**
0094:             * Get the File Separator (different between Unix and Windows)
0095:             */
0096:            private String fs = System.getProperties().getProperty(
0097:                    "file.separator");
0098:
0099:            /**
0100:             * Function that transform the XML file to a XLS file
0101:             * @param selectionExportParametre parametre case à cocher
0102:             * @param selectionExportEnvironnement parametre case à cocher
0103:             * @param selectionExportCampagne parametre case à cocher
0104:             * @param selectionExportExecutionCampagne parametre case à cocher
0105:             * @param selectionExportAnomalies parametre case à cocher
0106:             * @param selectionExportExigence parametre case à cocher
0107:             * @param selectionExportTest parametre case à cocher
0108:             * @param fichierXml Name of the XML file
0109:             * @throws org.dom4j.DocumentException DocumentException
0110:             * @throws java.lang.Exception Lang.Exception
0111:             * @throws java.io.IOException IOException
0112:             */
0113:            public FromXmlToExcel(String fichierXml,
0114:                    boolean selectionExportExigence,
0115:                    boolean selectionExportTest,
0116:                    boolean selectionExportParametre,
0117:                    boolean selectionExportEnvironnement,
0118:                    boolean selectionExportCampagne,
0119:                    boolean selectionExportExecutionCampagne,
0120:                    boolean selectionExportAnomalies) throws DocumentException,
0121:                    Exception, IOException {
0122:
0123:                openXmlFile(fichierXml);
0124:                nomFichierXLS = createXlsFile(fichierXml);
0125:                xmlDir = nomFichierXLS.substring(0, nomFichierXLS
0126:                        .lastIndexOf(fs));
0127:
0128:                writeXLSHeading(selectionExportAnomalies);
0129:
0130:                if (selectionExportExigence == true) {
0131:                    readXMLFileRequirement(documentXml,
0132:                            selectionExportAnomalies);
0133:                }
0134:                if (selectionExportTest == true) {
0135:                    readXMLFileTest(documentXml, selectionExportAnomalies);
0136:                }
0137:
0138:                if (selectionExportParametre == true) {
0139:                    readXMLFileParametre(documentXml);
0140:                }
0141:
0142:                if (selectionExportEnvironnement == true) {
0143:                    readXMLFileEnvironnement(documentXml);
0144:                }
0145:
0146:                if (selectionExportCampagne == true) {
0147:                    readXMLFileCampagne(documentXml);
0148:                }
0149:
0150:                if (selectionExportExecutionCampagne == true) {
0151:                    readXMLFileExecutionCampagne(documentXml);
0152:                }
0153:
0154:                if (selectionExportAnomalies == true) {
0155:                    readXMLFileAnomalies(documentXml);
0156:                }
0157:
0158:                //organizeXLSfile(selectionExportExigence, selectionExportTest, selectionExportParametre, selectionExportEnvironnement, selectionExportCampagne, selectionExportExecutionCampagne, selectionExportAnomalies);
0159:                ecritEntete.organizeXLSfile(selectionExportExigence,
0160:                        selectionExportTest, selectionExportParametre,
0161:                        selectionExportEnvironnement, selectionExportCampagne,
0162:                        selectionExportExecutionCampagne,
0163:                        selectionExportAnomalies, masquageColonne);
0164:                ecritEntete.closeWorkbook(selectionExportAnomalies);
0165:            }
0166:
0167:            /**
0168:             * Function that parse Xml file to read Bugs
0169:             * @param documentXml document Xml
0170:             * @throws org.dom4j.DocumentException DocumentException
0171:             * @throws java.lang.Exception Exception
0172:             */
0173:            public void readXMLFileAnomalies(Document documentXml)
0174:                    throws DocumentException, Exception {
0175:                int numeroLigne = 1;
0176:                // doc à exporter
0177:                XPath xpathSelector0 = DocumentHelper
0178:                        .createXPath("//Defects/Defect");
0179:                XPath sortXpath = DocumentHelper.createXPath("@id");
0180:                List results0 = xpathSelector0.selectNodes(documentXml);
0181:                sortXpath.sort(results0);
0182:                for (Iterator iter0 = results0.iterator(); iter0.hasNext();) {
0183:                    Element element0 = (Element) iter0.next();
0184:                    label = new Label(ecritEntete
0185:                            .getNUMERO_COLONNE_ID_ANOMALIE(), numeroLigne,
0186:                            element0.attributeValue("id").replace("Bug_", " "),
0187:                            ecritEntete.getcelluleNormale());
0188:                    anomaliesSheet.addCell(label);
0189:                    XPath xpathSelector1 = DocumentHelper
0190:                            .createXPath("//Defects/Defect[@id='"
0191:                                    + element0.attributeValue("id")
0192:                                    + "']/MantisURL");
0193:                    List results1 = xpathSelector1.selectNodes(documentXml);
0194:                    for (Iterator iter1 = results1.iterator(); iter1.hasNext();) {
0195:                        Element element1 = (Element) iter1.next();
0196:                        Formula f = new Formula(ecritEntete
0197:                                .getNUMERO_COLONNE_URL_ANOMALIE(), numeroLigne,
0198:                                "HYPERLINK(\"" + element1.attributeValue("url")
0199:                                        + "\",\""
0200:                                        + element1.attributeValue("url")
0201:                                        + "\")", ecritEntete
0202:                                        .getcelluleNormale());
0203:                        anomaliesSheet.addCell(f);
0204:
0205:                    }
0206:                    label = new Label(ecritEntete
0207:                            .getNUMERO_COLONNE_RESUME_ANOMALIE(), numeroLigne,
0208:                            element0.attributeValue("summary"), ecritEntete
0209:                                    .getcelluleNormale());
0210:                    anomaliesSheet.addCell(label);
0211:                    XPath xpathSelector2 = DocumentHelper
0212:                            .createXPath("//Defects/Defect[@id='"
0213:                                    + element0.attributeValue("id")
0214:                                    + "']/Description");
0215:                    List results2 = xpathSelector2.selectNodes(documentXml);
0216:                    for (Iterator iter2 = results2.iterator(); iter2.hasNext();) {
0217:                        Element element2 = (Element) iter2.next();
0218:                        label = new Label(ecritEntete
0219:                                .getNUMERO_COLONNE_DESCRIPTION_ANOMALIE(),
0220:                                numeroLigne, element2.getText(), ecritEntete
0221:                                        .getcelluleNormale());
0222:                        anomaliesSheet.addCell(label);
0223:                    }
0224:                    label = new Label(ecritEntete
0225:                            .getNUMERO_COLONNE_REPORTER_ANOMALIE(),
0226:                            numeroLigne, element0.attributeValue("reporter"),
0227:                            ecritEntete.getcelluleNormale());
0228:                    anomaliesSheet.addCell(label);
0229:                    label = new Label(ecritEntete
0230:                            .getNUMERO_COLONNE_PROPRIETAIRE_ANOMALIE(),
0231:                            numeroLigne, element0.attributeValue("handler"),
0232:                            ecritEntete.getcelluleNormale());
0233:                    anomaliesSheet.addCell(label);
0234:
0235:                    numeroLigne++;
0236:
0237:                }
0238:            }
0239:
0240:            /**
0241:             * function that tries to open the XML File
0242:             * 
0243:             * @param fichierXml
0244:             *            Name of the XML File
0245:             * @throws org.dom4j.DocumentException
0246:             *             DocumentException
0247:             */
0248:            public void openXmlFile(String fichierXml) throws DocumentException {
0249:                SAXReader xmlreader = new SAXReader();
0250:                documentXml = xmlreader.read(new File(fichierXml));
0251:
0252:            }
0253:
0254:            /**
0255:             * Function that parse Xml file to read Campaigns executions
0256:             * @param documentXml document Xml
0257:             * @throws org.dom4j.DocumentException DocumentException
0258:             * @throws java.lang.Exception Exception
0259:             */
0260:            public void readXMLFileExecutionCampagne(Document documentXml)
0261:                    throws DocumentException, Exception {
0262:                int numeroLigne = 1;
0263:                // doc à exporter
0264:                XPath xpathSelector0 = DocumentHelper
0265:                        .createXPath("//CampagneTests/CampagneTest");
0266:                XPath sortXpath = DocumentHelper.createXPath("@id_camp");
0267:                List results0 = xpathSelector0.selectNodes(documentXml);
0268:                sortXpath.sort(results0);
0269:                for (Iterator iter0 = results0.iterator(); iter0.hasNext();) {
0270:                    Element element0 = (Element) iter0.next();
0271:                    XPath xpathSelector1 = DocumentHelper
0272:                            .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0273:                                    + element0.attributeValue("id_camp")
0274:                                    + "']/ExecCampTests/ExecCampTest");
0275:                    XPath sortXpath1 = DocumentHelper
0276:                            .createXPath("@id_exec_camp");
0277:                    List results1 = xpathSelector1.selectNodes(documentXml);
0278:                    sortXpath1.sort(results1);
0279:                    for (Iterator iter1 = results1.iterator(); iter1.hasNext();) {
0280:                        Element element1 = (Element) iter1.next();
0281:                        label = new Label(ecritEntete
0282:                                .getNUMERO_COLONNE_NOM_CAMPAGNEEEXECUTION(),
0283:                                numeroLigne, element0.elementText("Nom"),
0284:                                ecritEntete.getcelluleNormale());
0285:                        execCampSheet.addCell(label);
0286:                        label = new Label(
0287:                                ecritEntete
0288:                                        .getNUMERO_COLONNE_NOM_EXECUTION_CAMPAGNEEEXECUTION(),
0289:                                numeroLigne, element1.elementText("Nom"),
0290:                                ecritEntete.getcelluleNormale());
0291:                        execCampSheet.addCell(label);
0292:                        XPath xpathSelector2 = DocumentHelper
0293:                                .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0294:                                        + element0.attributeValue("id_camp")
0295:                                        + "']/ExecCampTests/ExecCampTest[@id_exec_camp='"
0296:                                        + element1
0297:                                                .attributeValue("id_exec_camp")
0298:                                        + "']/EnvironnementEx");
0299:                        List results2 = xpathSelector2.selectNodes(documentXml);
0300:                        for (Iterator iter2 = results2.iterator(); iter2
0301:                                .hasNext();) {
0302:                            Element element2 = (Element) iter2.next();
0303:                            label = new Label(
0304:                                    ecritEntete
0305:                                            .getNUMERO_COLONNE_ENVIRONNEMENT_CAMPAGNEEEXECUTION(),
0306:                                    numeroLigne, element2.elementText("Nom"),
0307:                                    ecritEntete.getcelluleNormale());
0308:                            execCampSheet.addCell(label);
0309:                        }
0310:                        XPath xpathSelector3 = DocumentHelper
0311:                                .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0312:                                        + element0.attributeValue("id_camp")
0313:                                        + "']/ExecCampTests/ExecCampTest[@id_exec_camp='"
0314:                                        + element1
0315:                                                .attributeValue("id_exec_camp")
0316:                                        + "']/JeuDonneesEx");
0317:                        List results3 = xpathSelector3.selectNodes(documentXml);
0318:                        for (Iterator iter3 = results3.iterator(); iter3
0319:                                .hasNext();) {
0320:                            Element element3 = (Element) iter3.next();
0321:                            label = new Label(
0322:                                    ecritEntete
0323:                                            .getNUMERO_COLONNE_NOM_JEU_DONNEES_CAMPAGNEEEXECUTION(),
0324:                                    numeroLigne, element3.elementText("Nom"),
0325:                                    ecritEntete.getcelluleNormale());
0326:                            execCampSheet.addCell(label);
0327:                        }
0328:                        if (results3.isEmpty()) {
0329:                            label = new Label(
0330:                                    ecritEntete
0331:                                            .getNUMERO_COLONNE_NOM_JEU_DONNEES_CAMPAGNEEEXECUTION(),
0332:                                    numeroLigne, "", ecritEntete
0333:                                            .getcelluleNormale());
0334:                            execCampSheet.addCell(label);
0335:                        }
0336:                        readURLAttachements(
0337:                                "//ExecCampTest[@id_exec_camp='"
0338:                                        + element1
0339:                                                .attributeValue("id_exec_camp")
0340:                                        + "']/Attachements/UrlAttachement",
0341:                                ecritEntete
0342:                                        .getNUMERO_COLONNE_LIEN_HYPERTEXTE_CAMPAGNEEEXECUTION(),
0343:                                numeroLigne, execCampSheet);
0344:                        readFileAttachements(
0345:                                "//ExecCampTest[@id_exec_camp='"
0346:                                        + element1
0347:                                                .attributeValue("id_exec_camp")
0348:                                        + "']/Attachements/FileAttachement",
0349:                                ecritEntete
0350:                                        .getNUMERO_COLONNE_PIECE_JOINTE_CAMPAGNEEEXECUTION(),
0351:                                numeroLigne, execCampSheet);
0352:
0353:                        label = new Label(
0354:                                ecritEntete
0355:                                        .getNUMERO_COLONNE_RESULTAT_EXECUTION_CAMPAGNEEEXECUTION(),
0356:                                numeroLigne, element1.attributeValue("statut"),
0357:                                ecritEntete.getcelluleNormale());
0358:                        execCampSheet.addCell(label);
0359:
0360:                        XPath xpathSelector4 = DocumentHelper
0361:                                .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0362:                                        + element0.attributeValue("id_camp")
0363:                                        + "']/ExecCampTests/ExecCampTest[@id_exec_camp='"
0364:                                        + element1
0365:                                                .attributeValue("id_exec_camp")
0366:                                        + "']/JeuDonneesEx");
0367:                        List results4 = xpathSelector4.selectNodes(documentXml);
0368:                        for (Iterator iter4 = results4.iterator(); iter4
0369:                                .hasNext();) {
0370:                            Element element4 = (Element) iter4.next();
0371:                            label = new Label(
0372:                                    ecritEntete
0373:                                            .getNUMERO_COLONNE_NOM_JEU_DONNEES_CAMPAGNEEEXECUTION(),
0374:                                    numeroLigne, element4.elementText("Nom"),
0375:                                    ecritEntete.getcelluleNormale());
0376:                            execCampSheet.addCell(label);
0377:                        }
0378:
0379:                        //A completer pour les résultats d'execution
0380:                        int numeroligneExecution = numeroLigne;
0381:                        String testprecedent = "";
0382:                        XPath xpathSelector5 = DocumentHelper
0383:                                .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0384:                                        + element0.attributeValue("id_camp")
0385:                                        + "']/ExecCampTests/ExecCampTest[@id_exec_camp='"
0386:                                        + element1
0387:                                                .attributeValue("id_exec_camp")
0388:                                        + "']/ResulExecCampTests/ResulExecCampTest");
0389:                        List results5 = xpathSelector5.selectNodes(documentXml);
0390:                        for (Iterator iter5 = results5.iterator(); iter5
0391:                                .hasNext();) {
0392:                            Element element5 = (Element) iter5.next();
0393:                            label = new Label(
0394:                                    ecritEntete
0395:                                            .getNUMERO_COLONNE_NOM_RESULTAT_EXECUTION_CAMPAGNEEEXECUTION(),
0396:                                    numeroligneExecution, element5
0397:                                            .elementText("Nom"), ecritEntete
0398:                                            .getcelluleNormale());
0399:                            execCampSheet.addCell(label);
0400:                            label = new Label(
0401:                                    ecritEntete
0402:                                            .getNUMERO_COLONNE_RESULTAT_EXECUTION_CAMPAGNEEEXECUTION(),
0403:                                    numeroligneExecution, element5
0404:                                            .attributeValue("statut"),
0405:                                    ecritEntete.getcelluleNormale());
0406:                            execCampSheet.addCell(label);
0407:                            XPath xpathSelector6 = DocumentHelper
0408:                                    .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0409:                                            + element0
0410:                                                    .attributeValue("id_camp")
0411:                                            + "']/ExecCampTests/ExecCampTest[@id_exec_camp='"
0412:                                            + element1
0413:                                                    .attributeValue("id_exec_camp")
0414:                                            + "']/ResulExecCampTests/ResulExecCampTest[@id_exec_res='"
0415:                                            + element5
0416:                                                    .attributeValue("id_exec_res")
0417:                                            + "']/ResulActionTests/ResulActionTest");
0418:                            List results6 = xpathSelector6
0419:                                    .selectNodes(documentXml);
0420:                            for (Iterator iter6 = results6.iterator(); iter6
0421:                                    .hasNext();) {
0422:                                Element element6 = (Element) iter6.next();
0423:                                XPath xpathSelector7 = DocumentHelper
0424:                                        .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0425:                                                + element0
0426:                                                        .attributeValue("id_camp")
0427:                                                + "']/ExecCampTests/ExecCampTest[@id_exec_camp='"
0428:                                                + element1
0429:                                                        .attributeValue("id_exec_camp")
0430:                                                + "']/ResulExecCampTests/ResulExecCampTest[@id_exec_res='"
0431:                                                + element5
0432:                                                        .attributeValue("id_exec_res")
0433:                                                + "']/ResulActionTests/ResulActionTest[@refAction='"
0434:                                                + element6
0435:                                                        .attributeValue("refAction")
0436:                                                + "']/RefAction");
0437:                                List results7 = xpathSelector7
0438:                                        .selectNodes(documentXml);
0439:                                for (Iterator iter7 = results7.iterator(); iter7
0440:                                        .hasNext();) {
0441:                                    Element element7 = (Element) iter7.next();
0442:                                    String test = element7
0443:                                            .elementText("NomFamille")
0444:                                            + "_"
0445:                                            + element7.elementText("NomSuite")
0446:                                            + "_"
0447:                                            + element7.elementText("NomTest");
0448:                                    if (!testprecedent.equals(test)) {
0449:                                        label = new Label(
0450:                                                ecritEntete
0451:                                                        .getNUMERO_COLONNE_FAMILLE_TEST_CAMPAGNEEEXECUTION(),
0452:                                                numeroligneExecution,
0453:                                                element7
0454:                                                        .elementText("NomFamille"),
0455:                                                ecritEntete.getcelluleNormale());
0456:                                        execCampSheet.addCell(label);
0457:                                        label = new Label(
0458:                                                ecritEntete
0459:                                                        .getNUMERO_COLONNE_SUITE_TEST_CAMPAGNEEEXECUTION(),
0460:                                                numeroligneExecution,
0461:                                                element7
0462:                                                        .elementText("NomSuite"),
0463:                                                ecritEntete.getcelluleNormale());
0464:                                        execCampSheet.addCell(label);
0465:                                        label = new Label(
0466:                                                ecritEntete
0467:                                                        .getNUMERO_COLONNE_NOM_TEST_CAMPAGNEEEXECUTION(),
0468:                                                numeroligneExecution,
0469:                                                element7.elementText("NomTest"),
0470:                                                ecritEntete.getcelluleNormale());
0471:                                        execCampSheet.addCell(label);
0472:                                        XPath xpathSelector8 = DocumentHelper
0473:                                                .createXPath("//Familles/Famille/SuiteTests/SuiteTest/Tests/Test/TestManuel/ActionTest[@id_action='"
0474:                                                        + element6
0475:                                                                .attributeValue("refAction")
0476:                                                        + "']");
0477:                                        List results8 = xpathSelector8
0478:                                                .selectNodes(documentXml);
0479:                                        for (Iterator iter8 = results8
0480:                                                .iterator(); iter8.hasNext();) {
0481:                                            Element element8 = (Element) iter8
0482:                                                    .next();
0483:                                            XPath xpathSelector9 = DocumentHelper
0484:                                                    .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0485:                                                            + element0
0486:                                                                    .attributeValue("id_camp")
0487:                                                            + "']/ExecCampTests/ExecCampTest[@id_exec_camp='"
0488:                                                            + element1
0489:                                                                    .attributeValue("id_exec_camp")
0490:                                                            + "']/ResulExecCampTests/ResulExecCampTest[@id_exec_res='"
0491:                                                            + element5
0492:                                                                    .attributeValue("id_exec_res")
0493:                                                            + "']/ResulExecs/ResulExec[@refTest='"
0494:                                                            + element8
0495:                                                                    .getParent()
0496:                                                                    .getParent()
0497:                                                                    .attributeValue(
0498:                                                                            "id_test")
0499:                                                            + "']");
0500:                                            List results9 = xpathSelector9
0501:                                                    .selectNodes(documentXml);
0502:                                            for (Iterator iter9 = results9
0503:                                                    .iterator(); iter9
0504:                                                    .hasNext();) {
0505:                                                Element element9 = (Element) iter9
0506:                                                        .next();
0507:                                                label = new Label(
0508:                                                        ecritEntete
0509:                                                                .getNUMERO_COLONNE_RESULTAT_EXECUTION_TEST_CAMPAGNEEEXECUTION(),
0510:                                                        numeroligneExecution,
0511:                                                        element9
0512:                                                                .attributeValue("res"),
0513:                                                        ecritEntete
0514:                                                                .getcelluleNormale());
0515:                                                execCampSheet.addCell(label);
0516:                                            }
0517:                                        }
0518:                                        testprecedent = element7
0519:                                                .elementText("NomFamille")
0520:                                                + "_"
0521:                                                + element7
0522:                                                        .elementText("NomSuite")
0523:                                                + "_"
0524:                                                + element7
0525:                                                        .elementText("NomTest");
0526:                                    }
0527:                                    label = new Label(
0528:                                            ecritEntete
0529:                                                    .getNUMERO_COLONNE_RESULTAT_ACTION_TEST_CAMPAGNEEEXECUTION(),
0530:                                            numeroligneExecution, element6
0531:                                                    .attributeValue("res"),
0532:                                            ecritEntete.getcelluleNormale());
0533:                                    execCampSheet.addCell(label);
0534:                                    label = new Label(
0535:                                            ecritEntete
0536:                                                    .getNUMERO_COLONNE_NUMERO_ACTION_TEST_CAMPAGNEEEXECUTION(),
0537:                                            numeroligneExecution, element7
0538:                                                    .elementText("NomAction"),
0539:                                            ecritEntete.getcelluleNormale());
0540:                                    execCampSheet.addCell(label);
0541:                                    label = new Label(
0542:                                            ecritEntete
0543:                                                    .getNUMERO_COLONNE_RESULTAT_OBTENU_CAMPAGNEEEXECUTION(),
0544:                                            numeroligneExecution,
0545:                                            element6
0546:                                                    .elementText("ResulEffectif"),
0547:                                            ecritEntete.getcelluleNormale());
0548:                                    execCampSheet.addCell(label);
0549:
0550:                                }
0551:
0552:                                numeroligneExecution++;
0553:                            }
0554:
0555:                            if (numeroligneExecution > numeroLigne) {
0556:                                numeroLigne = numeroligneExecution;
0557:                            } else {
0558:                                numeroLigne++;
0559:                            }
0560:                        }
0561:
0562:                    }
0563:                }
0564:            }
0565:
0566:            /**
0567:             * Function that parse Xml file to read campaigns
0568:             * @param documentXml document Xml
0569:             * @throws org.dom4j.DocumentException DocumentException
0570:             * @throws java.lang.Exception Exception
0571:             */
0572:            public void readXMLFileCampagne(Document documentXml)
0573:                    throws DocumentException, Exception {
0574:                int numeroLigne = 1;
0575:                // doc à exporter
0576:                XPath xpathSelector0 = DocumentHelper
0577:                        .createXPath("//CampagneTests/CampagneTest");
0578:                XPath sortXpath = DocumentHelper.createXPath("@id_camp");
0579:                List results0 = xpathSelector0.selectNodes(documentXml);
0580:                sortXpath.sort(results0);
0581:
0582:                for (Iterator iter0 = results0.iterator(); iter0.hasNext();) {
0583:                    Element element0 = (Element) iter0.next();
0584:                    //ecrit le nom du parametre
0585:                    label = new Label(ecritEntete
0586:                            .getNUMERO_COLONNE_NOM_CAMPAGNE(), numeroLigne,
0587:                            element0.elementText("Nom"), ecritEntete
0588:                                    .getcelluleNormale());
0589:                    campagneSheet.addCell(label);
0590:                    XPath xpathSelector5 = DocumentHelper
0591:                            .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0592:                                    + element0.attributeValue("id_camp")
0593:                                    + "']/Description");
0594:                    List results5 = xpathSelector5.selectNodes(documentXml);
0595:                    for (Iterator iter5 = results5.iterator(); iter5.hasNext();) {
0596:                        Element element5 = (Element) iter5.next();
0597:                        label = new Label(ecritEntete
0598:                                .getNUMERO_COLONNE_DESCRIPTION_CAMPAGNE(),
0599:                                numeroLigne,
0600:                                EnleveBalisesHTML(element5.asXML()),
0601:                                ecritEntete.getcelluleNormale());
0602:                        campagneSheet.addCell(label);
0603:                    }
0604:                    if (results5.isEmpty()) {
0605:                        label = new Label(ecritEntete
0606:                                .getNUMERO_COLONNE_DESCRIPTION_CAMPAGNE(),
0607:                                numeroLigne, "", ecritEntete
0608:                                        .getcelluleDescritpion());
0609:                        campagneSheet.addCell(label);
0610:                    }
0611:
0612:                    readURLAttachements("//CampagneTest[@id_camp='"
0613:                            + element0.attributeValue("id_camp")
0614:                            + "']/Attachements/UrlAttachement", ecritEntete
0615:                            .getNUMERO_COLONNE_LIEN_HYPERTEXTE_CAMPAGNE(),
0616:                            numeroLigne, campagneSheet);
0617:                    readFileAttachements("//CampagneTest[@id_camp='"
0618:                            + element0.attributeValue("id_camp")
0619:                            + "']/Attachements/FileAttachement", ecritEntete
0620:                            .getNUMERO_COLONNE_PIECE_JOINTE_CAMPAGNE(),
0621:                            numeroLigne, campagneSheet);
0622:
0623:                    XPath xpathSelector1 = DocumentHelper
0624:                            .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0625:                                    + element0.attributeValue("id_camp")
0626:                                    + "']/JeuxDonnees/JeuDonnees");
0627:                    XPath sortXpath1 = DocumentHelper.createXPath("@id_jeu");
0628:                    List results1 = xpathSelector1.selectNodes(documentXml);
0629:                    sortXpath1.sort(results1);
0630:                    int numeroLigneJeuDeDonnees = numeroLigne;
0631:                    for (Iterator iter1 = results1.iterator(); iter1.hasNext();) {
0632:                        Element element1 = (Element) iter1.next();
0633:                        label = new Label(ecritEntete
0634:                                .getNUMERO_COLONNE_NOM_JEU_DONNEES_CAMPAGNE(),
0635:                                numeroLigneJeuDeDonnees, element1
0636:                                        .elementText("Nom"), ecritEntete
0637:                                        .getcelluleNormale());
0638:                        campagneSheet.addCell(label);
0639:                        label = new Label(
0640:                                ecritEntete
0641:                                        .getNUMERO_COLONNE_DESCRIPTION_JEU_DONNEES_CAMPAGNE(),
0642:                                numeroLigneJeuDeDonnees, element1
0643:                                        .elementText("Description"),
0644:                                ecritEntete.getcelluleNormale());
0645:                        campagneSheet.addCell(label);
0646:                        numeroLigneJeuDeDonnees++;
0647:                    }
0648:                    XPath xpathSelector2 = DocumentHelper
0649:                            .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0650:                                    + element0.attributeValue("id_camp")
0651:                                    + "']/FamillesCamp/FamilleRef");
0652:                    XPath sortXpath2 = DocumentHelper.createXPath("@ref");
0653:                    List results2 = xpathSelector2.selectNodes(documentXml);
0654:                    sortXpath2.sort(results2);
0655:                    int numeroLigneCasTest = numeroLigne;
0656:                    for (Iterator iter2 = results2.iterator(); iter2.hasNext();) {
0657:                        Element element2 = (Element) iter2.next();
0658:                        XPath xpathSelector3 = DocumentHelper
0659:                                .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0660:                                        + element0.attributeValue("id_camp")
0661:                                        + "']/FamillesCamp/FamilleRef[@ref='"
0662:                                        + element2.attributeValue("ref")
0663:                                        + "']/SuiteTestsCamp/SuiteTestRef");
0664:                        XPath sortXpath3 = DocumentHelper.createXPath("@ref");
0665:                        List results3 = xpathSelector3.selectNodes(documentXml);
0666:                        sortXpath3.sort(results3);
0667:                        for (Iterator iter3 = results3.iterator(); iter3
0668:                                .hasNext();) {
0669:                            Element element3 = (Element) iter3.next();
0670:                            XPath xpathSelector4 = DocumentHelper
0671:                                    .createXPath("//CampagneTests/CampagneTest[@id_camp='"
0672:                                            + element0
0673:                                                    .attributeValue("id_camp")
0674:                                            + "']/FamillesCamp/FamilleRef[@ref='"
0675:                                            + element2.attributeValue("ref")
0676:                                            + "']/SuiteTestsCamp/SuiteTestRef[@ref='"
0677:                                            + element3.attributeValue("ref")
0678:                                            + "']/TestsCamp/TestRef");
0679:                            XPath sortXpath4 = DocumentHelper
0680:                                    .createXPath("@ref");
0681:                            List results4 = xpathSelector4
0682:                                    .selectNodes(documentXml);
0683:                            sortXpath4.sort(results4);
0684:                            for (Iterator iter4 = results4.iterator(); iter4
0685:                                    .hasNext();) {
0686:                                Element element4 = (Element) iter4.next();
0687:                                label = new Label(
0688:                                        ecritEntete
0689:                                                .getNUMERO_COLONNE_FAMILLE_TEST_CAMPAGNE(),
0690:                                        numeroLigneCasTest, element2
0691:                                                .elementText("Nom"),
0692:                                        ecritEntete.getcelluleNormale());
0693:                                campagneSheet.addCell(label);
0694:                                label = new Label(
0695:                                        ecritEntete
0696:                                                .getNUMERO_COLONNE_SUITE_TEST_CAMPAGNE(),
0697:                                        numeroLigneCasTest, element3
0698:                                                .elementText("Nom"),
0699:                                        ecritEntete.getcelluleNormale());
0700:                                campagneSheet.addCell(label);
0701:                                label = new Label(ecritEntete
0702:                                        .getNUMERO_COLONNE_NOM_TEST_CAMPAGNE(),
0703:                                        numeroLigneCasTest, element4
0704:                                                .elementText("Nom"),
0705:                                        ecritEntete.getcelluleNormale());
0706:                                campagneSheet.addCell(label);
0707:                                numeroLigneCasTest++;
0708:                            }
0709:                        }
0710:                    }
0711:
0712:                    if (numeroLigneJeuDeDonnees > numeroLigneCasTest) {
0713:                        numeroLigne = numeroLigneJeuDeDonnees;
0714:                    } else {
0715:                        numeroLigne = numeroLigneCasTest;
0716:                    }
0717:                }
0718:            }
0719:
0720:            /**
0721:             * Function that read file attachements for all spreadsheets
0722:             * @param pathXML Xml directory path
0723:             * @param colonneURL Column number to read
0724:             * @param numeroLigne line number to read
0725:             * @param feuilleExcel Excel Spreadsheet to read
0726:             * @throws jxl.write.biff.RowsExceededException Excel Exception
0727:             * @throws jxl.write.WriteException Write Exception
0728:             */
0729:            public void readFileAttachements(String pathXML, int colonneURL,
0730:                    int numeroLigne, WritableSheet feuilleExcel)
0731:                    throws RowsExceededException, WriteException {
0732:
0733:                // Lit FileAttachements
0734:                XPath xpathSelectorFile = DocumentHelper.createXPath(pathXML);
0735:                List resultsFile = xpathSelectorFile.selectNodes(documentXml);
0736:                String DifferentPJ = null;
0737:                if (resultsFile.size() == 1) {
0738:                    Iterator iterFile = resultsFile.iterator();
0739:                    Element elementFile = (Element) iterFile.next();
0740:                    DifferentPJ = "file:///" + xmlDir + fs
0741:                            + elementFile.attributeValue("dir");
0742:                    try {
0743:                        Formula f = new Formula(colonneURL, numeroLigne,
0744:                                "HYPERLINK(\"" + DifferentPJ + "\",\""
0745:                                        + DifferentPJ + "\")", ecritEntete
0746:                                        .getcelluleNormale());
0747:                        feuilleExcel.addCell(f);
0748:                    } catch (Exception fe) {
0749:                        isErreurEcritureXLS = setErreurEcritureXLS();
0750:                    }
0751:                } else if (resultsFile.isEmpty()) {
0752:                    label = new Label(colonneURL, numeroLigne, null,
0753:                            ecritEntete.getcelluleNormale());
0754:                    feuilleExcel.addCell(label);
0755:                } else {
0756:                    for (Iterator iterFile = resultsFile.iterator(); iterFile
0757:                            .hasNext();) {
0758:                        Element elementFile = (Element) iterFile.next();
0759:                        // Ecrit URL
0760:                        if (DifferentPJ == null) {
0761:                            DifferentPJ = xmlDir + fs
0762:                                    + elementFile.attributeValue("dir");
0763:                        } else {
0764:                            DifferentPJ = DifferentPJ + "\n" + xmlDir + fs
0765:                                    + elementFile.attributeValue("dir");
0766:                        }
0767:
0768:                        label = new Label(colonneURL, numeroLigne, DifferentPJ,
0769:                                ecritEntete.getcelluleNormale());
0770:                        feuilleExcel.addCell(label);
0771:                    }
0772:
0773:                }
0774:            }
0775:
0776:            /**
0777:             * Function that read URL attachements for all spreadsheets
0778:             * @param pathXML Xml directory path
0779:             * @param colonneURL Column number to read
0780:             * @param numeroLigne line number to read
0781:             * @param feuilleExcel Excel Spreadsheet to read
0782:             * @throws jxl.write.biff.RowsExceededException Excel Exception
0783:             * @throws jxl.write.WriteException Write Exception
0784:             */
0785:            public void readURLAttachements(String pathXML, int colonneURL,
0786:                    int numeroLigne, WritableSheet feuilleExcel)
0787:                    throws RowsExceededException, WriteException {
0788:                // Lit URLAttachements
0789:                XPath xpathSelectorURL = DocumentHelper.createXPath(pathXML);
0790:                List resultsURL = xpathSelectorURL.selectNodes(documentXml);
0791:                String DifferentURL = null;
0792:
0793:                if (resultsURL.size() == 1) {
0794:                    Iterator iterURL = resultsURL.iterator();
0795:                    Element elementURL = (Element) iterURL.next();
0796:                    try {
0797:                        Formula f = new Formula(colonneURL, numeroLigne,
0798:                                "HYPERLINK(\""
0799:                                        + elementURL.attributeValue("url")
0800:                                        + "\",\""
0801:                                        + elementURL.attributeValue("url")
0802:                                        + "\")", ecritEntete
0803:                                        .getcelluleNormale());
0804:                        feuilleExcel.addCell(f);
0805:                    } catch (Exception fe) {
0806:                        isErreurEcritureXLS = setErreurEcritureXLS();
0807:                    }
0808:                } else if (resultsURL.isEmpty()) {
0809:                    label = new Label(colonneURL, numeroLigne, null,
0810:                            ecritEntete.getcelluleNormale());
0811:                    feuilleExcel.addCell(label);
0812:                } else {
0813:                    for (Iterator iterURL = resultsURL.iterator(); iterURL
0814:                            .hasNext();) {
0815:                        Element elementURL = (Element) iterURL.next();
0816:                        // Ecrit URL
0817:                        if (DifferentURL == null) {
0818:                            DifferentURL = elementURL.attributeValue("url");
0819:                        } else {
0820:                            DifferentURL = DifferentURL + "\n"
0821:                                    + elementURL.attributeValue("url");
0822:                        }
0823:                        label = new Label(colonneURL, numeroLigne,
0824:                                DifferentURL, ecritEntete.getcelluleNormale());
0825:                        feuilleExcel.addCell(label);
0826:                    }
0827:
0828:                }
0829:            }
0830:
0831:            /**
0832:             * Function that parse Xml file to read environnements
0833:             * 
0834:             * @param documentXml
0835:             *            document Xml
0836:             * @throws org.dom4j.DocumentException
0837:             *             DocumentException
0838:             * @throws java.lang.Exception
0839:             *             Exception
0840:             */
0841:            public void readXMLFileEnvironnement(Document documentXml)
0842:                    throws DocumentException, Exception {
0843:                int numeroLigne = 1;
0844:                // doc à exporter
0845:                XPath xpathSelector0 = DocumentHelper
0846:                        .createXPath("//Environnements/Environnement");
0847:                XPath sortXpath = DocumentHelper.createXPath("@idEnv");
0848:                List results0 = xpathSelector0.selectNodes(documentXml);
0849:                sortXpath.sort(results0);
0850:
0851:                for (Iterator iter0 = results0.iterator(); iter0.hasNext();) {
0852:                    Element element0 = (Element) iter0.next();
0853:                    //ecrit le nom du parametre
0854:                    label = new Label(ecritEntete
0855:                            .getNUMERO_COLONNE_NOM_ENVIRONNEMENT(),
0856:                            numeroLigne, element0.elementText("Nom"),
0857:                            ecritEntete.getcelluleNormale());
0858:                    enviroSheet.addCell(label);
0859:
0860:                    // Lit description
0861:                    String DescriptionEnvironnement = "";
0862:                    XPath xpathSelector1 = DocumentHelper
0863:                            .createXPath("//Environnement[@idEnv='"
0864:                                    + element0.attributeValue("idEnv")
0865:                                    + "']/Description");
0866:                    List results1 = xpathSelector1.selectNodes(documentXml);
0867:                    for (Iterator iter1 = results1.iterator(); iter1.hasNext();) {
0868:                        Element element1 = (Element) iter1.next();
0869:                        DescriptionEnvironnement = element1.getText();
0870:                    }
0871:                    label = new Label(ecritEntete
0872:                            .getNUMERO_COLONNE_DESCRIPTION_ENVIRONNEMENT(),
0873:                            numeroLigne, DescriptionEnvironnement, ecritEntete
0874:                                    .getcelluleNormale());
0875:                    enviroSheet.addCell(label);
0876:
0877:                    //Lit les parametres
0878:                    int numeroLigneParemetreParEnvironnement = 0;
0879:                    XPath xpathSelector2 = DocumentHelper
0880:                            .createXPath("//Environnement[@idEnv='"
0881:                                    + element0.attributeValue("idEnv")
0882:                                    + "']/ValeurParams/ValeurParam");
0883:                    XPath sortXpath2 = DocumentHelper.createXPath("@ref");
0884:                    List results2 = xpathSelector2.selectNodes(documentXml);
0885:                    sortXpath2.sort(results2);
0886:                    for (Iterator iter2 = results2.iterator(); iter2.hasNext();) {
0887:                        Element element2 = (Element) iter2.next();
0888:                        label = new Label(
0889:                                ecritEntete
0890:                                        .getNUMERO_COLONNE_NOM_PARAMETRE_ENVIRONNEMENT(),
0891:                                numeroLigne
0892:                                        + numeroLigneParemetreParEnvironnement,
0893:                                element2.elementText("Nom"), ecritEntete
0894:                                        .getcelluleNormale());
0895:                        enviroSheet.addCell(label);
0896:                        try {
0897:                            int testNombre = Integer.parseInt(element2
0898:                                    .attributeValue("valeur"));
0899:                            nombre = new Number(
0900:                                    ecritEntete
0901:                                            .getNUMERO_COLONNE_VALEUR_PARAMETRE_ENVIRONNEMENT(),
0902:                                    numeroLigne
0903:                                            + numeroLigneParemetreParEnvironnement,
0904:                                    testNombre, ecritEntete
0905:                                            .getcelluleNormaleNombre());
0906:                            enviroSheet.addCell(nombre);
0907:                        } catch (NumberFormatException nfe) {
0908:                            label = new Label(
0909:                                    ecritEntete
0910:                                            .getNUMERO_COLONNE_VALEUR_PARAMETRE_ENVIRONNEMENT(),
0911:                                    numeroLigne
0912:                                            + numeroLigneParemetreParEnvironnement,
0913:                                    element2.attributeValue("valeur"),
0914:                                    ecritEntete.getcelluleNormale());
0915:                            enviroSheet.addCell(label);
0916:                        }
0917:                        numeroLigneParemetreParEnvironnement++;
0918:                    }
0919:                    readURLAttachements("//Environnement[@idEnv='"
0920:                            + element0.attributeValue("idEnv")
0921:                            + "']/Attachements/UrlAttachement", ecritEntete
0922:                            .getNUMERO_COLONNE_LIEN_HYPERTEXTE_ENVIRONNEMENT(),
0923:                            numeroLigne, enviroSheet);
0924:                    readFileAttachements("//Environnement[@idEnv='"
0925:                            + element0.attributeValue("idEnv")
0926:                            + "']/Attachements/FileAttachement", ecritEntete
0927:                            .getNUMERO_COLONNE_PIECE_JOINTE_ENVIRONNEMENT(),
0928:                            numeroLigne, enviroSheet);
0929:
0930:                    if (numeroLigneParemetreParEnvironnement == 0) {
0931:                        label = new Label(
0932:                                ecritEntete
0933:                                        .getNUMERO_COLONNE_NOM_PARAMETRE_ENVIRONNEMENT(),
0934:                                numeroLigne
0935:                                        + numeroLigneParemetreParEnvironnement,
0936:                                "", ecritEntete.getcelluleNormale());
0937:                        enviroSheet.addCell(label);
0938:                        label = new Label(
0939:                                ecritEntete
0940:                                        .getNUMERO_COLONNE_VALEUR_PARAMETRE_ENVIRONNEMENT(),
0941:                                numeroLigne
0942:                                        + numeroLigneParemetreParEnvironnement,
0943:                                "", ecritEntete.getcelluleNormale());
0944:                        enviroSheet.addCell(label);
0945:                        numeroLigne++;
0946:                    } else {
0947:                        numeroLigne = numeroLigne
0948:                                + numeroLigneParemetreParEnvironnement;
0949:                    }
0950:
0951:                }
0952:
0953:            }
0954:
0955:            /**
0956:             * Function that parse Xml file to read parameters
0957:             * 
0958:             * @param documentXml
0959:             *            document Xml
0960:             * @throws org.dom4j.DocumentException
0961:             *             DocumentException
0962:             * @throws java.lang.Exception
0963:             *             Exception
0964:             */
0965:            public void readXMLFileParametre(Document documentXml)
0966:                    throws DocumentException, Exception {
0967:                int numeroLigne = 1;
0968:                // doc à exporter
0969:                XPath xpathSelector0 = DocumentHelper
0970:                        .createXPath("//Params/Param");
0971:                XPath sortXpath = DocumentHelper.createXPath("@id_param");
0972:                List results0 = xpathSelector0.selectNodes(documentXml);
0973:                sortXpath.sort(results0);
0974:
0975:                for (Iterator iter0 = results0.iterator(); iter0.hasNext();) {
0976:                    Element element0 = (Element) iter0.next();
0977:                    //ecrit le nom du parametre
0978:                    label = new Label(ecritEntete
0979:                            .getNUMERO_COLONNE_NOM_PARAMETRE(), numeroLigne,
0980:                            element0.elementText("Nom"), ecritEntete
0981:                                    .getcelluleNormale());
0982:                    paramSheet.addCell(label);
0983:                    label = new Label(ecritEntete
0984:                            .getNUMERO_COLONNE_DESCRIPTION_PARAMETRE(),
0985:                            numeroLigne, element0.elementText("Description"),
0986:                            ecritEntete.getcelluleNormale());
0987:                    paramSheet.addCell(label);
0988:                    numeroLigne++;
0989:                }
0990:            }
0991:
0992:            /**
0993:             * Function that parse Xml file to read tests
0994:             * @param selectionExportAnomalies Veryfy bug spreadsheet presence
0995:             * @param selectionExportExigence parametre case à cocher
0996:             * @param documentXml document Xml
0997:             * @throws org.dom4j.DocumentException DocumentException
0998:             * @throws java.lang.Exception Exception
0999:             */
1000:            public void readXMLFileTest(Document documentXml,
1001:                    boolean selectionExportAnomalies) throws DocumentException,
1002:                    Exception {
1003:
1004:                int numeroLigne = 1;
1005:                XPath xpathSelector = DocumentHelper
1006:                        .createXPath("//Familles/Famille/SuiteTests/SuiteTest/Tests/Test");
1007:                List results = xpathSelector.selectNodes(documentXml);
1008:                for (Iterator iter = results.iterator(); iter.hasNext();) {
1009:                    Element element = (Element) iter.next();
1010:
1011:                    numeroColonneSheetExigence = ecritEntete
1012:                            .getDIFFERENCE_COLONNE_TEST_EXIGENCE_ASSOCIEE()
1013:                            + ecritEntete.getNumeroColonneFeuilleExigence();
1014:                    numeroColonneSheetBranche = ecritEntete
1015:                            .getDIFFERENCE_COLONNE_TEST_EXIGENCE_ASSOCIEE();
1016:
1017:                    // ecrit le nom du cas test
1018:                    label = new Label(ecritEntete
1019:                            .getDIFFERENCE_COLONNE_CAS_DE_TESTS(), numeroLigne,
1020:                            element.elementText("Nom"), ecritEntete
1021:                                    .getcelulleCentreeHetV());
1022:                    testSheet.addCell(label);
1023:
1024:                    numeroColonne = 0;
1025:
1026:                    // Recupere la famille du test
1027:                    Element element2 = element.getParent().getParent()
1028:                            .getParent().getParent();
1029:                    // ecrit la famille
1030:                    label = new Label(numeroColonne, numeroLigne, element2
1031:                            .elementText("Nom"), ecritEntete
1032:                            .getcelulleCentreeHetV());
1033:                    testSheet.addCell(label);
1034:                    numeroColonne++;
1035:
1036:                    // Recupere la suite du test
1037:                    Element elementSuite = element.getParent().getParent();
1038:                    // ecrit la suite
1039:                    label = new Label(numeroColonne, numeroLigne, elementSuite
1040:                            .elementText("Nom"), ecritEntete
1041:                            .getcelulleCentreeHetV());
1042:                    testSheet.addCell(label);
1043:                    numeroColonne++;
1044:
1045:                    nombreExigenceParCasDeTests = 0;
1046:
1047:                    XPath xpathSelector3 = DocumentHelper
1048:                            .createXPath("//Familles/Famille[Nom="
1049:                                    + removeSpecialCharacters(element2
1050:                                            .elementText("Nom"))
1051:                                    + "]/SuiteTests/SuiteTest[Nom="
1052:                                    + removeSpecialCharacters(elementSuite
1053:                                            .elementText("Nom"))
1054:                                    + "]/Tests/Test[@id_test='"
1055:                                    + element.attributeValue("id_test")
1056:                                    + "']/LinkRequirement/RequirementRef/Nom");
1057:                    List results3 = xpathSelector3.selectNodes(documentXml);
1058:                    if (!results3.isEmpty()) {
1059:                        for (Iterator iter3 = results3.iterator(); iter3
1060:                                .hasNext();) {
1061:                            Element element3 = (Element) iter3.next();
1062:
1063:                            XPath xpathSelector35 = DocumentHelper
1064:                                    .createXPath("//Requirement[@id_req='"
1065:                                            + element3.getParent()
1066:                                                    .attributeValue("ref")
1067:                                            + "']/Nom");
1068:                            List results35 = xpathSelector35
1069:                                    .selectNodes(documentXml);
1070:                            for (Iterator iter35 = results35.iterator(); iter35
1071:                                    .hasNext();) {
1072:                                Element element35 = (Element) iter35.next();
1073:
1074:                                // ecrit une exigence
1075:                                numeroColonne = numeroColonneSheetTest
1076:                                        + numeroColonneSheetBranche;
1077:
1078:                                themeValue = "";
1079:                                Element elementTemp = element35.getParent();
1080:                                if (elementTemp.getParent().getName() != "Requirements") {
1081:                                    themeValue = elementTemp.getParent()
1082:                                            .element("Nom").getText();
1083:                                    while (!elementTemp.getParent()
1084:                                            .attributeValue("id_req_parent")
1085:                                            .equals("Req_0")) {
1086:                                        themeValue = elementTemp.getParent()
1087:                                                .getParent().element("Nom")
1088:                                                .getText()
1089:                                                + Language.getInstance()
1090:                                                        .getText("_")
1091:                                                + themeValue;
1092:                                        elementTemp = elementTemp.getParent();
1093:                                    }
1094:                                }
1095:
1096:                                StringTokenizer stv = new StringTokenizer(
1097:                                        themeValue, Language.getInstance()
1098:                                                .getText("_"));
1099:                                while (stv.hasMoreTokens()) {
1100:                                    label = new Label(
1101:                                            numeroColonne,
1102:                                            numeroLigne
1103:                                                    + nombreExigenceParCasDeTests,
1104:                                            stv.nextToken(), ecritEntete
1105:                                                    .getcelluleNormale());
1106:                                    testSheet.addCell(label);
1107:                                    numeroColonne++;
1108:                                }
1109:
1110:                                StringTokenizer st = new StringTokenizer(
1111:                                        element35.getText(), Language
1112:                                                .getInstance().getText("_"));
1113:
1114:                                while (st.hasMoreTokens()) {
1115:                                    // Pour ecrire l'exigence dans la colonne Exigence;
1116:                                    if (st.countTokens() == 1) {
1117:                                        // Pour encadrer les celules vides des sous themes
1118:                                        // d'exigenxes
1119:                                        while (numeroColonne < numeroColonneSheetExigence) {
1120:                                            label = new Label(
1121:                                                    numeroColonne,
1122:                                                    numeroLigne
1123:                                                            + nombreExigenceParCasDeTests,
1124:                                                    "",
1125:                                                    ecritEntete
1126:                                                            .getcelluleNormale());
1127:                                            testSheet.addCell(label);
1128:                                            numeroColonne++;
1129:                                        }
1130:                                    }
1131:                                    String exigence = st.nextToken();
1132:                                    // exigence.replaceAll("\'","\\'");
1133:                                    label = new Label(
1134:                                            numeroColonneSheetTest
1135:                                                    + numeroColonneSheetExigence,
1136:                                            numeroLigne
1137:                                                    + nombreExigenceParCasDeTests,
1138:                                            exigence, ecritEntete
1139:                                                    .getcelluleNormale());
1140:                                    testSheet.addCell(label);
1141:                                    numeroColonne = numeroColonneSheetTest;
1142:                                    nombreExigenceParCasDeTests++;
1143:                                }
1144:                            }
1145:                        }
1146:                    } else {
1147:                        numeroColonne = numeroColonneSheetTest;
1148:                        nombreExigenceParCasDeTests++;
1149:                    }
1150:
1151:                    nombreActionsParCasDeTests = 0;
1152:                    XPath xpathSelector4 = DocumentHelper
1153:                            .createXPath("//Test[@id_test='"
1154:                                    + element.attributeValue("id_test")
1155:                                    + "']/TestManuel/ActionTest");
1156:                    List results4 = xpathSelector4.selectNodes(documentXml);
1157:                    for (Iterator iter4 = results4.iterator(); iter4.hasNext();) {
1158:                        Element element4 = (Element) iter4.next();
1159:                        // Ecrit Numéro cas
1160:                        try {
1161:                            int testNombre = Integer.parseInt(element4
1162:                                    .elementText("Nom"));
1163:                            nombre = new Number(numeroColonne
1164:                                    + ecritEntete
1165:                                            .getDIFFERENCE_COLONNE_NUMERO(),
1166:                                    numeroLigne + nombreActionsParCasDeTests,
1167:                                    testNombre, ecritEntete
1168:                                            .getcelluleNormaleNombreH());
1169:                            testSheet.addCell(nombre);
1170:                        } catch (NumberFormatException nfe) {
1171:                            label = new Label(numeroColonne
1172:                                    + ecritEntete
1173:                                            .getDIFFERENCE_COLONNE_NUMERO(),
1174:                                    numeroLigne + nombreActionsParCasDeTests,
1175:                                    element4.elementText("Nom"), ecritEntete
1176:                                            .getcelulleCentreeHetV());
1177:                            testSheet.addCell(label);
1178:                        }
1179:
1180:                        label = new Label(
1181:                                numeroColonne
1182:                                        + ecritEntete
1183:                                                .getDIFFERENCE_COLONNE_ACTION_A_REALISER(),
1184:                                numeroLigne + nombreActionsParCasDeTests,
1185:                                element4.elementText("Description"),
1186:                                ecritEntete.getcelluleNormale());
1187:                        testSheet.addCell(label);
1188:
1189:                        label = new Label(
1190:                                numeroColonne
1191:                                        + ecritEntete
1192:                                                .getDIFFERENCE_COLONNE_ACTION_ATTENDUE(),
1193:                                numeroLigne + nombreActionsParCasDeTests,
1194:                                element4.elementText("ResultAttendu"),
1195:                                ecritEntete.getcelluleNormale());
1196:                        testSheet.addCell(label);
1197:
1198:                        // Recupere etat Executé ou pas
1199:                        Element element3 = element.getParent();
1200:                        label = new Label(numeroColonne
1201:                                + ecritEntete.getDIFFERENCE_COLONNE_EXECUTE(),
1202:                                numeroLigne + nombreActionsParCasDeTests,
1203:                                element3.elementText("Executed"), ecritEntete
1204:                                        .getcelluleNormale());
1205:                        testSheet.addCell(label);
1206:
1207:                        readURLAttachements(
1208:                                "//Test[@id_test='"
1209:                                        + element.attributeValue("id_test")
1210:                                        + "']/TestManuel/ActionTest[@id_action='"
1211:                                        + element4.attributeValue("id_action")
1212:                                        + "']/Attachements/UrlAttachement",
1213:                                numeroColonne
1214:                                        + ecritEntete
1215:                                                .getDIFFERENCE_COLONNE_TEST_LIEN_HYPERTEXTE_ACTION(),
1216:                                numeroLigne + nombreActionsParCasDeTests,
1217:                                testSheet);
1218:                        readFileAttachements(
1219:                                "//Test[@id_test='"
1220:                                        + element.attributeValue("id_test")
1221:                                        + "']/TestManuel/ActionTest[@id_action='"
1222:                                        + element4.attributeValue("id_action")
1223:                                        + "']/Attachements/FileAttachement",
1224:                                numeroColonne
1225:                                        + ecritEntete
1226:                                                .getDIFFERENCE_COLONNE_TEST_PIECE_JOINTE_ACTION(),
1227:                                numeroLigne + nombreActionsParCasDeTests,
1228:                                testSheet);
1229:
1230:                        nombreActionsParCasDeTests++;
1231:
1232:                    }
1233:
1234:                    XPath xpathSelector8 = DocumentHelper
1235:                            .createXPath("//Test[@id_test='"
1236:                                    + element.attributeValue("id_test")
1237:                                    + "']/TestAuto");
1238:                    List results8 = xpathSelector8.selectNodes(documentXml);
1239:                    for (Iterator iter8 = results8.iterator(); iter8.hasNext();) {
1240:                        Element element8 = (Element) iter8.next();
1241:                        // Ecrit Numéro cas
1242:
1243:                        label = new Label(
1244:                                numeroColonne
1245:                                        + ecritEntete
1246:                                                .getDIFFERENCE_COLONNE_TYPE_SCRIPT_AUTOMATIQUE(),
1247:                                numeroLigne, element8
1248:                                        .attributeValue("plug_ext").replace(
1249:                                                ".TestDriver", ""), ecritEntete
1250:                                        .getcelluleNormale());
1251:                        testSheet.addCell(label);
1252:
1253:                        XPath xpathSelector9 = DocumentHelper
1254:                                .createXPath("//Test[@id_test='"
1255:                                        + element.attributeValue("id_test")
1256:                                        + "']/TestAuto/Script");
1257:                        List results9 = xpathSelector9.selectNodes(documentXml);
1258:                        for (Iterator iter9 = results9.iterator(); iter9
1259:                                .hasNext();) {
1260:                            Element element9 = (Element) iter9.next();
1261:                            String emplacementScript = "file:///" + xmlDir + fs
1262:                                    + element9.attributeValue("dir");
1263:                            try {
1264:                                Formula f = new Formula(
1265:                                        numeroColonne
1266:                                                + ecritEntete
1267:                                                        .getDIFFERENCE_COLONNE_EMPLACEMENT_SCRIPT_AUTOMATIQUE(),
1268:                                        numeroLigne, "HYPERLINK(\""
1269:                                                + emplacementScript + "\",\""
1270:                                                + emplacementScript + "\")",
1271:                                        ecritEntete.getcelluleNormale());
1272:                                testSheet.addCell(f);
1273:                            } catch (Exception fe) {
1274:                                isErreurEcritureXLS = setErreurEcritureXLS();
1275:                            }
1276:                        }
1277:
1278:                    }
1279:                    if (results8.isEmpty()) {
1280:                        label = new Label(
1281:                                numeroColonne
1282:                                        + ecritEntete
1283:                                                .getDIFFERENCE_COLONNE_TYPE_SCRIPT_AUTOMATIQUE(),
1284:                                numeroLigne, "", ecritEntete
1285:                                        .getcelluleNormale());
1286:                        testSheet.addCell(label);
1287:                        label = new Label(
1288:                                numeroColonne
1289:                                        + ecritEntete
1290:                                                .getDIFFERENCE_COLONNE_EMPLACEMENT_SCRIPT_AUTOMATIQUE(),
1291:                                numeroLigne, "", ecritEntete
1292:                                        .getcelluleNormale());
1293:                        testSheet.addCell(label);
1294:                    }
1295:
1296:                    readURLAttachements(
1297:                            "//Test[@id_test='"
1298:                                    + element.attributeValue("id_test")
1299:                                    + "']/Attachements/UrlAttachement",
1300:                            numeroColonne
1301:                                    + ecritEntete
1302:                                            .getDIFFERENCE_COLONNE_TEST_LIEN_HYPERTEXTE(),
1303:                            numeroLigne, testSheet);
1304:                    readFileAttachements("//Test[@id_test='"
1305:                            + element.attributeValue("id_test")
1306:                            + "']/Attachements/FileAttachement", numeroColonne
1307:                            + ecritEntete
1308:                                    .getDIFFERENCE_COLONNE_TEST_PIECE_JOINTE(),
1309:                            numeroLigne, testSheet);
1310:
1311:                    // Recupere Description
1312:                    XPath xpathSelector7 = DocumentHelper
1313:                            .createXPath("//Familles/Famille[Nom="
1314:                                    + removeSpecialCharacters(element2
1315:                                            .elementText("Nom"))
1316:                                    + "]/SuiteTests/SuiteTest/Tests/Test[@id_test='"
1317:                                    + element.attributeValue("id_test")
1318:                                    + "']/Description");
1319:                    List results7 = xpathSelector7.selectNodes(documentXml);
1320:                    for (Iterator iter7 = results7.iterator(); iter7.hasNext();) {
1321:                        Element element7 = (Element) iter7.next();
1322:                        String valeurDescription = EnleveBalisesHTML(element7
1323:                                .asXML());
1324:                        label = new Label(
1325:                                numeroColonne
1326:                                        + ecritEntete
1327:                                                .getDIFFERENCE_COLONNE_DESCRIPTION_TESTS(),
1328:                                numeroLigne, valeurDescription, ecritEntete
1329:                                        .getcelluleDescritpion());
1330:                        testSheet.addCell(label);
1331:
1332:                    }
1333:                    if (results7.isEmpty()) {
1334:                        label = new Label(
1335:                                numeroColonne
1336:                                        + ecritEntete
1337:                                                .getDIFFERENCE_COLONNE_DESCRIPTION_TESTS(),
1338:                                numeroLigne, "", ecritEntete
1339:                                        .getcelluleDescritpion());
1340:                        testSheet.addCell(label);
1341:                    }
1342:                    // prépare une nouvelle ligne
1343:                    if (nombreActionsParCasDeTests >= nombreExigenceParCasDeTests) {
1344:                        numeroLigne = numeroLigne + nombreActionsParCasDeTests;
1345:                    } else {
1346:                        numeroLigne = numeroLigne + nombreExigenceParCasDeTests;
1347:                    }
1348:                }
1349:
1350:            }
1351:
1352:            /**
1353:             * Modify a string to pass spécial characters like quote
1354:             * 
1355:             * @param chaineAModifier
1356:             *            A string for argument
1357:             * @return A string
1358:             */
1359:            public String removeSpecialCharacters(String chaineAModifier) {
1360:
1361:                StringTokenizer st = new StringTokenizer(chaineAModifier, "'");
1362:                if (st.countTokens() > 1) {
1363:                    chaineAModifier = "concat(";
1364:                    while (st.hasMoreTokens()) {
1365:                        chaineAModifier = chaineAModifier + "'"
1366:                                + st.nextToken() + "'";
1367:                        chaineAModifier = chaineAModifier + ",\"'\",";
1368:                    }
1369:                    chaineAModifier = chaineAModifier.substring(0,
1370:                            chaineAModifier.length() - 5);
1371:                    chaineAModifier = chaineAModifier + ")";
1372:                } else {
1373:                    chaineAModifier = "'" + chaineAModifier + "'";
1374:                }
1375:                return chaineAModifier;
1376:            }
1377:
1378:            /**
1379:             * Function that parse Xml file to read requirements
1380:             * @param selectionExportAnomalies Veryfy bug spreadsheet presence
1381:             * @param documentXml document Xml
1382:             * @throws org.dom4j.DocumentException DocumentException
1383:             * @throws java.lang.Exception Exception
1384:             */
1385:            public void readXMLFileRequirement(Document documentXml,
1386:                    boolean selectionExportAnomalies) throws DocumentException,
1387:                    Exception {
1388:
1389:                numeroColonneSheetExigence = ecritEntete
1390:                        .getNumeroColonneFeuilleExigence();
1391:
1392:                XPath xpathSelector = DocumentHelper
1393:                        .createXPath("//Requirement/Nom");
1394:                List results = xpathSelector.selectNodes(documentXml);
1395:
1396:                for (Iterator iter = results.iterator(); iter.hasNext();) {
1397:                    Element element = (Element) iter.next();
1398:                    // ecrit une exigence
1399:                    numeroColonne = 0;
1400:                    numeroLigne++;
1401:                    Element elementTemp = element.getParent();
1402:                    themeValue = "";
1403:
1404:                    if (elementTemp.getParent().getName() != "Requirements") {
1405:                        themeValue = elementTemp.getParent().element("Nom")
1406:                                .getText();
1407:                        while (!elementTemp.getParent().attributeValue(
1408:                                "id_req_parent").equals("Req_0")) {
1409:                            themeValue = elementTemp.getParent().getParent()
1410:                                    .element("Nom").getText()
1411:                                    + Language.getInstance().getText("_")
1412:                                    + themeValue;
1413:                            elementTemp = elementTemp.getParent();
1414:                        }
1415:                    }
1416:
1417:                    StringTokenizer stv = new StringTokenizer(themeValue,
1418:                            Language.getInstance().getText("_"));
1419:                    while (stv.hasMoreTokens()) {
1420:                        label = new Label(numeroColonne, numeroLigne, stv
1421:                                .nextToken(), ecritEntete.getcelluleNormale());
1422:                        requirementSheet.addCell(label);
1423:                        numeroColonne++;
1424:                    }
1425:                    StringTokenizer st = new StringTokenizer(element.getText(),
1426:                            Language.getInstance().getText("_"));
1427:
1428:                    while (st.hasMoreTokens()) {
1429:                        // Pour ecrire l'exigence dans la colonne Exigence;
1430:                        if (st.countTokens() == 1) {
1431:                            // Pour encadrer les celules vides des sous themes
1432:                            // d'exigences
1433:                            while (numeroColonne < numeroColonneSheetExigence) {
1434:                                label = new Label(numeroColonne, numeroLigne,
1435:                                        "", ecritEntete.getcelluleNormale());
1436:                                requirementSheet.addCell(label);
1437:                                numeroColonne++;
1438:                            }
1439:                            numeroColonne = numeroColonneSheetExigence;
1440:                        }
1441:                        String exigence = st.nextToken();
1442:                        label = new Label(numeroColonne, numeroLigne, exigence,
1443:                                ecritEntete.getcelluleNormale());
1444:                        requirementSheet.addCell(label);
1445:                        numeroColonne++;
1446:
1447:                    }
1448:
1449:                    numeroColonne = numeroColonneSheetExigence;
1450:                    readRequirementsSettings(element.getParent()
1451:                            .attributeValue("id_req"));
1452:
1453:                }
1454:
1455:            }
1456:
1457:            /**
1458:             * Read requirement options
1459:             * @param ParsingRequirementID ID requirememnt
1460:             * @throws jxl.write.WriteException Erreur Ecriture Excel
1461:             */
1462:            public void readRequirementsSettings(String ParsingRequirementID)
1463:                    throws WriteException {
1464:                XPath xpathSelector3 = DocumentHelper
1465:                        .createXPath("//Requirement[@id_req='"
1466:                                + ParsingRequirementID + "']");
1467:                List results3 = xpathSelector3.selectNodes(documentXml);
1468:                for (Iterator iter3 = results3.iterator(); iter3.hasNext();) {
1469:                    Element element3 = (Element) iter3.next();
1470:                    // Ecrit priorité
1471:                    try {
1472:                        nombre = new Number(numeroColonne
1473:                                + ecritEntete.getDIFFERENCE_COLONNE_PRIORITE(),
1474:                                numeroLigne, Integer.parseInt(element3
1475:                                        .attributeValue("priority")),
1476:                                ecritEntete.getcelluleNormaleNombre());
1477:                        requirementSheet.addCell(nombre);
1478:                    } catch (NumberFormatException nfe) {
1479:                        label = new Label(numeroColonne
1480:                                + ecritEntete.getDIFFERENCE_COLONNE_PRIORITE(),
1481:                                numeroLigne, element3
1482:                                        .attributeValue("priority"),
1483:                                ecritEntete.getcelluleNormale());
1484:                        requirementSheet.addCell(label);
1485:                    }
1486:
1487:                    // Ecrit Version
1488:                    try {
1489:                        nombre = new Number(numeroColonne
1490:                                + ecritEntete.getDIFFERENCE_COLONNE_VERSION(),
1491:                                numeroLigne, Integer.parseInt(element3
1492:                                        .attributeValue("version")),
1493:                                ecritEntete.getcelluleNormaleNombre());
1494:                        requirementSheet.addCell(nombre);
1495:                    } catch (NumberFormatException nfe) {
1496:                        label = new Label(numeroColonne
1497:                                + ecritEntete.getDIFFERENCE_COLONNE_VERSION(),
1498:                                numeroLigne,
1499:                                element3.attributeValue("version"), ecritEntete
1500:                                        .getcelluleNormale());
1501:                        requirementSheet.addCell(label);
1502:                    }
1503:
1504:                    // Ecrit Catégorie
1505:                    if (element3.attributeValue("category") != null) {
1506:                        nombre = new Number(
1507:                                numeroColonne
1508:                                        + ecritEntete
1509:                                                .getDIFFERENCE_COLONNE_CATEGORIE(),
1510:                                numeroLigne, Integer.parseInt(element3
1511:                                        .attributeValue("category")),
1512:                                ecritEntete.getcelluleNormaleNombre());
1513:                        requirementSheet.addCell(nombre);
1514:                    }
1515:
1516:                    // Ecrit Complexite
1517:                    if (element3.attributeValue("complexity") != null) {
1518:                        nombre = new Number(numeroColonne
1519:                                + ecritEntete
1520:                                        .getDIFFERENCE_COLONNE_COMPLEXITE(),
1521:                                numeroLigne, Integer.parseInt(element3
1522:                                        .attributeValue("complexity")),
1523:                                ecritEntete.getcelluleNormaleNombre());
1524:                        requirementSheet.addCell(nombre);
1525:                    } else {
1526:                        label = new Label(numeroColonne
1527:                                + ecritEntete.getDIFFERENCE_COLONNE_ETAT(),
1528:                                numeroLigne, element3
1529:                                        .attributeValue("complexity"),
1530:                                ecritEntete.getcelluleNormale());
1531:                        requirementSheet.addCell(label);
1532:                    }
1533:
1534:                    // Ecrit Etat
1535:                    if (element3.attributeValue("state") != null) {
1536:                        nombre = new Number(numeroColonne
1537:                                + ecritEntete.getDIFFERENCE_COLONNE_ETAT(),
1538:                                numeroLigne, Integer.parseInt(element3
1539:                                        .attributeValue("state")), ecritEntete
1540:                                        .getcelluleNormaleNombre());
1541:                        requirementSheet.addCell(nombre);
1542:                    } else {
1543:                        label = new Label(numeroColonne
1544:                                + ecritEntete.getDIFFERENCE_COLONNE_ETAT(),
1545:                                numeroLigne, element3.attributeValue("state"),
1546:                                ecritEntete.getcelluleNormale());
1547:                        requirementSheet.addCell(label);
1548:                    }
1549:
1550:                    // Ecrit Origine
1551:                    label = new Label(numeroColonne
1552:                            + ecritEntete.getDIFFERENCE_COLONNE_ORIGINE(),
1553:                            numeroLigne, element3.attributeValue("origine"),
1554:                            ecritEntete.getcelluleNormale());
1555:                    requirementSheet.addCell(label);
1556:
1557:                    // Ecrit VerifWay
1558:                    label = new Label(numeroColonne
1559:                            + ecritEntete.getDIFFERENCE_COLONNE_VERIFWAY(),
1560:                            numeroLigne, element3.attributeValue("verifway"),
1561:                            ecritEntete.getcelluleNormale());
1562:                    requirementSheet.addCell(label);
1563:
1564:                    // Ecrit Reference
1565:                    label = new Label(numeroColonne
1566:                            + ecritEntete.getDIFFERENCE_COLONNE_REFERENCE(),
1567:                            numeroLigne, element3.attributeValue("Reference"),
1568:                            ecritEntete.getcelluleNormale());
1569:                    requirementSheet.addCell(label);
1570:
1571:                }
1572:
1573:                // Lit description
1574:                XPath xpathSelector4 = DocumentHelper
1575:                        .createXPath("//Requirement[@id_req='"
1576:                                + ParsingRequirementID + "']/Description");
1577:                List results4 = xpathSelector4.selectNodes(documentXml);
1578:                for (Iterator iter4 = results4.iterator(); iter4.hasNext();) {
1579:                    Element element4 = (Element) iter4.next();
1580:                    String valeurDescription = EnleveBalisesHTML(element4
1581:                            .asXML());
1582:                    label = new Label(numeroColonne
1583:                            + ecritEntete.getDIFFERENCE_COLONNE_DESCRIPTION(),
1584:                            numeroLigne, valeurDescription, ecritEntete
1585:                                    .getcelluleNormale());
1586:                    requirementSheet.addCell(label);
1587:
1588:                }
1589:                if (results4.isEmpty()) {
1590:                    label = new Label(numeroColonne
1591:                            + ecritEntete.getDIFFERENCE_COLONNE_DESCRIPTION(),
1592:                            numeroLigne, "", ecritEntete.getcelluleNormale());
1593:                    requirementSheet.addCell(label);
1594:                }
1595:
1596:                readURLAttachements("//Requirement[@id_req='"
1597:                        + ParsingRequirementID
1598:                        + "']/Attachements/UrlAttachement", numeroColonne
1599:                        + ecritEntete.getDIFFERENCE_COLONNE_LIEN_HYPERTEXTE(),
1600:                        numeroLigne, requirementSheet);
1601:                readFileAttachements("//Requirement[@id_req='"
1602:                        + ParsingRequirementID
1603:                        + "']/Attachements/FileAttachement", numeroColonne
1604:                        + ecritEntete.getDIFFERENCE_COLONNE_PIECE_JOINTE(),
1605:                        numeroLigne, requirementSheet);
1606:
1607:                // Préparation pour nouvelle ligne
1608:                nombreLigneRequirementLu++;
1609:            }
1610:
1611:            /**
1612:             * Permet d'enlever les balises HTML d'une chaine de caractères
1613:             * @param chaineAModifier chaine à modifier
1614:             * @return chaine modifiée
1615:             */
1616:            public String EnleveBalisesHTML(String chaineAModifier) {
1617:                String chaineARetourner = "";
1618:                boolean balise = false;
1619:                while (chaineAModifier.length() > 0) {
1620:                    while (chaineAModifier.startsWith("<br/>")) {
1621:                        chaineARetourner = chaineARetourner.trim();
1622:                        chaineARetourner += "\n";
1623:                        chaineAModifier = chaineAModifier.substring(5);
1624:
1625:                    }
1626:                    if (chaineAModifier.substring(0, 1).equals("<")) {
1627:                        balise = true;
1628:                        chaineARetourner = chaineARetourner.trim();
1629:                        chaineARetourner += "\n";
1630:
1631:                    }
1632:                    if (balise == false) {
1633:                        chaineARetourner += chaineAModifier.substring(0, 1);
1634:                    }
1635:                    if (chaineAModifier.substring(0, 1).equals(">")) {
1636:                        balise = false;
1637:                    }
1638:                    chaineAModifier = chaineAModifier.substring(1);
1639:
1640:                }
1641:                if (chaineARetourner.equals("\n")) {
1642:                    chaineARetourner = "";
1643:                }
1644:                return chaineARetourner;
1645:            }
1646:
1647:            /**
1648:             * Function that write XLS heading
1649:             * @param nombreMaxBranche Nombre maximal de branches imbriquées pour les exigences
1650:             * @param selectionExportAnomalies Veryfy bug spreadsheet presence
1651:             * @throws jxl.write.WriteException WriteException
1652:             */
1653:            public void writeXLSHeading(boolean selectionExportAnomalies)
1654:                    throws WriteException {
1655:                int nombreElementBranche = 0;
1656:                if (TestPresencePlugin.testDeLaPresenceDuPluginRequirement()) {
1657:                    // Fonction permettant de creer suffisament de colonnes sous themes par
1658:                    // doc à exporter
1659:                    XPath xpathSelector0 = DocumentHelper
1660:                            .createXPath("//Requirement/Nom");
1661:                    List results0 = xpathSelector0.selectNodes(documentXml);
1662:                    for (Iterator iter0 = results0.iterator(); iter0.hasNext();) {
1663:                        Element element0 = (Element) iter0.next();
1664:                        int comteurNiveauBranches = 0;
1665:                        element0 = element0.getParent();
1666:                        while (element0.getParent().getName() == "RequirementFamily") {
1667:                            comteurNiveauBranches++;
1668:                            element0 = element0.getParent();
1669:                        }
1670:                        if (comteurNiveauBranches > nombreElementBranche) {
1671:                            nombreElementBranche = comteurNiveauBranches;
1672:                        }
1673:                    }
1674:                }
1675:                try {
1676:                    ecritEntete = new EcritEntete(nombreElementBranche,
1677:                            fichierDeSortieXLS, selectionExportAnomalies);
1678:                    // EcritEntete.getWorkbookHeading();
1679:                } catch (WriteException ex) {
1680:                    ex.printStackTrace();
1681:                }
1682:
1683:                workbook = ecritEntete.getWorkbookHeading();
1684:                requirementSheet = workbook.getSheet(Language.getInstance()
1685:                        .getText("Exigences"));
1686:                testSheet = workbook.getSheet(Language.getInstance().getText(
1687:                        "Tests"));
1688:                paramSheet = workbook.getSheet(Language.getInstance().getText(
1689:                        "Parametres"));
1690:                enviroSheet = workbook.getSheet(Language.getInstance().getText(
1691:                        "Environnements"));
1692:                campagneSheet = workbook.getSheet(Language.getInstance()
1693:                        .getText("Campagnes"));
1694:                execCampSheet = workbook.getSheet(Language.getInstance()
1695:                        .getText("Execution_campagnes"));
1696:                if (selectionExportAnomalies) {
1697:                    anomaliesSheet = workbook.getSheet(Language.getInstance()
1698:                            .getText("Anomalies"));
1699:
1700:                }
1701:
1702:            }
1703:
1704:            /**
1705:             * Function that organise XLS file (merge cells, ...)
1706:             * @param feuilleExcel spreadsheet name
1707:             */
1708:            /*
1709:            public void masqueColonnesVides(WritableSheet feuilleExcel){
1710:            	// Supprime les colonnes vides
1711:            	boolean TestContenu;
1712:            	for (int i = 0; i <= feuilleExcel.getColumns(); i++) {
1713:            		TestContenu = false;
1714:            		for (int j = 1; j <= feuilleExcel.getRows() && TestContenu == false; j++) {
1715:            			Cell RequirementTest = feuilleExcel.getCell(i, j);
1716:            			if (feuilleExcel.getCell(i, j).getContents().length() > 0) {
1717:            				TestContenu = true;
1718:            			}			
1719:            		}
1720:
1721:            		if (TestContenu == false) {
1722:            			CellView colonneMasquee = new CellView();
1723:            			colonneMasquee.setHidden(true);
1724:            			feuilleExcel.setColumnView(i, colonneMasquee);
1725:
1726:            		}
1727:            	}
1728:            }
1729:             */
1730:            /**
1731:             * Function that organise XLS file (merge cells, ...)
1732:             * @param selectionExportEnvironnement parametre case à cocher
1733:             * @param selectionExportCampagne parametre case à cocher
1734:             * @param selectionExportExecutionCampagne parametre case à cocher
1735:             * @param selectionExportAnomalies parametre case à cocher
1736:             * @param selectionExportParametre parametre case à cocher
1737:             * @param selectionExportExigence parametre case à cocher
1738:             * @param selectionExportTest parametre case à cocher
1739:             * @throws jxl.write.WriteException Write Exception
1740:             */
1741:            /*	public void organizeXLSfile(boolean selectionExportExigence, boolean selectionExportTest, boolean selectionExportParametre, boolean selectionExportEnvironnement, boolean selectionExportCampagne, boolean selectionExportExecutionCampagne, boolean selectionExportAnomalies) throws WriteException {
1742:
1743:             int i = 0;
1744:             int j = 0;
1745:
1746:             if (selectionExportExigence){
1747:             masqueColonnesVides(requirementSheet);
1748:
1749:             // Fonction permettant de fussionner les cellules de tableau d'exigences
1750:             // pour faire une jolie présentation
1751:             i = 0;
1752:             j = 0;
1753:             int CelulleAvecTexteColumn = 0;
1754:             boolean celluleFusionne = false;
1755:
1756:
1757:             for (j = 0; j < requirementSheet.getRows(); j++) {
1758:             celluleFusionne = false;
1759:             CelulleAvecTexteColumn = 0;
1760:             for (i = 0; i < ecritEntete.getNumeroColonneFeuilleExigence(); i++) {
1761:
1762:             if (requirementSheet.getCell(i, j).getContents().length() == 0) {
1763:             if (i > 0) {
1764:             if (requirementSheet.getCell(i - 1, j).getContents().length() == 0) {
1765:             CelulleAvecTexteColumn = i;
1766:             } else {
1767:             i = ecritEntete.getNumeroColonneFeuilleExigence();
1768:
1769:             }
1770:
1771:             } else {
1772:             CelulleAvecTexteColumn = i;
1773:             }
1774:
1775:             }
1776:             }
1777:             if (CelulleAvecTexteColumn != 0) {
1778:             label = new Label(0, j, "", ecritEntete.getcelulleCentreeHetV());
1779:             requirementSheet.addCell(label);
1780:             requirementSheet.mergeCells(0, j, CelulleAvecTexteColumn, j);
1781:             celluleFusionne = true;
1782:             }
1783:             // partie pour fusionner le reste des colonnes sous themes vides
1784:             if (requirementSheet.getCell(ecritEntete.getNumeroColonneFeuilleExigence() - 1, j).getContents().length() == 0) {
1785:             CelulleAvecTexteColumn = ecritEntete.getNumeroColonneFeuilleExigence() - 1;
1786:
1787:             while (requirementSheet.getCell(CelulleAvecTexteColumn, j).getContents().length() == 0&& CelulleAvecTexteColumn > 0) {
1788:             CelulleAvecTexteColumn--;
1789:             }
1790:
1791:             CelulleAvecTexteColumn++;
1792:             if ((celluleFusionne == false)&& (CelulleAvecTexteColumn < ecritEntete.getNumeroColonneFeuilleExigence())) {
1793:             label = new Label(CelulleAvecTexteColumn, j, "",ecritEntete.getcelulleCentreeHetV());
1794:             requirementSheet.addCell(label);
1795:             requirementSheet.mergeCells(CelulleAvecTexteColumn, j, ecritEntete.getNumeroColonneFeuilleExigence() - 1, j);
1796:             celluleFusionne = true;
1797:             }
1798:             }
1799:
1800:             }
1801:             }
1802:
1803:
1804:             // Fonction permettant de fussionner les cellules de tableau des tests
1805:             //Supprime les colonnes vides
1806:             if (selectionExportTest){
1807:             Cell test;
1808:             masqueColonnesVides(testSheet);
1809:
1810:
1811:
1812:             // Fonction permettant de fusionner les cellules de tableau environnement pour
1813:             // faire une jolie présentation
1814:             i =  ecritEntete.getDIFFERENCE_COLONNE_FAMILLE_TESTS();
1815:             j = 0;
1816:
1817:
1818:
1819:             for (j = 1; j < testSheet.getRows(); j++) {
1820:             int CelulleAvecTexteRow = 0;
1821:             test = testSheet.getCell(i, j);
1822:             if (test.getContents().length() != 0){
1823:             while(testSheet.getCell(i, j+CelulleAvecTexteRow+1).getContents().length() == 0 && (j+CelulleAvecTexteRow<testSheet.getRows())){
1824:             CelulleAvecTexteRow++;
1825:             }
1826:             if (j+CelulleAvecTexteRow==testSheet.getRows()){
1827:             CelulleAvecTexteRow--;
1828:             }
1829:             if (CelulleAvecTexteRow!=0){
1830:             testSheet.mergeCells(ecritEntete.getDIFFERENCE_COLONNE_FAMILLE_TESTS(), j, ecritEntete.getDIFFERENCE_COLONNE_FAMILLE_TESTS(), j + CelulleAvecTexteRow);
1831:             testSheet.mergeCells(ecritEntete.getDIFFERENCE_COLONNE_SUITE_TESTS(), j, ecritEntete.getDIFFERENCE_COLONNE_SUITE_TESTS(), j + CelulleAvecTexteRow);
1832:             testSheet.mergeCells(ecritEntete.getDIFFERENCE_COLONNE_CAS_DE_TESTS(), j, ecritEntete.getDIFFERENCE_COLONNE_CAS_DE_TESTS(), j + CelulleAvecTexteRow);
1833:             testSheet.mergeCells(ecritEntete.getDIFFERENCE_COLONNE_TEST_LIEN_HYPERTEXTE(), j, ecritEntete.getDIFFERENCE_COLONNE_TEST_LIEN_HYPERTEXTE(), j + CelulleAvecTexteRow);
1834:             testSheet.mergeCells(ecritEntete.getDIFFERENCE_COLONNE_TEST_PIECE_JOINTE(), j, ecritEntete.getDIFFERENCE_COLONNE_TEST_PIECE_JOINTE(), j + CelulleAvecTexteRow);
1835:             testSheet.mergeCells(ecritEntete.getDIFFERENCE_COLONNE_DESCRIPTION_TESTS(), j, ecritEntete.getDIFFERENCE_COLONNE_DESCRIPTION_TESTS(), j + CelulleAvecTexteRow);
1836:             if ((testSheet.getCell(ecritEntete.getDIFFERENCE_COLONNE_TYPE_SCRIPT_AUTOMATIQUE(), j).getContents().length() == 0) && (testSheet.getCell(ecritEntete.getDIFFERENCE_COLONNE_EMPLACEMENT_SCRIPT_AUTOMATIQUE(), j).getContents().length() == 0)){
1837:             label = new Label(ecritEntete.getDIFFERENCE_COLONNE_TYPE_SCRIPT_AUTOMATIQUE(), j, "", ecritEntete.getcelulleCentreeHetV());
1838:             testSheet.addCell(label); 
1839:             label = new Label(ecritEntete.getDIFFERENCE_COLONNE_EMPLACEMENT_SCRIPT_AUTOMATIQUE(), j, "", ecritEntete.getcelulleCentreeHetV());
1840:             testSheet.addCell(label); 
1841:             testSheet.mergeCells(ecritEntete.getDIFFERENCE_COLONNE_TYPE_SCRIPT_AUTOMATIQUE(), j, ecritEntete.getDIFFERENCE_COLONNE_TYPE_SCRIPT_AUTOMATIQUE(), j + CelulleAvecTexteRow);
1842:             testSheet.mergeCells(ecritEntete.getDIFFERENCE_COLONNE_EMPLACEMENT_SCRIPT_AUTOMATIQUE(), j, ecritEntete.getDIFFERENCE_COLONNE_EMPLACEMENT_SCRIPT_AUTOMATIQUE(), j + CelulleAvecTexteRow);
1843:             }
1844:             j = j + CelulleAvecTexteRow;
1845:             }	
1846:             }
1847:             }
1848:             for (j = 0; j < testSheet.getRows(); j++) {
1849:             //	fusionne de la colonne numéro action à action executée
1850:             if ((testSheet.getCell(ecritEntete.getDIFFERENCE_COLONNE_NUMERO(), j).getContents().length() == 0) && (testSheet.getCell(ecritEntete.getDIFFERENCE_COLONNE_ACTION_A_REALISER(), j).getContents().length() == 0) && (testSheet.getCell(ecritEntete.getDIFFERENCE_COLONNE_ACTION_ATTENDUE(), j).getContents().length() == 0)){
1851:             label = new Label(ecritEntete.getDIFFERENCE_COLONNE_NUMERO(), j, "", ecritEntete.getcelulleCentreeHetV());
1852:             testSheet.addCell(label);
1853:             testSheet.mergeCells(ecritEntete.getDIFFERENCE_COLONNE_NUMERO(), j, ecritEntete.getDIFFERENCE_COLONNE_EXECUTE(), j);
1854:             }
1855:             // partie pour fusionner le reste des colonnes branches vides
1856:             int minVide=0;
1857:             int maxVide=0;
1858:             for (int k= numeroColonneSheetTest +numeroColonneSheetBranche; k<= numeroColonneSheetTest +numeroColonneSheetExigence; k++){
1859:             if (testSheet.getCell(k, j).getContents().length() == 0){
1860:             if (minVide==0){
1861:             minVide= k;
1862:             }
1863:             maxVide=k;
1864:             }
1865:             }
1866:             if ((minVide!=maxVide) && (minVide!=0)) {
1867:             label = new Label(minVide, j, "", ecritEntete.getcelulleCentreeHetV());
1868:             testSheet.addCell(label);
1869:             testSheet.mergeCells(minVide, j, maxVide, j);
1870:             }
1871:             }
1872:             }
1873:
1874:
1875:             //Partie parametre
1876:             //Supprime les colonnes vides
1877:             if (selectionExportParametre) {
1878:             masqueColonnesVides(paramSheet);
1879:             }
1880:
1881:
1882:             //Partie environnement
1883:             //Supprime les colonnes vides
1884:             if (selectionExportEnvironnement) {
1885:             Cell enviroTest;
1886:             masqueColonnesVides(enviroSheet);
1887:
1888:
1889:             // Fonction permettant de fusionner les cellules de tableau environnement pour
1890:             // faire une jolie présentation
1891:             i =  ecritEntete.getNUMERO_COLONNE_NOM_ENVIRONNEMENT();
1892:             j = 0;
1893:
1894:             for (j = 1; j < enviroSheet.getRows(); j++) {
1895:             int CelulleAvecTexteRow = 0;
1896:             enviroTest = enviroSheet.getCell(i, j);
1897:             if (enviroTest.getContents().length() > 0){
1898:             while(enviroSheet.getCell(i, j+CelulleAvecTexteRow+1).getContents().length() == 0 && (j+CelulleAvecTexteRow<enviroSheet.getRows())){
1899:             CelulleAvecTexteRow++;
1900:             }
1901:             if (j+CelulleAvecTexteRow==enviroSheet.getRows()){
1902:             CelulleAvecTexteRow--;
1903:             }
1904:             if (CelulleAvecTexteRow!=0){
1905:             //Merge nom environement
1906:             enviroSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_NOM_ENVIRONNEMENT(), j, ecritEntete.getNUMERO_COLONNE_NOM_ENVIRONNEMENT(), j + CelulleAvecTexteRow);
1907:             //Merge Description
1908:             enviroSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_DESCRIPTION_ENVIRONNEMENT(), j, ecritEntete.getNUMERO_COLONNE_DESCRIPTION_ENVIRONNEMENT(), j + CelulleAvecTexteRow);
1909:             //Merge Colonne URL
1910:             enviroSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_LIEN_HYPERTEXTE_ENVIRONNEMENT(), j, ecritEntete.getNUMERO_COLONNE_LIEN_HYPERTEXTE_ENVIRONNEMENT(), j + CelulleAvecTexteRow);
1911:             //Merge Colonne File
1912:             enviroSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_PIECE_JOINTE_ENVIRONNEMENT(), j, ecritEntete.getNUMERO_COLONNE_PIECE_JOINTE_ENVIRONNEMENT(), j + CelulleAvecTexteRow);
1913:
1914:             j = j + CelulleAvecTexteRow;
1915:             }	
1916:             }
1917:             }
1918:             }
1919:
1920:             //		Partie Campagnes
1921:             //Supprime les colonnes vides
1922:             if (selectionExportCampagne) {
1923:             Cell campagneTest;
1924:             masqueColonnesVides(campagneSheet);
1925:
1926:             //Fonction permettant de fusionner les cellules de tableau Camapgnes pour
1927:             // faire une jolie présentation
1928:             i =  ecritEntete.getNUMERO_COLONNE_NOM_CAMPAGNE();
1929:             j = 0;
1930:             for (j = 1; j < campagneSheet.getRows(); j++) {
1931:             //Fusions les lignes jeux de données
1932:             if ((campagneSheet.getCell(ecritEntete.getNUMERO_COLONNE_NOM_JEU_DONNEES_CAMPAGNE(),j).getContents().length() ==0)&&(campagneSheet.getCell(ecritEntete.getNUMERO_COLONNE_DESCRIPTION_JEU_DONNEES_CAMPAGNE(),j).getContents().length() ==0)){
1933:             label = new Label(ecritEntete.getNUMERO_COLONNE_NOM_JEU_DONNEES_CAMPAGNE(),j, "", ecritEntete.getcelulleCentreeHetV());
1934:             campagneSheet.addCell(label);
1935:             campagneSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_NOM_JEU_DONNEES_CAMPAGNE(),j,ecritEntete.getNUMERO_COLONNE_DESCRIPTION_JEU_DONNEES_CAMPAGNE(),j);
1936:             }
1937:             }
1938:
1939:             for (j = 1; j < campagneSheet.getRows(); j++) {
1940:             int CelulleAvecTexteRow = 0;
1941:             campagneTest = campagneSheet.getCell(i, j);
1942:             if (campagneTest.getContents().length() != 0){
1943:             while(campagneSheet.getCell(i, j+CelulleAvecTexteRow+1).getContents().length() == 0 && (j+CelulleAvecTexteRow<campagneSheet.getRows())){
1944:             CelulleAvecTexteRow++;
1945:             }
1946:             if (j+CelulleAvecTexteRow==campagneSheet.getRows()){
1947:             CelulleAvecTexteRow--;
1948:             }
1949:             if (CelulleAvecTexteRow!=0){
1950:             //Merge nom environement
1951:             campagneSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_NOM_CAMPAGNE(), j, ecritEntete.getNUMERO_COLONNE_NOM_CAMPAGNE(), j + CelulleAvecTexteRow);
1952:             //Merge Description
1953:             campagneSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_DESCRIPTION_CAMPAGNE(), j, ecritEntete.getNUMERO_COLONNE_DESCRIPTION_CAMPAGNE(), j + CelulleAvecTexteRow);
1954:             //Merge Colonne URL
1955:             campagneSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_LIEN_HYPERTEXTE_CAMPAGNE(), j, ecritEntete.getNUMERO_COLONNE_LIEN_HYPERTEXTE_CAMPAGNE(), j + CelulleAvecTexteRow);
1956:             //Merge Colonne File
1957:             campagneSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_PIECE_JOINTE_CAMPAGNE(), j, ecritEntete.getNUMERO_COLONNE_PIECE_JOINTE_CAMPAGNE(), j + CelulleAvecTexteRow);
1958:
1959:             j = j + CelulleAvecTexteRow;
1960:             }	
1961:             }
1962:             }
1963:             }
1964:
1965:             //		Partie Executions des Campagnes
1966:             //Supprime les colonnes vides
1967:             if (selectionExportExecutionCampagne){
1968:             Cell execCampTest;
1969:             masqueColonnesVides(execCampSheet);
1970:
1971:             //			Fonction permettant de fusionner les cellules de tableau Execution des Campagnes pour
1972:             // faire une jolie présentation	
1973:             i =  ecritEntete.getNUMERO_COLONNE_NOM_CAMPAGNEEEXECUTION();
1974:             j = 0;
1975:
1976:             for (j = 1; j < execCampSheet.getRows(); j++) {
1977:             int CelulleAvecTexteRow = 0;
1978:             execCampTest = execCampSheet.getCell(i, j);
1979:             if (execCampTest.getContents().length() != 0){
1980:             while(execCampSheet.getCell(i, j+CelulleAvecTexteRow+1).getContents().length() == 0 && (j+CelulleAvecTexteRow<execCampSheet.getRows())){
1981:             CelulleAvecTexteRow++;
1982:             }
1983:             if (j+CelulleAvecTexteRow==execCampSheet.getRows()){
1984:             CelulleAvecTexteRow--;
1985:             }
1986:             if (CelulleAvecTexteRow!=0){
1987:             //Merge nom environement
1988:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_NOM_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_NOM_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
1989:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_NOM_EXECUTION_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_NOM_EXECUTION_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
1990:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_ENVIRONNEMENT_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_ENVIRONNEMENT_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
1991:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_NOM_JEU_DONNEES_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_NOM_JEU_DONNEES_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
1992:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_LIEN_HYPERTEXTE_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_LIEN_HYPERTEXTE_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
1993:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_PIECE_JOINTE_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_PIECE_JOINTE_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
1994:             j = j + CelulleAvecTexteRow;
1995:             }	
1996:             }
1997:             }
1998:
1999:             i =  ecritEntete.getNUMERO_COLONNE_NOM_RESULTAT_EXECUTION_CAMPAGNEEEXECUTION();
2000:             j = 0;
2001:             for (j = 1; j < execCampSheet.getRows(); j++) {
2002:             int CelulleAvecTexteRow = 0;
2003:             execCampTest = execCampSheet.getCell(i, j);
2004:             if (execCampTest.getContents().length() != 0){
2005:             while(execCampSheet.getCell(i, j+CelulleAvecTexteRow+1).getContents().length() == 0 && (j+CelulleAvecTexteRow<execCampSheet.getRows())){
2006:             CelulleAvecTexteRow++;
2007:             }
2008:             if (j+CelulleAvecTexteRow==execCampSheet.getRows()){
2009:             CelulleAvecTexteRow--;
2010:             }
2011:             if (CelulleAvecTexteRow!=0){
2012:             //Merge nom environement
2013:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_NOM_RESULTAT_EXECUTION_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_NOM_RESULTAT_EXECUTION_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
2014:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_RESULTAT_EXECUTION_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_RESULTAT_EXECUTION_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
2015:             j = j + CelulleAvecTexteRow;
2016:             }	
2017:             }
2018:             }
2019:
2020:             i =  ecritEntete.getNUMERO_COLONNE_FAMILLE_TEST_CAMPAGNEEEXECUTION();
2021:             j = 0;
2022:             for (j = 1; j < execCampSheet.getRows(); j++) {
2023:             int CelulleAvecTexteRow = 0;
2024:             execCampTest = execCampSheet.getCell(i, j);
2025:             if (execCampTest.getContents().length() != 0){
2026:             while(execCampSheet.getCell(i, j+CelulleAvecTexteRow+1).getContents().length() == 0 && (j+CelulleAvecTexteRow<execCampSheet.getRows())){
2027:             CelulleAvecTexteRow++;
2028:             }
2029:             if (j+CelulleAvecTexteRow==execCampSheet.getRows()){
2030:             CelulleAvecTexteRow--;
2031:             }
2032:             if (CelulleAvecTexteRow!=0){
2033:             //Merge nom environement
2034:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_FAMILLE_TEST_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_FAMILLE_TEST_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
2035:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_SUITE_TEST_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_SUITE_TEST_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
2036:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_NOM_TEST_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_NOM_TEST_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
2037:             execCampSheet.mergeCells(ecritEntete.getNUMERO_COLONNE_RESULTAT_EXECUTION_TEST_CAMPAGNEEEXECUTION(), j, ecritEntete.getNUMERO_COLONNE_RESULTAT_EXECUTION_TEST_CAMPAGNEEEXECUTION(), j + CelulleAvecTexteRow);
2038:             j = j + CelulleAvecTexteRow;
2039:             }	
2040:             }
2041:             }
2042:             }		
2043:             nomFeuilles = workbook.getSheetNames();
2044:             if (selectionExportExigence == false) {
2045:             for (int g = 0; g < nomFeuilles.length; g++) {
2046:             if (nomFeuilles[g].equals(Language.getInstance().getText("Exigences"))) {
2047:             workbook.removeSheet(g);
2048:             }
2049:             }
2050:             }
2051:             nomFeuilles = workbook.getSheetNames();
2052:             if (selectionExportTest == false) {
2053:             for (int g = 0; g < nomFeuilles.length; g++) {
2054:             if (nomFeuilles[g].equals(Language.getInstance().getText("Tests"))) {
2055:             workbook.removeSheet(g);
2056:             }
2057:             }
2058:             }
2059:             nomFeuilles = workbook.getSheetNames();
2060:             if (selectionExportParametre == false) {
2061:             for (int g = 0; g < nomFeuilles.length; g++) {
2062:             if (nomFeuilles[g].equals(Language.getInstance().getText("Parametres"))) {
2063:             workbook.removeSheet(g);
2064:             }
2065:             }
2066:             }
2067:             nomFeuilles = workbook.getSheetNames();
2068:             if (selectionExportEnvironnement == false) {
2069:             for (int g = 0; g < nomFeuilles.length; g++) {
2070:             if (nomFeuilles[g].equals(Language.getInstance().getText("Environnements"))) {
2071:             workbook.removeSheet(g);
2072:             }
2073:             }
2074:             }
2075:             nomFeuilles = workbook.getSheetNames();
2076:             if (selectionExportCampagne == false) {
2077:             for (int g = 0; g < nomFeuilles.length; g++) {
2078:             if (nomFeuilles[g].equals(Language.getInstance().getText("Campagnes"))) {
2079:             workbook.removeSheet(g);
2080:             }
2081:             }
2082:             }
2083:             nomFeuilles = workbook.getSheetNames();
2084:             if (selectionExportExecutionCampagne == false) {
2085:             for (int g = 0; g < nomFeuilles.length; g++) {
2086:             if (nomFeuilles[g].equals(Language.getInstance().getText("Execution_campagnes"))) {
2087:             workbook.removeSheet(g);
2088:             }
2089:             }
2090:             }
2091:
2092:
2093:
2094:             // enregistre le classeur Excel
2095:             ecritEntete.closeWorkbook(selectionExportAnomalies);
2096:             }
2097:             */
2098:            /**
2099:             * Get ErreurEcritureXLS
2100:             * 
2101:             * @return ErreurEcritureXLS
2102:             */
2103:            public boolean getWriteErrorXLS() {
2104:                return isErreurEcritureXLS;
2105:            }
2106:
2107:            /**
2108:             * Set ErreurEcriturXLs to True
2109:             * 
2110:             * @return True
2111:             */
2112:            public boolean setErreurEcritureXLS() {
2113:                return true;
2114:            }
2115:
2116:            /**
2117:             * Function that create a XLS File
2118:             * 
2119:             * @param nomFichierSortie
2120:             *            Name of the XML File
2121:             * @return The real name of the XLS file génerated
2122:             */
2123:            public String createXlsFile(String nomFichierSortie) {
2124:
2125:                // Crée nom Fichier Excel a partir nom XML
2126:                nomFichierSortie = nomFichierSortie.substring(0,
2127:                        nomFichierSortie.lastIndexOf(".xml"))
2128:                        + ".xls";
2129:
2130:                // Tente de créer le fichier excel
2131:                fichierDeSortieXLS = new File(nomFichierSortie);
2132:                int i = 0;
2133:                while (fichierDeSortieXLS.exists()) {
2134:                    if (i == 0) {
2135:                        System.out.println(Language.getInstance().getText(
2136:                                "FileName_Already_Exists"));
2137:                        nomFichierSortie = nomFichierSortie.substring(0,
2138:                                nomFichierSortie.lastIndexOf("."))
2139:                                + Language.getInstance().getText("_")
2140:                                + Integer.toString(i) + ".xls";
2141:                    } else {
2142:                        nomFichierSortie = nomFichierSortie.substring(0,
2143:                                nomFichierSortie.lastIndexOf(Language
2144:                                        .getInstance().getText("_")))
2145:                                + Language.getInstance().getText("_")
2146:                                + Integer.toString(i) + ".xls";
2147:                    }
2148:
2149:                    fichierDeSortieXLS = new File(nomFichierSortie);
2150:                    i++;
2151:                }
2152:                System.out.println(Language.getInstance().getText(
2153:                        "Fichier_Sortie_XLS")
2154:                        + fichierDeSortieXLS.toString());
2155:                try {
2156:                    fichierDeSortieXLS.createNewFile();
2157:                } catch (IOException ex) {
2158:                    System.out.println(Language.getInstance().getText(
2159:                            "Erreur_Fichier_Sortie_XML")
2160:                            + fichierDeSortieXLS.toString());
2161:                    ex.printStackTrace();
2162:                }
2163:                return fichierDeSortieXLS.toString();
2164:
2165:            }
2166:
2167:            /*
2168:             * Function that only return the name of the XLS File @return Name of the
2169:             * XLS File
2170:             */
2171:            /**
2172:             * récupère fichierDeSortieXLS
2173:             * @return fichierDeSortieXLS
2174:             */
2175:            public String getfichierDeSortieXLS() {
2176:                return fichierDeSortieXLS.toString();
2177:            }
2178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.