Kenmegne
6 days ago 6494941037ae2670876de9940853d50538eb5129
move to new repo
74 files added
6908 ■■■■■ changed files
reporting-adhoc/nb-configuration.xml 18 ●●●●● patch | view | raw | blame | history
reporting-adhoc/pom.xml 65 ●●●●● patch | view | raw | blame | history
reporting-adhoc/reports/jasper/Dossier.jasper patch | view | raw | blame | history
reporting-adhoc/reports/jasper/DossierDetail.jasper patch | view | raw | blame | history
reporting-adhoc/reports/jrxml/Dossier.jrxml 1043 ●●●●● patch | view | raw | blame | history
reporting-adhoc/reports/jrxml/DossierDetail.jrxml 271 ●●●●● patch | view | raw | blame | history
reporting-adhoc/reports/pdf/baseArchive20240419154430.pdf patch | view | raw | blame | history
reporting-adhoc/reports/pdf/baseArchive20240606103904.pdf patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/App.java 96 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/annotations/PrintColumn.java 27 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/annotations/PrintList.java 27 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/dto/Column.java 43 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/dto/HeaderData.java 43 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/dto/PrintableColumn.java 33 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/dto/ReportConfiguration.java 48 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/Constantes.java 106 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/CustomField.java 110 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/DescriptionEtat.java 88 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/DescriptionSousEtat.java 81 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/DisplayCondition.java 53 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/ElementToDisplay.java 70 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/LargestWidth.java 59 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/MainReportDefinition.java 57 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/ProcessorElements.java 62 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/ReportDefinition.java 26 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/SubReportDefinition.java 50 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Border.java 112 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Component.java 104 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Image.java 34 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Label.java 23 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Line.java 42 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Paragraph.java 83 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/TextComponent.java 122 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/TextField.java 53 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/ValueElement.java 85 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/ComponentType.java 12 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/ElementType.java 39 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/Position.java 37 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/ReportOrientation.java 33 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/Section.java 13 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/ValueElementType.java 13 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/ColumnData.java 28 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/ColumnHeader.java 27 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/Layout.java 47 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/MainReport.java 208 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/PageFooter.java 17 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/PageHeader.java 19 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/Report.java 25 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/SubReport.java 157 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/Title.java 19 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/xml/ReportTag.java 86 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/process/GenerateJRXML.java 724 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/process/ParseXMLTemplate.java 1027 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/process/Processor.java 92 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/process/SecondProcessor.java 501 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/test/CategorieConstruct.java 98 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/test/CategorieDetailConstruct.java 93 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/test/EntrepriseConstruct.java 118 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/util/PdfUtil.java 55 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/util/PrintableColumnExtractor.java 115 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/resources/report-parts/groups.xml 12 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/resources/report-parts/page-properties.xml 10 ●●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/resources/report-parts/parameters.xml 1 ●●●● patch | view | raw | blame | history
reporting-adhoc/src/main/resources/report-parts/variables.xml 7 ●●●●● patch | view | raw | blame | history
reporting-adhoc/target/classes/.netbeans_automatic_build patch | view | raw | blame | history
reporting-adhoc/target/classes/report-parts/groups.xml 12 ●●●●● patch | view | raw | blame | history
reporting-adhoc/target/classes/report-parts/page-properties.xml 10 ●●●●● patch | view | raw | blame | history
reporting-adhoc/target/classes/report-parts/parameters.xml 1 ●●●● patch | view | raw | blame | history
reporting-adhoc/target/classes/report-parts/variables.xml 7 ●●●●● patch | view | raw | blame | history
reporting-adhoc/target/maven-archiver/pom.properties 5 ●●●●● patch | view | raw | blame | history
reporting-adhoc/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst 54 ●●●●● patch | view | raw | blame | history
reporting-adhoc/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst 52 ●●●●● patch | view | raw | blame | history
reporting-adhoc/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst patch | view | raw | blame | history
reporting-adhoc/target/test-classes/.netbeans_automatic_build patch | view | raw | blame | history
reporting-adhoc/nb-configuration.xml
New file
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
    <!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
    <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
        <!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
        <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform>
    </properties>
</project-shared-configuration>
reporting-adhoc/pom.xml
New file
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.megatim</groupId>
    <artifactId>reporting-adhoc</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <exec.mainClass>com.megatim.dynamic.reports.App</exec.mainClass>
    </properties>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.megatim.dynamic.reports.App</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id> <!-- this is used for inheritance merges -->
                        <phase>package</phase> <!-- bind to the packaging phase -->
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>6.19.1</version>
        </dependency>
        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports-fonts</artifactId>
            <version>6.19.1</version>
        </dependency>
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
            <groupId>com.megatim.horizon</groupId>
            <artifactId>horizon-reporting</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>
</project>
reporting-adhoc/reports/jasper/Dossier.jasper
Binary files differ
reporting-adhoc/reports/jasper/DossierDetail.jasper
Binary files differ
reporting-adhoc/reports/jrxml/Dossier.jrxml
New file
@@ -0,0 +1,1043 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Dossier" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="814" leftMargin="14" rightMargin="0" topMargin="4" bottomMargin="4" whenResourceMissingType="Key"  whenNoDataType="NoDataSection" uuid="336e3455-4d58-40aa-ad3a-8622391eb9ff">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="true"/>
    <parameter name="TITRE" class="java.lang.String"  isForPrompting="false"/>
    <parameter name="LOGO_CENTRE" class="java.lang.String"  isForPrompting="false"/>
    <parameter name="VERSION" class="java.lang.String"  isForPrompting="false"/>
    <field name="dateCreation" class="java.lang.String" >
        <fieldDescription><![CDATA[dateCreation]]></fieldDescription>
    </field>
    <field name="posteComptableArchive" class="java.lang.String" >
        <fieldDescription><![CDATA[posteComptableArchive]]></fieldDescription>
    </field>
    <field name="banqueArchive" class="java.lang.String" >
        <fieldDescription><![CDATA[banqueArchive]]></fieldDescription>
    </field>
    <field name="nbreDetails" class="java.lang.Integer" >
        <fieldDescription><![CDATA[nbreDetails]]></fieldDescription>
    </field>
    <field name="montant" class="java.lang.String" >
        <fieldDescription><![CDATA[montant]]></fieldDescription>
    </field>
    <field name="details" class="java.util.List" >
        <fieldDescription><![CDATA[details]]></fieldDescription>
    </field>
    <field name="statutDossier" class="java.lang.String" >
        <fieldDescription><![CDATA[statutDossier]]></fieldDescription>
    </field>
    <variable name="REPORT_PAGE" class="java.lang.Integer" resetType="None" incrementType="Page">
        <variableExpression><![CDATA[$V{PAGE_NUMBER}]]></variableExpression>
    </variable>
    <variable name="LINE_NUMBER" class="java.lang.Long" resetType="Group" resetGroup="Groupe1" calculation="Count">
        <variableExpression><![CDATA[Boolean.TRUE]]></variableExpression>
        <initialValueExpression><![CDATA[new Long(1)]]></initialValueExpression>
    </variable>
    <group name="Groupe1" isStartNewPage="true" minHeightToStartNewPage="60">
        <groupHeader>
            <band splitType="Immediate">
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
            </band>
        </groupHeader>
        <groupFooter>
            <band splitType="Immediate">
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
            </band>
        </groupFooter>
    </group>
     <title>
         <band height="211" splitType="Immediate"  >
             <property name="com.jaspersoft.studio.unit.height" value="px"/>
        <image scaleImage="FillFrame" hAlign="Center" vAlign="Middle">
            <reportElement x="0" y="1" width="813" height="62" uuid="0846f415-2676-4c1f-9c7b-2d5285964739">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
            <graphicElement fill="Solid"/>
            <imageExpression><![CDATA[$P{LOGO_CENTRE}]]></imageExpression>
        </image>
            <textField  isBlankWhenNull="true" textAdjust="CutText">
                 <reportElement x="1" y="80" width="813" height="32" isRemoveLineWhenBlank="false" forecolor="#000000"  isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="74e84f59-b587-42e7-ab7a-c898e566e084">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="16" isBold="true" isUnderline="true"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$P{TITRE}]]></textFieldExpression>
            </textField>
            <staticText>
                 <reportElement x="0" y="131" width="78" height="20" forecolor="#000000"  uuid="0f8b7bb1-e73e-4919-ba1d-eeeca1ae2916">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Montant Total]]></text>
            </staticText>
            <staticText>
                 <reportElement x="88" y="131" width="168" height="20" forecolor="#000000"  uuid="85cad382-1341-493d-9c37-b0b866f28d20">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[5555.69723]]></text>
            </staticText>
            <staticText>
                 <reportElement x="78" y="131" width="5" height="20" forecolor="#000000"  uuid="e9a4f0f2-4fa5-44b7-b55f-818d8555405d">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
            <staticText>
                 <reportElement x="0" y="151" width="78" height="20" forecolor="#000000"  uuid="520cbb07-17e6-4f66-9e38-953563c30a30">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Nombre Total]]></text>
            </staticText>
            <staticText>
                 <reportElement x="88" y="151" width="168" height="20" forecolor="#000000"  uuid="9e36eb17-a042-4808-8803-042f58d933e5">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[100]]></text>
            </staticText>
            <staticText>
                 <reportElement x="78" y="151" width="5" height="20" forecolor="#000000"  uuid="58bcd8c2-82bd-45af-8b12-309fe41c20c1">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
            <staticText>
                 <reportElement x="0" y="171" width="78" height="20" forecolor="#000000"  uuid="bc4849e2-f312-4271-8ed8-42bc9785ca12">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Date Début]]></text>
            </staticText>
            <staticText>
                 <reportElement x="88" y="171" width="168" height="20" forecolor="#000000"  uuid="1021ca23-f8d9-4c0c-91a5-3b628fabca3c">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Thu Jun 06 10:39:02 WAT 2024]]></text>
            </staticText>
            <staticText>
                 <reportElement x="78" y="171" width="5" height="20" forecolor="#000000"  uuid="af7bbd27-60fd-4606-b6b4-8255be27ea55">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
            <staticText>
                 <reportElement x="0" y="191" width="78" height="20" forecolor="#000000"  uuid="cd484297-66c4-4517-a695-7a4628bcd142">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Date Fin]]></text>
            </staticText>
            <staticText>
                 <reportElement x="88" y="191" width="168" height="20" forecolor="#000000"  uuid="48a9aaf6-8215-4034-a16b-dd3f0ebee83c">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Thu Jun 06 10:39:02 WAT 2024]]></text>
            </staticText>
            <staticText>
                 <reportElement x="78" y="191" width="5" height="20" forecolor="#000000"  uuid="a1cb155a-1200-42a3-a0ec-6462831b3ffc">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
            <staticText>
                 <reportElement x="595" y="131" width="54" height="20" forecolor="#000000"  uuid="b65e7914-5e6a-43a8-93e3-9b97684d70b9">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Edité le]]></text>
            </staticText>
            <staticText>
                 <reportElement x="659" y="131" width="168" height="20" forecolor="#000000"  uuid="b6d7d4d5-d956-4035-93dd-c1a0a0ef3f03">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Thu Jun 06 10:39:02 WAT 2024]]></text>
            </staticText>
            <staticText>
                 <reportElement x="649" y="131" width="5" height="20" forecolor="#000000"  uuid="685bb82a-0d27-4f70-9b14-045d7c0bbc6f">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
            <staticText>
                 <reportElement x="595" y="151" width="54" height="20" forecolor="#000000"  uuid="3181b12a-015b-48f9-a9b2-13e5a4f72f59">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Edité par]]></text>
            </staticText>
            <staticText>
                 <reportElement x="659" y="151" width="168" height="20" forecolor="#000000"  uuid="dd4b74c7-cfe6-4ca9-9e4c-c00e381c3485">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Thu Jun 06 10:39:02 WAT 2024]]></text>
            </staticText>
            <staticText>
                 <reportElement x="649" y="151" width="5" height="20" forecolor="#000000"  uuid="e470db74-3a7c-430c-adc6-175d7be9347a">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
        <image scaleImage="FillFrame" hAlign="Center" vAlign="Middle">
            <reportElement x="0" y="1" width="813" height="62" uuid="ab1c3b13-ed5f-4ef4-a89f-94ed1e588ebf">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
            <graphicElement fill="Solid"/>
            <imageExpression><![CDATA[$P{LOGO_CENTRE}]]></imageExpression>
        </image>
            <textField  isBlankWhenNull="true" textAdjust="CutText">
                 <reportElement x="1" y="80" width="813" height="32" isRemoveLineWhenBlank="false" forecolor="#000000"  isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="eb5d0bfe-0e58-40ba-ab48-1f01d318696e">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="16" isBold="true" isUnderline="true"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$P{TITRE}]]></textFieldExpression>
            </textField>
            <staticText>
                 <reportElement x="0" y="131" width="78" height="20" forecolor="#000000"  uuid="ea8e18a1-9126-439b-9222-016ae77ffcde">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Montant Total]]></text>
            </staticText>
            <staticText>
                 <reportElement x="88" y="131" width="168" height="20" forecolor="#000000"  uuid="941a4401-3dbc-44dd-8d41-41635d92dcc3">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[5555.69723]]></text>
            </staticText>
            <staticText>
                 <reportElement x="78" y="131" width="5" height="20" forecolor="#000000"  uuid="74e5d055-12e0-4f16-a488-74baa528da90">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
            <staticText>
                 <reportElement x="0" y="151" width="78" height="20" forecolor="#000000"  uuid="9cd14e54-4cc1-4e3e-a72e-34a5c742431c">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Nombre Total]]></text>
            </staticText>
            <staticText>
                 <reportElement x="88" y="151" width="168" height="20" forecolor="#000000"  uuid="a8a38b1b-c0c2-432d-94b0-577330492422">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[100]]></text>
            </staticText>
            <staticText>
                 <reportElement x="78" y="151" width="5" height="20" forecolor="#000000"  uuid="b605e546-6b6f-4fc2-906c-d58cc0c0c745">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
            <staticText>
                 <reportElement x="0" y="171" width="78" height="20" forecolor="#000000"  uuid="7c76d8ab-915d-4380-bf34-22c4d7e450f1">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Date Début]]></text>
            </staticText>
            <staticText>
                 <reportElement x="88" y="171" width="168" height="20" forecolor="#000000"  uuid="4e2e3e76-2b73-4e45-a40e-87834b8009d2">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Thu Jun 06 10:39:02 WAT 2024]]></text>
            </staticText>
            <staticText>
                 <reportElement x="78" y="171" width="5" height="20" forecolor="#000000"  uuid="811dd1b9-8424-4448-8d12-e3f6b7a48d30">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
            <staticText>
                 <reportElement x="0" y="191" width="78" height="20" forecolor="#000000"  uuid="58ddef6e-854a-433f-b255-1a211b08acd1">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Date Fin]]></text>
            </staticText>
            <staticText>
                 <reportElement x="88" y="191" width="168" height="20" forecolor="#000000"  uuid="904b9a2c-5ed5-4ba2-91e5-776c7e2273be">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Thu Jun 06 10:39:02 WAT 2024]]></text>
            </staticText>
            <staticText>
                 <reportElement x="78" y="191" width="5" height="20" forecolor="#000000"  uuid="78ba8e3b-ea1b-45f6-9366-ba8c4963e310">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
            <staticText>
                 <reportElement x="595" y="131" width="54" height="20" forecolor="#000000"  uuid="679ef903-d439-413e-a090-ddfad9ad07e5">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Edité le]]></text>
            </staticText>
            <staticText>
                 <reportElement x="659" y="131" width="168" height="20" forecolor="#000000"  uuid="836ed5e9-3bdb-40a9-ac04-5e85f9f2b8cf">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Thu Jun 06 10:39:02 WAT 2024]]></text>
            </staticText>
            <staticText>
                 <reportElement x="649" y="131" width="5" height="20" forecolor="#000000"  uuid="7df766ef-5d6d-4cc2-bc60-80ff8c140d39">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
            <staticText>
                 <reportElement x="595" y="151" width="54" height="20" forecolor="#000000"  uuid="0683ac38-a5e1-44e5-896c-140818d14835">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Edité par]]></text>
            </staticText>
            <staticText>
                 <reportElement x="659" y="151" width="168" height="20" forecolor="#000000"  uuid="e011cd7f-a6a7-4f85-995c-cff5f31d37dc">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Thu Jun 06 10:39:02 WAT 2024]]></text>
            </staticText>
            <staticText>
                 <reportElement x="649" y="151" width="5" height="20" forecolor="#000000"  uuid="8563dc8b-917d-4c38-a35e-7d7e9a51654b">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[:]]></text>
            </staticText>
         </band>
     </title>
     <pageHeader>
         <band height="30" splitType="Immediate"  >
         <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="16" y="0" width="700" height="20" isRemoveLineWhenBlank="false" forecolor="#000000"  isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="45879388-c3ab-4690-8e29-5cc2c5614106">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER} >1]]></printWhenExpression>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$P{TITRE}]]></textFieldExpression>
            </textField>
            <line>
                 <reportElement x="0" y="22" width="815" height="1" isRemoveLineWhenBlank="true" forecolor="#000000" uuid="67233608-55d6-423c-8925-0979a94bfa0d">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
<printWhenExpression><![CDATA[$V{PAGE_NUMBER} >1]]></printWhenExpression>
                </reportElement>
                <graphicElement>
                    <pen lineWidth="2.5" lineStyle="Solid"/>
                </graphicElement>
            </line>
         </band>
     </pageHeader>
     <columnHeader>
         <band height="19" splitType="Stretch"  >
         <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <staticText>
                 <reportElement x="0" y="0" width="38" height="19" forecolor="#000000"  uuid="2ebddbed-5d62-4214-a4a9-8fa077485647">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[N°]]></text>
            </staticText>
            <staticText>
                 <reportElement x="38" y="0" width="111" height="19" forecolor="#000000"  uuid="2098e036-b361-46f5-abed-92d670d948b5">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[BANQUE]]></text>
            </staticText>
            <staticText>
                 <reportElement x="149" y="0" width="111" height="19" forecolor="#000000"  uuid="f3f8f806-5736-40ff-beb5-353f62f49a1c">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[POSTE COMPTABLE]]></text>
            </staticText>
            <staticText>
                 <reportElement x="260" y="0" width="111" height="19" forecolor="#000000"  uuid="0f4eecca-ce8f-4a8e-aca5-75ac8a37cd89">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[STATUT]]></text>
            </staticText>
            <staticText>
                 <reportElement x="371" y="0" width="111" height="19" forecolor="#000000"  uuid="38e688b8-f268-412b-84ce-35d2802ca679">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[NATURE]]></text>
            </staticText>
            <staticText>
                 <reportElement x="482" y="0" width="111" height="19" forecolor="#000000"  uuid="e23e7bd4-9831-4e29-8f86-87efffa5213a">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[MONTANT]]></text>
            </staticText>
            <staticText>
                 <reportElement x="593" y="0" width="111" height="19" forecolor="#000000"  uuid="c72c7980-5a99-4c25-b1dd-77769d06ed11">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[NBRE DETAILS]]></text>
            </staticText>
            <staticText>
                 <reportElement x="704" y="0" width="114" height="19" forecolor="#000000"  uuid="c37323ac-ac19-492c-993b-f58f5a297e1d">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[DATE CREATION]]></text>
            </staticText>
         </band>
     </columnHeader>
     <detail>
         <band height="19" splitType="Prevent"  >
         <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="0" y="0" width="38" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="5c29fed6-1057-43fa-8ba1-d932cca7a689">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[String.valueOf($V{LINE_NUMBER})]]></textFieldExpression>
            </textField>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="38" y="0" width="111" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="493d89d8-1167-4375-82de-20dd37a645bd">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$F{banqueArchive}]]></textFieldExpression>
            </textField>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="149" y="0" width="111" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="ca1c8c48-2270-47f7-964a-962c6873904e">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$F{posteComptableArchive}]]></textFieldExpression>
            </textField>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="260" y="0" width="111" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="acf27d88-e995-4419-ac49-89868ecf2a2d">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$F{posteComptableArchive}]]></textFieldExpression>
            </textField>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="371" y="0" width="111" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="d6ce998f-28d9-473d-a8ba-7d89460b70ae">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$F{statutDossier}]]></textFieldExpression>
            </textField>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="482" y="0" width="111" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="9b8059e3-b271-413c-a1ba-1d54966dd50b">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$F{montant}]]></textFieldExpression>
            </textField>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="593" y="0" width="111" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="6be6eac7-b195-4edf-b784-27ccff2acf38">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$F{nbreDetails}]]></textFieldExpression>
            </textField>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="704" y="0" width="114" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="d2b19276-1002-444d-9fa0-8f0a305b6e68">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$F{dateCreation}]]></textFieldExpression>
            </textField>
         </band>
         <band height="38" splitType="Immediate"  >
             <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <subreport isUsingCache="true" runToBottom="true" overflowType="Stretch" >
                <reportElement stretchType="ElementGroupHeight" x="0" y="0" width="780" height="38" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="0f90bb2d-8cc2-43e2-82f8-e8017b4c06e0">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{details})]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "DossierDetail.jasper"]]></subreportExpression>
            </subreport>
        </band>
     </detail>
     <pageFooter>
         <band height="35" splitType="Immediate" >
         <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <line>
                 <reportElement x="0" y="10" width="814" height="1" isRemoveLineWhenBlank="true" forecolor="#000000" uuid="ae8a306f-387b-4bab-a652-79ed70b8f2cb">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <graphicElement>
                    <pen lineWidth="2.5" lineStyle="Solid"/>
                </graphicElement>
            </line>
            <textField  isBlankWhenNull="true" textAdjust="CutText">
                 <reportElement x="2" y="11" width="268" height="20" isRemoveLineWhenBlank="false" forecolor="#000000"  isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="25a89e48-9e5c-45bf-ad87-fa5164d5f9a6">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="8" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$P{VERSION}]]></textFieldExpression>
            </textField>
            <staticText>
                 <reportElement x="370" y="11" width="100" height="20" forecolor="#000000"  uuid="07790b9f-2a76-45d8-8f12-592a406cb690">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="6" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[By MEGATIM]]></text>
            </staticText>
            <textField  evaluationTime="Auto"  isBlankWhenNull="true" textAdjust="CutText">
                 <reportElement x="745" y="11" width="87" height="20" isRemoveLineWhenBlank="false" forecolor="#000000"  isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="57419f3d-09c2-48ff-ae25-6feed0cdc80c">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="8" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[" Page "+String.valueOf($V{REPORT_PAGE})+" / "+String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
            </textField>
         </band>
     </pageFooter>
</jasperReport>
reporting-adhoc/reports/jrxml/DossierDetail.jrxml
New file
@@ -0,0 +1,271 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="DossierDetail" pageWidth="700" pageHeight="500" orientation="Landscape" columnWidth="600" leftMargin="14" rightMargin="0" topMargin="8" bottomMargin="11" whenResourceMissingType="Key"  whenNoDataType="NoDataSection" uuid="605f95ec-9bc5-48bc-b430-efbb5ef2ceef">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="true"/>
    <field name="reference" class="java.lang.String" >
        <fieldDescription><![CDATA[reference]]></fieldDescription>
    </field>
    <field name="dateDetail" class="java.lang.String" >
        <fieldDescription><![CDATA[dateDetail]]></fieldDescription>
    </field>
    <field name="systemePaiement" class="java.lang.String" >
        <fieldDescription><![CDATA[systemePaiement]]></fieldDescription>
    </field>
    <field name="montant" class="java.math.BigDecimal" >
        <fieldDescription><![CDATA[montant]]></fieldDescription>
    </field>
    <variable name="REPORT_PAGE" class="java.lang.Integer" resetType="None" incrementType="Page">
        <variableExpression><![CDATA[$V{PAGE_NUMBER}]]></variableExpression>
    </variable>
    <variable name="LINE_NUMBER" class="java.lang.Long" resetType="Group" resetGroup="Groupe1" calculation="Count">
        <variableExpression><![CDATA[Boolean.TRUE]]></variableExpression>
        <initialValueExpression><![CDATA[new Long(1)]]></initialValueExpression>
    </variable>
    <group name="Groupe1" isStartNewPage="true" minHeightToStartNewPage="60">
        <groupHeader>
            <band splitType="Immediate">
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
            </band>
        </groupHeader>
        <groupFooter>
            <band splitType="Immediate">
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
            </band>
        </groupFooter>
    </group>
     <pageHeader>
         <band height="20" splitType="Immediate"  >
         <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <staticText>
                 <reportElement x="0" y="0" width="150" height="20" forecolor="#000000"  uuid="6f376ed3-c299-40f6-bc3b-fb32b0962d08">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[Liste détails virement]]></text>
            </staticText>
         </band>
     </pageHeader>
     <columnHeader>
         <band height="19" splitType="Stretch"  >
         <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <staticText>
                 <reportElement x="0" y="0" width="38" height="19" forecolor="#000000"  uuid="ca5498a9-0d92-4c4c-98b1-21c4b0300b57">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[N°]]></text>
            </staticText>
            <staticText>
                 <reportElement x="38" y="0" width="159" height="19" forecolor="#000000"  uuid="36d4d583-6015-4a39-86b7-fe2e77304df8">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[REFERENCE]]></text>
            </staticText>
            <staticText>
                 <reportElement x="197" y="0" width="159" height="19" forecolor="#000000"  uuid="89505e6a-8167-4d74-9d5c-42ddd16288b1">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[SYSTEME PAIEMENT]]></text>
            </staticText>
            <staticText>
                 <reportElement x="356" y="0" width="159" height="19" forecolor="#000000"  uuid="4cf82043-e285-47b7-9ace-65c71786c54b">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[MONTANT]]></text>
            </staticText>
            <staticText>
                 <reportElement x="515" y="0" width="161" height="19" forecolor="#000000"  uuid="e7523ae2-1ba8-4710-a7e5-e5928d67bb9c">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="true" isUnderline="false"/>
                    <paragraph lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <text><![CDATA[DATE OPERATION]]></text>
            </staticText>
         </band>
     </columnHeader>
     <detail>
         <band height="19" splitType="Immediate"  >
         <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="0" y="0" width="38" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="9096d398-8129-48c7-ba7b-e3d3f05e8d50">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[String.valueOf($V{LINE_NUMBER})]]></textFieldExpression>
            </textField>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="38" y="0" width="159" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="c4e1afd2-9ccc-4d6f-81f1-5d6532d77278">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$F{reference}]]></textFieldExpression>
            </textField>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="197" y="0" width="159" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="1d304c34-2d86-41ee-80c2-2a1cdfd1c238">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$F{systemePaiement}]]></textFieldExpression>
            </textField>
            <textField  pattern="#,##0.###;(#,##0.###-)"  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="356" y="0" width="159" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="e0e5f8c5-4177-4c9f-835a-9cc61f57e3f0">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$F{montant}]]></textFieldExpression>
            </textField>
            <textField  isBlankWhenNull="true" textAdjust="StretchHeight">
                 <reportElement x="515" y="0" width="161" height="19" isRemoveLineWhenBlank="false" forecolor="#000000"  stretchType="ElementGroupHeight" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="f50923c0-0e3e-453d-a1c9-c83d51674b9a">
                    <property name="com.jaspersoft.studio.unit.x" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box>
                    <pen lineWidth="1.0" lineStyle="Solid"  lineColor="#000000" />
                    <leftPen lineWidth="0.5"/>
                    <bottomPen lineWidth="0.5"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Serif" size="10" isBold="false" isUnderline="false"/>
                    <paragraph lineSpacing="1_1_2" lineSpacingSize="0.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" />
                </textElement>
                <textFieldExpression><![CDATA[$F{dateDetail}]]></textFieldExpression>
            </textField>
         </band>
     </detail>
</jasperReport>
reporting-adhoc/reports/pdf/baseArchive20240419154430.pdf
Binary files differ
reporting-adhoc/reports/pdf/baseArchive20240606103904.pdf
Binary files differ
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/App.java
New file
@@ -0,0 +1,96 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
 */
package com.megatim.reporting.adhoc;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.util.JRLoader;
/**
 *
 * @author ASUS
 */
public class App {
    public final static File templateListe = new File("C:\\Users\\ASUS\\Documents\\templateEtats.xml");
    public final static File templateDetail = new File("C:\\Users\\ASUS\\Documents\\templateEtatsDetail.xml");
    public static void main(String[] args) {
        String str = "\t\tmoi     hghruhrih         \niroriotor\naem\t\tp\t\t";
        String result = str.trim()
                .replaceAll("(?U)\\s+", " ");
//                .replaceAll("(?U)\\G\\s", "");
        System.out.println("----------------- before ----------------------------");
        System.out.println(str);
        System.out.println("--------------------after-------------------------");
        System.out.println("begin" + result + "end");
//        String jrxmlPath = "C:\\Users\\ASUS\\Documents\\etats\\etats_horizon";
//        String pdfPath = "C:\\Users\\ASUS\\Documents\\etats\\etats_horizon\\pdfs";
//        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
//
//        try {
//            String jasperFile = new Processor().process(new CategorieDetailConstruct().construct(jrxmlPath));
////            String jasperFile = new Processor().process(templateDetail, new ComiteDetailConstruct().construct(jrxmlPath));
//
//            List<ComiteRapport> liste = ComiteDataSource.createBeanCollection();
//
//            HashMap<String, Object> map = new HashMap<>();
//            map.put("MONTANT_TOTAL", new BigDecimal("642555.36915"));
//            map.put("TITRE", "LISTE DES ENTREPRISES");
//            map.put("LOGIN_UTILISATEUR", "Mela");
//            map.put("VERSION", "HORIZON");
//            map.put("LOGO_CENTRE", jrxmlPath + "\\images\\logo.jpg");
//            map.put("NOMBRE_TOTAL", liste.size() + "");
//            map.put("SUBREPORT_DIR", jrxmlPath + File.separator);
//
//            genererFichierPdf(liste, Paths.get(pdfPath, "ComiteDetail" + dtf.format(LocalDateTime.now()) + ".pdf").toString(),
//                    jasperFile, map);
//        } catch (Exception ex) {
//            Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
//        }
    }
    public static File genererFichierPdf(List<?> datas, String pdfFile, String reportFilePath, Map params) throws Exception {
        // Creation d'un File sur le fichier
        File reportFile = new File(reportFilePath);
        File fichierGenerer = new File(pdfFile);
        //On cree le fichier s'ile n'existe pas
        if (!fichierGenerer.exists()) {
            //On cree le fichier
            fichierGenerer.createNewFile();
        }
        // Chargement du Rapport
        JasperReport report = null;
        // Etat rempli
        JasperPrint jasperPrint = null;
        // Chargement du report
        report = (JasperReport) JRLoader.loadObject(reportFile);
        jasperPrint = JasperFillManager.fillReport(report, params, new JRBeanCollectionDataSource(datas, false));
        OutputStream output = new FileOutputStream(fichierGenerer);
        JasperExportManager.exportReportToPdfStream(jasperPrint, output);
        output.close();
        return fichierGenerer;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/annotations/PrintColumn.java
New file
@@ -0,0 +1,27 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
 */
package com.megatim.reporting.adhoc.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
 *
 * @author ASUS
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface PrintColumn {
    //libellé ou titre de la colonne lors de l'affichage
    public String libelle();
    public int rang() default 0;
    public int width() default 0;
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/annotations/PrintList.java
New file
@@ -0,0 +1,27 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
 */
package com.megatim.reporting.adhoc.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
 *
 * @author ASUS
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface PrintList {
    //libellé ou titre de la colonne lors de l'affichage
    public String titre();
    public int rang() default 0;
    public Class<?> classe();
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/dto/Column.java
New file
@@ -0,0 +1,43 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.dto;
/**
 *
 * @author ASUS
 */
public class Column {
    private String libelle; // Label Ã  utiliser dans le ColumnHeader pour ce champ
    private int rang;
    private int width;
    public String getLibelle() {
        return libelle;
    }
    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }
    public int getRang() {
        return rang;
    }
    public void setRang(int rang) {
        this.rang = rang;
    }
    public int getWidth() {
        return width;
    }
    public void setWidth(int width) {
        this.width = width;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/dto/HeaderData.java
New file
@@ -0,0 +1,43 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.dto;
/**
 *
 * @author ASUS
 */
public class HeaderData {
    private String libelle;
    private String value;
    private String position = "GAUCHE";
    public String getLibelle() {
        return libelle;
    }
    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getPosition() {
        return position;
    }
    public void setPosition(String position) {
        this.position = position;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/dto/PrintableColumn.java
New file
@@ -0,0 +1,33 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.dto;
/**
 *
 * @author ASUS
 */
public class PrintableColumn {
    private String libelle;
    private String description;
    public String getLibelle() {
        return libelle;
    }
    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/dto/ReportConfiguration.java
New file
@@ -0,0 +1,48 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.dto;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author ASUS
 */
public class ReportConfiguration<U> {
    private U searchEntity;
    private String title;
    private final List<Column> columns = new ArrayList<>();
    private final List<HeaderData> headerDatas = new ArrayList<>();
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public List<Column> getColumns() {
        return columns;
    }
    public List<HeaderData> getHeaderDatas() {
        return headerDatas;
    }
    public U getSearchEntity() {
        return searchEntity;
    }
    public void setSearchEntity(U searchEntity) {
        this.searchEntity = searchEntity;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/Constantes.java
New file
@@ -0,0 +1,106 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo;
/**
 *
 * @author ASUS
 */
public class Constantes {
    public static final String ATTRIBUTE_X = "x";
    public static final String ATTRIBUTE_Y = "y";
    public static final String ATTRIBUTE_DEFAULT_VALUE = "defaultValue";
    public static final String ATTRIBUTE_BOLD = "bold";
    public static final String ATTRIBUTE_UNDERLINE = "underLine";
    public static final String ATTRIBUTE_FONT_NAME = "fontName";
    public static final String ATTRIBUTE_LEFT_BORDER = "leftBorder";
    public static final String ATTRIBUTE_TOP_BORDER = "topBorder";
    public static final String ATTRIBUTE_RIGHT_BORDER = "rightBorder";
    public static final String ATTRIBUTE_BOTTOM_BORDER = "bottomBorder";
    public static final String ATTRIBUTE_H_ALIGN = "hAlign";
    public static final String ATTRIBUTE_V_ALIGN = "vAlign";
    public static final String ATTRIBUTE_NAME = "name";
    public static final String ATTRIBUTE_DATASOURCE = "datasource";
    public static final String ATTRIBUTE_STYLE = "style";
    public static final String ATTRIBUTE_COLUMN_STYLE = "columnStyle";
    public static final String ATTRIBUTE_SPLIT_TYPE = "splitType";
    public static final String ATTRIBUTE_STRETCH_TYPE = "stretchType";
    public static final String ATTRIBUTE_CLASSE = "classe";
    public static final String ATTRIBUTE_PATTERN = "pattern";
    public static final String ATTRIBUTE_VALUE = "value";
    public static final String ATTRIBUTE_TEXT_ADJUST = "textAdjust";
    public static final String ATTRIBUTE_IS_PRINT_IN_FIRST_WHOLE_BAND = "isBlankWhenNull";
    public static final String ATTRIBUTE_IS_PRINT_WHEN_DETAIL_OVER_FLOWS = "isPrintInFirtWholeBand";
    public static final String ATTRIBUTE_IS_BLANK_WHEN_NULL = "isBlankWhenNull";
    public static final String ATTRIBUTE_WIDTH = "width";
    public static final String ATTRIBUTE_PAGE_WIDTH = "pageWidth";
    public static final String ATTRIBUTE_HEIGHT = "height";
    public static final String ATTRIBUTE_PAGE_HEIGHT = "pageHeight";
    public static final String ATTRIBUTE_ORIENTATION = "orientation";
    public static final String ATTRIBUTE_LEFT_MARGIN = "leftMargin";
    public static final String ATTRIBUTE_TOP_MARGIN = "topMargin";
    public static final String ATTRIBUTE_BOTTOM_MARGIN = "bottomMargin";
    public static final String ATTRIBUTE_RIGHT_MARGIN = "rightMargin";
    public static final String ATTRIBUTE_FORE_COLOR = "forecolor";
    public static final String ATTRIBUTE_LINE_COLOR = "lineColor";
    public static final String ATTRIBUTE_LINE_WIDTH = "lineWidth";
    public static final String ATTRIBUTE_LINE_STYLE = "lineStyle";
    public static final String ATTRIBUTE_SIZE = "size";
    public static final String ATTRIBUTE_LEFT_INDENT = "leftIndent";
    public static final String ATTRIBUTE_RIGHT_INDENT = "rightIndent";
    public static final String ATTRIBUTE_RIGHT_PADDING = "rightPadding";
    public static final String ATTRIBUTE_LEFT_PADDING = "leftPadding";
    public static final String ATTRIBUTE_TOP_PADDING = "topPadding";
    public static final String ATTRIBUTE_BOTTOM_PADDING = "bottomPadding";
    public static final String ATTRIBUTE_LINE_SPACING = "lineSpacing";
    public static final String ATTRIBUTE_SPACING_BEFORE = "spacingBefore";
    public static final String ATTRIBUTE_SPACING_AFTER = "spacingAfter";
    public static final String ATTRIBUTE_LINE_SPACING_SIZE = "lineSpacingSize";
    public static final String ATTRIBUTE_FIRST_LINE_INDENT = "firstLineIndent";
    public static final String ATTRIBUTE_BAND_STYLE = "bandStyle";
    public static final String ATTRIBUTE_RUN_TO_BOTTOM = "runToBottom";
    public static final String ATTRIBUTE_USING_CACHE = "usingCache";
    public static final String ATTRIBUTE_OVERFLOW_TYPE = "overflowType";
    public static final String ATTRIBUTE_REMOVE_LINE_WHEN_BLANK = "removeLineWhenBlank";
    public static final String ATTRIBUTE_DISPLAY_CONDITION = "displayCondition";
    public static final String ATTRIBUTE_OPERAND_TYPE = "operandType";
    public static final String ATTRIBUTE_LEFT_OPERAND = "leftOperand";
    public static final String ATTRIBUTE_OPERATOR = "operator";
    public static final String ATTRIBUTE_RIGHT_OPERAND = "rightOperator";
    public static final String ATTRIBUTE_PAGE_TITLE_STYLE = "pageTitleStyle";
    public static final String ATTRIBUTE_SCALE_IMAGE = "scaleImage";
    public static final String ATTRIBUTE_COLUMN_WIDTH = "columnWidth";
    public static final String OPERAND_TYPE_VARIABLE = "variable";
    public static final String OPERAND_TYPE_PARAMETER = "parameter";
    public static final String OPERAND_TYPE_FIELD = "field";
    public static final String TAG_REPORT = "report";
    public static final String TAG_SUB_REPORT = "subReport";
    public static final String TAG_TITLE = "title";
    public static final String TAG_IMAGE = "image";
    public static final String TAG_PARAMETER = "parameter";
    public static final String TAG_TEXT_FIELD = "textField";
    public static final String TAG_LABEL = "label";
    public static final String TAG_GENERATE = "GENERATE";
    public static final String TAG_PAGE_HEADER = "pageHeader";
    public static final String TAG_PAGE_FOOTER = "pageFooter";
    public static final String TAG_COLUMN_HEADER = "columnHeader";
    public static final String TAG_COLUMN_DATA = "columnData";
    public static final String TAG_FIELD = "field";
    public static final String TAG_LINE = "line";
    public static final String TAG_LINE_NUMBER = "lineNumber";
    public static final String TAG_TEXT = "text";
    public static final String TAG_PAGE_NUMBER = "pageNumber";
    public static String V_ALIGN_MIDDLE  = "Middle";
    public static String H_ALIGN_LEFT  = "Left";
    public static String H_ALIGN_CENTER  = "Center";
    public static String H_ALIGN_RIGHT  = "Right";
    public static final int LABEL_HEIGHT = 20;
    public static final int DEUX_POINTS_WIDTH = 5;
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/CustomField.java
New file
@@ -0,0 +1,110 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo;
/**
 *
 * @author ASUS
 */
public class CustomField {
    private String libelle; // Label Ã  utiliser dans le ColumnHeader pour ce champ
    private String name; // Nom du champ
    private Class<?> classe = java.lang.String.class;
    private int rang;
    private int width;
    private String pattern;
    public CustomField() {
    }
    public CustomField(String libelle, String name) {
        this.libelle = libelle;
        this.name = name;
    }
    @Override
    public String toString() {
        return libelle ;
    }
    public String getLibelle() {
        return libelle;
    }
    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Class<?> getClasse() {
        return classe;
    }
    public void setClasse(Class<?> classe) {
        if (classe.getCanonicalName().equals(int.class.getCanonicalName())) {
            this.classe = java.lang.Integer.class;
        } else if (classe.getCanonicalName().equals(long.class.getCanonicalName())) {
            this.classe = java.lang.Long.class;
        } else if (classe.getCanonicalName().equals(boolean.class.getCanonicalName())) {
            this.classe = java.lang.Boolean.class;
        } else if (classe.getCanonicalName().equals(float.class.getCanonicalName())) {
            this.classe = java.lang.Float.class;
        }  else if (classe.getCanonicalName().equals(double.class.getCanonicalName())) {
            this.classe = java.lang.Double.class;
        }else if (classe.getCanonicalName().equals(char.class.getCanonicalName())) {
            this.classe = java.lang.Character.class;
        } else if (classe.getCanonicalName().equals(byte.class.getCanonicalName())) {
            this.classe = java.lang.Byte.class;
        } else {
            this.classe = classe;
        }
    }
    public int getRang() {
        return rang;
    }
    public void setRang(int rang) {
        this.rang = rang;
    }
    public int getWidth() {
        return width;
    }
    public void setWidth(int width) {
        this.width = width;
    }
    public String getPattern() {
        return pattern;
    }
    public void setPattern(String pattern) {
        this.pattern = pattern;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/DescriptionEtat.java
New file
@@ -0,0 +1,88 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author ASUS
 */
public class DescriptionEtat {
    private boolean haveLineNumber = true; // renseigne si le rapport doit prévoir une colonne pour le numéro de ligne
    private String reportName; // Nom que va porter le fichier de sortie du jrxml et du jasper
    private List<DescriptionSousEtat> subReportDescriptions = new ArrayList<>();
    private final List<CustomField> fieldsToDisplay = new ArrayList<>(); // Liste des champs dont vont provenir les données
    private final List<ElementToDisplay> elementsToDisplay = new ArrayList<>(); // Liste des labels Ã  insérer dans l'état
    private File templateFile;//Fichier template xml qui contient la description minimale de l'état
    private String repositoryFolder; //Repertoire où seront stockés les fichiers jrxml et jasper
    private boolean detail; //renseigne si l'état sous forme de "liste" ou de "détail"
    public boolean isHaveLineNumber() {
        return haveLineNumber;
    }
    public void setHaveLineNumber(boolean haveLineNumber) {
        this.haveLineNumber = haveLineNumber;
    }
    public String getReportName() {
        return reportName;
    }
    public void setReportName(String reportName) {
        this.reportName = reportName;
    }
    public List<CustomField> getFieldsToDisplay() {
        return fieldsToDisplay;
    }
    public File getTemplateFile() {
        return templateFile;
    }
    public void setTemplateFile(File templateFile) {
        this.templateFile = templateFile;
    }
    public String getRepositoryFolder() {
        return repositoryFolder;
    }
    public void setRepositoryFolder(String repositoryFolder) {
        this.repositoryFolder = repositoryFolder;
    }
    public List<ElementToDisplay> getElementsToDisplay() {
        return elementsToDisplay;
    }
    public List<DescriptionSousEtat> getSubReportDescriptions() {
        return subReportDescriptions;
    }
    public void setSubReportDescriptions(List<DescriptionSousEtat> subReportDescriptions) {
        this.subReportDescriptions = subReportDescriptions;
    }
    public boolean isDetail() {
        return detail;
    }
    public void setDetail(boolean detail) {
        this.detail = detail;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/DescriptionSousEtat.java
New file
@@ -0,0 +1,81 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author ASUS
 */
public class DescriptionSousEtat {
    private int rangSousEtat;
    private CustomField dataField;// champ de type liste qui contient les données du sous-état
    private boolean haveLineNumber = true; // renseigne si le rapport doit une doit une colonne pour le numéro de ligne
    private String subReportName; // Nom que va porter le fichier de sortie du jrxml et du jasper
    private final List<CustomField> fieldsToDisplay = new ArrayList<>(); // Liste des champs Ã  afficher dans le sous-rapport
    private List<ElementToDisplay> elementsToDisplay = new ArrayList<>(); // Liste des labels Ã  insérer dans le sous-état
    private String reportTitle;
    public int getRangSousEtat() {
        return rangSousEtat;
    }
    public void setRangSousEtat(int rangSousEtat) {
        this.rangSousEtat = rangSousEtat;
    }
    public boolean isHaveLineNumber() {
        return haveLineNumber;
    }
    public void setHaveLineNumber(boolean haveLineNumber) {
        this.haveLineNumber = haveLineNumber;
    }
    public String getSubReportName() {
        return subReportName;
    }
    public void setSubReportName(String subReportName) {
        this.subReportName = subReportName;
    }
    public List<ElementToDisplay> getElementsToDisplay() {
        return elementsToDisplay;
    }
    public void setElementsToDisplay(List<ElementToDisplay> elementsToDisplay) {
        this.elementsToDisplay = elementsToDisplay;
    }
    public List<CustomField> getFieldsToDisplay() {
        return fieldsToDisplay;
    }
    public CustomField getDataField() {
        return dataField;
    }
    public void setDataField(CustomField dataField) {
        this.dataField = dataField;
    }
    public String getReportTitle() {
        return reportTitle;
    }
    public void setReportTitle(String reportTitle) {
        this.reportTitle = reportTitle;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/DisplayCondition.java
New file
@@ -0,0 +1,53 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.dynamic.reports.pojo;
/**
 *
 * @author ASUS
 */
public class DisplayCondition {
    private String operandType;
    private String leftOperand;
    private String rightOperand;
    private String operator;
    public String getOperandType() {
        return operandType;
    }
    public void setOperandType(String operandType) {
        this.operandType = operandType;
    }
    public String getLeftOperand() {
        return leftOperand;
    }
    public void setLeftOperand(String leftOperand) {
        this.leftOperand = leftOperand;
    }
    public String getRightOperand() {
        return rightOperand;
    }
    public void setRightOperand(String rightOperand) {
        this.rightOperand = rightOperand;
    }
    public String getOperator() {
        return operator;
    }
    public void setOperator(String operator) {
        this.operator = operator;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/ElementToDisplay.java
New file
@@ -0,0 +1,70 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo;
import com.megatim.reporting.adhoc.pojo.enums.ElementType;
import com.megatim.reporting.adhoc.pojo.enums.Position;
import com.megatim.reporting.adhoc.pojo.enums.Section;
/**
 * Pojo permettant de stocker les labels (provenant de la vue) Ã  insérer dans un Ã©tat
 * @author ASUS
 */
public class ElementToDisplay {
    private String libelle;
    private String value;
    private Position position = Position.LEFT;
    private Section section = Section.TITLE;
    private ElementType elementType = ElementType.TEXTE_STATIQUE;
    public ElementToDisplay(String libelle, String value) {
        this.libelle = libelle;
        this.value = value;
    }
    public String getLibelle() {
        return libelle;
    }
    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public Position getPosition() {
        return position;
    }
    public void setPosition(Position position) {
        this.position = position;
    }
    public Section getSection() {
        return section;
    }
    public void setSection(Section section) {
        this.section = section;
    }
    public ElementType getElementType() {
        return elementType;
    }
    public void setElementType(ElementType elementType) {
        this.elementType = elementType;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/LargestWidth.java
New file
@@ -0,0 +1,59 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.dynamic.reports.pojo;
/**
 * Pojo permettant de stocker la longueur adéquate des labels de la section titre
 * @author ASUS
 */
public class LargestWidth {
    private int leftLargestKey;
    private int leftLargestValue;
    private int rightLargestKey;
    private int rightLargestValue;
    public LargestWidth(int leftLargestKey, int leftLargestValue, int rightLargestKey, int rightLargestValue) {
        this.leftLargestKey = leftLargestKey;
        this.leftLargestValue = leftLargestValue;
        this.rightLargestKey = rightLargestKey;
        this.rightLargestValue = rightLargestValue;
    }
    public int getLeftLargestKey() {
        return leftLargestKey;
    }
    public void setLeftLargestKey(int leftLargestKey) {
        this.leftLargestKey = leftLargestKey;
    }
    public int getLeftLargestValue() {
        return leftLargestValue;
    }
    public void setLeftLargestValue(int leftLargestValue) {
        this.leftLargestValue = leftLargestValue;
    }
    public int getRightLargestKey() {
        return rightLargestKey;
    }
    public void setRightLargestKey(int rightLargestKey) {
        this.rightLargestKey = rightLargestKey;
    }
    public int getRightLargestValue() {
        return rightLargestValue;
    }
    public void setRightLargestValue(int rightLargestValue) {
        this.rightLargestValue = rightLargestValue;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/MainReportDefinition.java
New file
@@ -0,0 +1,57 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author ASUS
 */
public class MainReportDefinition {
    protected boolean haveLineNumber = true; // renseigne si le rapport doit une doit une colonne pour le numéro de ligne
    protected String reportName; // Nom que va porter le fichier de sortie du jrxml et du jasper
    protected boolean detail;
    protected final List<CustomField> customFields = new ArrayList<>(); // Liste des champs dont vont probenir les données
    protected final List<ElementToDisplay> elementsToDisplay = new ArrayList<>(); // Liste des labels Ã  insérer dans l'état
    public boolean isHaveLineNumber() {
        return haveLineNumber;
    }
    public void setHaveLineNumber(boolean haveLineNumber) {
        this.haveLineNumber = haveLineNumber;
    }
    public String getReportName() {
        return reportName;
    }
    public void setReportName(String reportName) {
        this.reportName = reportName;
    }
    public List<CustomField> getCustomFields() {
        return customFields;
    }
    public List<ElementToDisplay> getElementsToDisplay() {
        return elementsToDisplay;
    }
    public boolean isDetail() {
        return detail;
    }
    public void setDetail(boolean detail) {
        this.detail = detail;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/ProcessorElements.java
New file
@@ -0,0 +1,62 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo;
import java.io.File;
/**
 *
 * @author ASUS
 */
public class ProcessorElements {
    private File templateFile;
    private String jrxmlFolder;
    private String jasperFolder;
    private ReportDefinition reportDefinition;
    public ProcessorElements(File templateFile, String jrxmlFolder, String jasperFolder, ReportDefinition reportDefinition) {
        this.templateFile = templateFile;
        this.jrxmlFolder = jrxmlFolder;
        this.jasperFolder = jasperFolder;
        this.reportDefinition = reportDefinition;
    }
    public File getTemplateFile() {
        return templateFile;
    }
    public void setTemplateFile(File templateFile) {
        this.templateFile = templateFile;
    }
    public String getJrxmlFolder() {
        return jrxmlFolder;
    }
    public void setJrxmlFolder(String jrxmlFolder) {
        this.jrxmlFolder = jrxmlFolder;
    }
    public String getJasperFolder() {
        return jasperFolder;
    }
    public void setJasperFolder(String jasperFolder) {
        this.jasperFolder = jasperFolder;
    }
    public ReportDefinition getReportDefinition() {
        return reportDefinition;
    }
    public void setReportDefinition(ReportDefinition reportDefinition) {
        this.reportDefinition = reportDefinition;
    }
    }
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/ReportDefinition.java
New file
@@ -0,0 +1,26 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo;
import java.util.ArrayList;
import java.util.List;
/**
 * Pojo permettant de stocker la description d'un Ã©tat
 *
 * @author ASUS
 */
public class ReportDefinition extends MainReportDefinition {
    private final List<SubReportDefinition> subReportDefs = new ArrayList<>(); // Liste des sous-rapports s'il y en a
    public ReportDefinition(String reportName) {
        this.reportName = reportName;
    }
    public List<SubReportDefinition> getSubReportDefs() {
        return subReportDefs;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/SubReportDefinition.java
New file
@@ -0,0 +1,50 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo;
/**
 *
 * @author ASUS
 */
public class SubReportDefinition extends MainReportDefinition {
    private int rang; //ordre d'affichage de l'etat, utile pour les sous-rapports au cas où il y en a plusieurs
    private String dataSource; // Nom du champ qui contient la liste des données d'un rapport; ce champ doit Ãªtre une liste
    private String title; // titre du sous-rapport
    public SubReportDefinition(String reportName,String dataSource, String title, int rang) {
        this.rang = rang;
        this.dataSource = dataSource;
        this.title = title;
        this.reportName = reportName;
    }
    public int getRang() {
        return rang;
    }
    public void setRang(int rang) {
        this.rang = rang;
    }
    public String getDataSource() {
        return dataSource;
    }
    public void setDataSource(String dataSource) {
        this.dataSource = dataSource;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Border.java
New file
@@ -0,0 +1,112 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.components;
/**
 *
 * @author ASUS
 */
public class Border {
    private float leftBorder;
    private float bottomBorder;
    private float topBorder;
    private float rightBorder;
    private String lineColor = "#000000";
    private String lineStyle = "Solid";
    protected int leftPadding;
    protected int rightPadding;
    protected int topPadding;
    protected int bottomPadding;
    public float getLeftBorder() {
        return leftBorder;
    }
    public void setLeftBorder(float leftBorder) {
        this.leftBorder = leftBorder;
    }
    public float getBottomBorder() {
        return bottomBorder;
    }
    public void setBottomBorder(float bottomBorder) {
        this.bottomBorder = bottomBorder;
    }
    public float getTopBorder() {
        return topBorder;
    }
    public void setTopBorder(float topBorder) {
        this.topBorder = topBorder;
    }
    public float getRightBorder() {
        return rightBorder;
    }
    public void setRightBorder(float rightBorder) {
        this.rightBorder = rightBorder;
    }
    public String getLineColor() {
        return lineColor;
    }
    public void setLineColor(String lineColor) {
        this.lineColor = lineColor;
    }
    public String getLineStyle() {
        return lineStyle;
    }
    public void setLineStyle(String lineStyle) {
        this.lineStyle = lineStyle;
    }
    public int getLeftPadding() {
        return leftPadding;
    }
    public void setLeftPadding(int leftPadding) {
        this.leftPadding = leftPadding;
    }
    public int getRightPadding() {
        return rightPadding;
    }
    public void setRightPadding(int rightPadding) {
        this.rightPadding = rightPadding;
    }
    public int getTopPadding() {
        return topPadding;
    }
    public void setTopPadding(int topPadding) {
        this.topPadding = topPadding;
    }
    public int getBottomPadding() {
        return bottomPadding;
    }
    public void setBottomPadding(int bottomPadding) {
        this.bottomPadding = bottomPadding;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Component.java
New file
@@ -0,0 +1,104 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.components;
import com.megatim.dynamic.reports.pojo.DisplayCondition;
/**
 *
 * @author ASUS
 */
public class Component {
    protected int x;
    protected int y;
    protected int width = 200;
    protected int height = 1;
    protected String hAlign = "Center";
    protected String vAlign = "Middle";
    protected Border border = new Border();
    protected String stretchType;
    protected DisplayCondition displayCondition = new DisplayCondition();
    public int getX() {
        return x;
    }
    public void setX(int x) {
        this.x = x;
    }
    public int getY() {
        return y;
    }
    public void setY(int y) {
        this.y = y;
    }
    public int getWidth() {
        return width;
    }
    public void setWidth(int width) {
        this.width = width;
    }
    public int getHeight() {
        return height;
    }
    public void setHeight(int height) {
        this.height = height;
    }
    public String gethAlign() {
        return hAlign;
    }
    public void sethAlign(String hAlign) {
        this.hAlign = hAlign;
    }
    public String getvAlign() {
        return vAlign;
    }
    public void setvAlign(String vAlign) {
        this.vAlign = vAlign;
    }
    public Border getBorder() {
        return border;
    }
    public void setBorder(Border border) {
        this.border = border;
    }
    public String getStretchType() {
        return stretchType;
    }
    public void setStretchType(String stretchType) {
        this.stretchType = stretchType;
    }
    public DisplayCondition getDisplayCondition() {
        return displayCondition;
    }
    public void setDisplayCondition(DisplayCondition displayCondition) {
        this.displayCondition = displayCondition;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Image.java
New file
@@ -0,0 +1,34 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.components;
/**
 *
 * @author ASUS
 */
public class Image extends Component{
    private ValueElement valueElement;
    private String scaleImage = "RetainShape";
    public ValueElement getValueElement() {
        return valueElement;
    }
    public void setValueElement(ValueElement valueElement) {
        this.valueElement = valueElement;
    }
    public String getScaleImage() {
        return scaleImage;
    }
    public void setScaleImage(String scaleImage) {
        this.scaleImage = scaleImage;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Label.java
New file
@@ -0,0 +1,23 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.components;
/**
 *
 * @author ASUS
 */
public class Label extends TextComponent {
    private String value = "";
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Line.java
New file
@@ -0,0 +1,42 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.components;
/**
 *
 * @author ASUS
 */
public class Line extends Component{
    private float lineWidth = 2.5f;
    private String lineStyle = "Solid";
    private String foreColor = "#000000";
    public float getLineWidth() {
        return lineWidth;
    }
    public void setLineWidth(float lineWidth) {
        this.lineWidth = lineWidth;
    }
    public String getLineStyle() {
        return lineStyle;
    }
    public void setLineStyle(String lineStyle) {
        this.lineStyle = lineStyle;
    }
    public String getForeColor() {
        return foreColor;
    }
    public void setForeColor(String foreColor) {
        this.foreColor = foreColor;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/Paragraph.java
New file
@@ -0,0 +1,83 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.components;
/**
 *
 * @author ASUS
 */
public class Paragraph {
    private int leftIndent;
    private int rightIndent;
    private int spacingBefore;
    private int spacingAfter;
    private int firstLineIndent;
    private String lineSpacing;
    private double lineSpacingSize;
    public int getLeftIndent() {
        return leftIndent;
    }
    public void setLeftIndent(int leftIndent) {
        this.leftIndent = leftIndent;
    }
    public int getRightIndent() {
        return rightIndent;
    }
    public void setRightIndent(int rightIndent) {
        this.rightIndent = rightIndent;
    }
    public int getSpacingBefore() {
        return spacingBefore;
    }
    public void setSpacingBefore(int spacingBefore) {
        this.spacingBefore = spacingBefore;
    }
    public int getSpacingAfter() {
        return spacingAfter;
    }
    public void setSpacingAfter(int spacingAfter) {
        this.spacingAfter = spacingAfter;
    }
    public int getFirstLineIndent() {
        return firstLineIndent;
    }
    public void setFirstLineIndent(int firstLineIndent) {
        this.firstLineIndent = firstLineIndent;
    }
    public String getLineSpacing() {
        return lineSpacing;
    }
    public void setLineSpacing(String lineSpacing) {
        this.lineSpacing = lineSpacing;
    }
    public double getLineSpacingSize() {
        return lineSpacingSize;
    }
    public void setLineSpacingSize(double lineSpacingSize) {
        this.lineSpacingSize = lineSpacingSize;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/TextComponent.java
New file
@@ -0,0 +1,122 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.components;
/**
 *
 * @author ASUS
 */
public class TextComponent extends Component {
    protected String fontName = "Serif";
    protected int size = 8;
    protected boolean bold;
    protected boolean underLine;
    protected boolean blankWhenNull = true;
    protected boolean printInFirtWholeBand = true;
    protected boolean printWhenDetailOverflows = true;
    protected String textAdjust = "CutText";
    protected String foreColor = "#000000";
    protected Paragraph paragraph = new Paragraph();
    private boolean removeLineWhenBlank;
    public String getFontName() {
        return fontName;
    }
    public void setFontName(String fontName) {
        this.fontName = fontName;
    }
    public int getSize() {
        return size;
    }
    public void setSize(int size) {
        this.size = size;
    }
    public boolean isBold() {
        return bold;
    }
    public void setBold(boolean bold) {
        this.bold = bold;
    }
    public boolean isBlankWhenNull() {
        return blankWhenNull;
    }
    public void setBlankWhenNull(boolean blankWhenNull) {
        this.blankWhenNull = blankWhenNull;
    }
    public String getTextAdjust() {
        return textAdjust;
    }
    public void setTextAdjust(String textAdjust) {
        this.textAdjust = textAdjust;
    }
    public boolean isPrintInFirtWholeBand() {
        return printInFirtWholeBand;
    }
    public void setPrintInFirtWholeBand(boolean printInFirtWholeBand) {
        this.printInFirtWholeBand = printInFirtWholeBand;
    }
    public boolean isPrintWhenDetailOverflows() {
        return printWhenDetailOverflows;
    }
    public void setPrintWhenDetailOverflows(boolean printWhenDetailOverflows) {
        this.printWhenDetailOverflows = printWhenDetailOverflows;
    }
    public String getForeColor() {
        return foreColor;
    }
    public void setForeColor(String foreColor) {
        this.foreColor = foreColor;
    }
    public Paragraph getParagraph() {
        return paragraph;
    }
    public void setParagraph(Paragraph paragraph) {
        this.paragraph = paragraph;
    }
    public boolean isUnderLine() {
        return underLine;
    }
    public void setUnderLine(boolean underLine) {
        this.underLine = underLine;
    }
    public boolean isRemoveLineWhenBlank() {
        return removeLineWhenBlank;
    }
    public void setRemoveLineWhenBlank(boolean removeLineWhenBlank) {
        this.removeLineWhenBlank = removeLineWhenBlank;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/TextField.java
New file
@@ -0,0 +1,53 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.components;
/**
 *
 * @author ASUS
 */
public class TextField extends TextComponent{
    private boolean lineNumber;
    private boolean pageNumber;
    private ValueElement valueElement;
    private String pattern;
    public ValueElement getValueElement() {
        return valueElement;
    }
    public void setValueElement(ValueElement valueElement) {
        this.valueElement = valueElement;
    }
    public boolean isLineNumber() {
        return lineNumber;
    }
    public void setLineNumber(boolean lineNumber) {
        this.lineNumber = lineNumber;
    }
    public boolean isPageNumber() {
        return pageNumber;
    }
    public void setPageNumber(boolean pageNumber) {
        this.pageNumber = pageNumber;
    }
    public String getPattern() {
        return pattern;
    }
    public void setPattern(String pattern) {
        this.pattern = pattern;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/components/ValueElement.java
New file
@@ -0,0 +1,85 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.components;
import com.megatim.reporting.adhoc.pojo.enums.ValueElementType;
/**
 *
 * @author ASUS
 */
public class ValueElement {
    private String name; // Nom du champ ou du paramètre
    private Class<?> classe = java.lang.String.class;
    private String value; // Valeur par défaut du paramètre
    private String pattern; // Pattern d'affichage
    private ValueElementType valueElementType;
    public ValueElement(String name, Class<?> classe, ValueElementType valueElementType) {
        this.name = name;
        this.classe = classe;
        this.valueElementType = valueElementType;
    }
    public ValueElement(String value, ValueElementType valueElementType) {
        this.value = value;
        this.valueElementType = valueElementType;
    }
    public ValueElement(ValueElementType valueElementType) {
        this.valueElementType = valueElementType;
    }
    @Override
    public String toString() {
        return "ReportElement{" + "name=" + name + ", classe=" + classe + ", reportElementType=" + valueElementType.name() + '}';
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Class<?> getClasse() {
        return classe;
    }
    public void setClasse(Class<?> classe) {
        this.classe = classe;
    }
    public ValueElementType getValueElementType() {
        return valueElementType;
    }
    public void setValueElementType(ValueElementType valueElementType) {
        this.valueElementType = valueElementType;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getPattern() {
        return pattern;
    }
    public void setPattern(String pattern) {
        this.pattern = pattern;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/ComponentType.java
New file
@@ -0,0 +1,12 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Enum.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.enums;
/**
 *
 * @author ASUS
 */
public enum ComponentType {
    TEXTFIELD, IMAGE, LABEL;
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/ElementType.java
New file
@@ -0,0 +1,39 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Enum.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.enums;
import java.util.stream.Stream;
/**
 *
 * @author ASUS
 */
public enum ElementType {
    PARAMETRE("Paramètre"),
    TEXTE_STATIQUE("Texte Statique"),
    DATE_GENERE("Date générée");
    private final String type;
    private ElementType(String type) {
        this.type = type;
    }
     public static ElementType of(String type) {
        return Stream.of(ElementType.values())
          .filter(e -> e.getType().equalsIgnoreCase(type) || e.name().equalsIgnoreCase(type))
          .findFirst()
          .orElseThrow(IllegalArgumentException::new);
    }
    @Override
    public String toString() {
        return this.type;
    }
    public String getType() {
        return type;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/Position.java
New file
@@ -0,0 +1,37 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Enum.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.enums;
import java.util.stream.Stream;
/**
 *
 * @author ASUS
 */
public enum Position {
    LEFT("GAUCHE"), RIGHT("DROITE");
    private final String position;
    private Position(String pos) {
        this.position = pos;
    }
    @Override
    public String toString() {
        return  position ;
    }
     public static Position of(String position) {
        return Stream.of(Position.values())
          .filter(p -> p.getPosition().equalsIgnoreCase(position) || p.name().equalsIgnoreCase(position))
          .findFirst()
          .orElseThrow(IllegalArgumentException::new);
    }
     public String getPosition() {
         return position;
     }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/ReportOrientation.java
New file
@@ -0,0 +1,33 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Enum.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.enums;
/**
 *
 * @author ASUS
 */
public enum ReportOrientation {
    LANDSCAPE("Landscape"), PORTRAIT("Portrait");
    private final String orientation;
    private ReportOrientation(String orientation) {
        this.orientation = orientation;
    }
    @Override
    public String toString() {
        return orientation;
    }
    public static ReportOrientation reportOrientation(String orientation) {
        if (orientation.equalsIgnoreCase(ReportOrientation.LANDSCAPE.toString())) {
            return ReportOrientation.LANDSCAPE;
        } else {
            return ReportOrientation.PORTRAIT;
        }
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/Section.java
New file
@@ -0,0 +1,13 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Enum.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.enums;
/**
 *
 * @author ASUS
 */
public enum Section {
    TITLE, PAGE_HEADER, COLUMN_HEADER;
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/enums/ValueElementType.java
New file
@@ -0,0 +1,13 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Enum.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.enums;
/**
 *
 * @author ASUS
 */
public enum ValueElementType {
    PARAMETER, FIELD, TEXT, GENERATE;
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/ColumnData.java
New file
@@ -0,0 +1,28 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.layouts;
/**
 *
 * @author ASUS
 */
public class ColumnData extends Layout {
    private String columnStyle;
    public ColumnData() {
        height = 19;
        splitType = "Stretch";
    }
    public String getColumnStyle() {
        return columnStyle;
    }
    public void setColumnStyle(String columnStyle) {
        this.columnStyle = columnStyle;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/ColumnHeader.java
New file
@@ -0,0 +1,27 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.layouts;
/**
 *
 * @author ASUS
 */
public class ColumnHeader extends Layout {
    private String columnStyle;
    public ColumnHeader() {
        height = 19;
        splitType = "Stretch";
    }
    public String getColumnStyle() {
        return columnStyle;
    }
    public void setColumnStyle(String columnStyle) {
        this.columnStyle = columnStyle;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/Layout.java
New file
@@ -0,0 +1,47 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.layouts;
import com.megatim.reporting.adhoc.pojo.components.Component;
import java.util.ArrayList;
import java.util.List;
/**
 * Classe utilisée pour regrouper les attributs communs aux différentes sections d'un Ã©tat
 * @author ASUS
 */
public class Layout {
    protected int height;
    protected String splitType;
    protected List<Component> components = new ArrayList<>();
    public int getHeight() {
        return height;
    }
    public void setHeight(int height) {
        this.height = height;
    }
    public String getSplitType() {
        return splitType;
    }
    public void setSplitType(String splitType) {
        this.splitType = splitType;
    }
    public List<Component> getComponents() {
        return components;
    }
    public void setComponents(List<Component> components) {
        this.components = components;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/MainReport.java
New file
@@ -0,0 +1,208 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.layouts;
import com.megatim.reporting.adhoc.pojo.components.ValueElement;
import com.megatim.reporting.adhoc.pojo.enums.ReportOrientation;
import java.util.HashMap;
import java.util.Map;
/**
 *
 * @author ASUS
 */
public class MainReport {
    protected String name;
    protected int pageHeight;
    protected int pageWidth;
    protected int rightMargin;
    protected int topMargin;
    protected int leftMargin;
    protected int bottomMargin;
    protected ReportOrientation orientation = ReportOrientation.PORTRAIT;
    protected Map<String, ValueElement> parameters = new HashMap<>();
    protected Map<String, ValueElement> fields = new HashMap<>();
    protected Title title;
    protected PageHeader pageHeader;
    protected ColumnHeader columnHeader;
    protected ColumnData columnData;
    protected PageFooter pageFooter;
    protected String whenNoDataType = "NoDataSection";
    protected String whenResourceMissingType = "Key";
    protected int columnWidth = 814;
    protected boolean detail;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public ReportOrientation getOrientation() {
        return orientation;
    }
    public void setOrientation(ReportOrientation orientation) {
        this.orientation = orientation;
    }
    public Map<String, ValueElement> getParameters() {
        return parameters;
    }
    public void setParameters(Map<String, ValueElement> parameters) {
        this.parameters = parameters;
    }
    public Map<String, ValueElement> getFields() {
        return fields;
    }
    public void setFields(Map<String, ValueElement> fields) {
        this.fields = fields;
    }
    public int getPageHeight() {
        return pageHeight;
    }
    public void setPageHeight(int pageHeight) {
        this.pageHeight = pageHeight;
    }
    public int getPageWidth() {
        return pageWidth;
    }
    public void setPageWidth(int pageWidth) {
        this.pageWidth = pageWidth;
    }
    public int getRightMargin() {
        return rightMargin;
    }
    public void setRightMargin(int rightMargin) {
        this.rightMargin = rightMargin;
    }
    public int getTopMargin() {
        return topMargin;
    }
    public void setTopMargin(int topMargin) {
        this.topMargin = topMargin;
    }
    public int getLeftMargin() {
        return leftMargin;
    }
    public void setLeftMargin(int leftMargin) {
        this.leftMargin = leftMargin;
    }
    public int getBottomMargin() {
        return bottomMargin;
    }
    public void setBottomMargin(int bottomMargin) {
        this.bottomMargin = bottomMargin;
    }
    public Title getTitle() {
        return title;
    }
    public void setTitle(Title title) {
        this.title = title;
    }
    public PageHeader getPageHeader() {
        return pageHeader;
    }
    public void setPageHeader(PageHeader pageHeader) {
        this.pageHeader = pageHeader;
    }
    public ColumnHeader getColumnHeader() {
        return columnHeader;
    }
    public void setColumnHeader(ColumnHeader columnHeader) {
        this.columnHeader = columnHeader;
    }
    public ColumnData getColumnData() {
        return columnData;
    }
    public void setColumnData(ColumnData columnData) {
        this.columnData = columnData;
    }
    public PageFooter getPageFooter() {
        return pageFooter;
    }
    public void setPageFooter(PageFooter pageFooter) {
        this.pageFooter = pageFooter;
    }
    public String getWhenNoDataType() {
        return whenNoDataType;
    }
    public void setWhenNoDataType(String whenNoDataType) {
        this.whenNoDataType = whenNoDataType;
    }
    public String getWhenResourceMissingType() {
        return whenResourceMissingType;
    }
    public void setWhenResourceMissingType(String whenResourceMissingType) {
        this.whenResourceMissingType = whenResourceMissingType;
    }
    public int getColumnWidth() {
        return columnWidth;
    }
    public void setColumnWidth(int columnWidth) {
        this.columnWidth = columnWidth;
    }
    public boolean isDetail() {
        return detail;
    }
    public void setDetail(boolean detail) {
        this.detail = detail;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/PageFooter.java
New file
@@ -0,0 +1,17 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.layouts;
/**
 *
 * @author ASUS
 */
public class PageFooter extends Layout {
    public PageFooter() {
        height = 68;
        splitType = "Stretch";
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/PageHeader.java
New file
@@ -0,0 +1,19 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.layouts;
/**
 *
 * @author ASUS
 */
public class PageHeader extends Layout {
    public PageHeader() {
        height = 30;
        splitType = "Stretch";
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/Report.java
New file
@@ -0,0 +1,25 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.layouts;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author ASUS
 */
public class Report extends MainReport {
    private List<SubReport> subReports = new ArrayList<>();
    public List<SubReport> getSubReports() {
        return subReports;
    }
    public void setSubReports(List<SubReport> subReports) {
        this.subReports = subReports;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/SubReport.java
New file
@@ -0,0 +1,157 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.layouts;
/**
 *
 * @author ASUS
 */
public class SubReport extends MainReport {
    private String titleValue;
    private String pageTitleStyle;
    private int x;
    private int y;
    private int width = 722;
    private int height = 38;
    private String splitType = "Stretch";
    private String stretchType = "ElementGroupHeight";
    private String overflowType = "Stretch";
    private boolean usingCache = true;
    private boolean runToBottom = true;
    //Nom du champ de l'entité qui va servir Ã  peupler le sous-rapport, doit Ãªtre de tytpe 'Liste'
    private String dataSource;
    private boolean printInFirtWholeBand = true;
    private boolean printWhenDetailOverflows = true;
    public SubReport() {
        columnWidth = 600;
    }
    public int getX() {
        return x;
    }
    public void setX(int x) {
        this.x = x;
    }
    public int getY() {
        return y;
    }
    public void setY(int y) {
        this.y = y;
    }
    public int getWidth() {
        return width;
    }
    public void setWidth(int width) {
        this.width = width;
    }
    public int getHeight() {
        return height;
    }
    public void setHeight(int height) {
        this.height = height;
    }
    public String getSplitType() {
        return splitType;
    }
    public void setSplitType(String splitType) {
        this.splitType = splitType;
    }
    public String getStretchType() {
        return stretchType;
    }
    public void setStretchType(String stretchType) {
        this.stretchType = stretchType;
    }
    public boolean isUsingCache() {
        return usingCache;
    }
    public void setUsingCache(boolean usingCache) {
        this.usingCache = usingCache;
    }
    public boolean isRunToBottom() {
        return runToBottom;
    }
    public void setRunToBottom(boolean runToBottom) {
        this.runToBottom = runToBottom;
    }
    public String getDataSource() {
        return dataSource;
    }
    public void setDataSource(String dataSource) {
        this.dataSource = dataSource;
    }
    public boolean isPrintInFirtWholeBand() {
        return printInFirtWholeBand;
    }
    public void setPrintInFirtWholeBand(boolean printInFirtWholeBand) {
        this.printInFirtWholeBand = printInFirtWholeBand;
    }
    public boolean isPrintWhenDetailOverflows() {
        return printWhenDetailOverflows;
    }
    public void setPrintWhenDetailOverflows(boolean printWhenDetailOverflows) {
        this.printWhenDetailOverflows = printWhenDetailOverflows;
    }
    public String getOverflowType() {
        return overflowType;
    }
    public void setOverflowType(String overflowType) {
        this.overflowType = overflowType;
    }
    public String getTitleValue() {
        return titleValue;
    }
    public void setTitleValue(String titleValue) {
        this.titleValue = titleValue;
    }
    public String getPageTitleStyle() {
        return pageTitleStyle;
    }
    public void setPageTitleStyle(String pageTitleStyle) {
        this.pageTitleStyle = pageTitleStyle;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/layouts/Title.java
New file
@@ -0,0 +1,19 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.layouts;
/**
 *
 * @author ASUS
 */
public class Title extends Layout {
    public Title() {
        height = 169;
        splitType = "Stretch";
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/pojo/xml/ReportTag.java
New file
@@ -0,0 +1,86 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.pojo.xml;
import com.megatim.reporting.adhoc.pojo.components.ValueElement;
import java.util.HashMap;
import java.util.Map;
import org.w3c.dom.Node;
/**
 *
 * @author ASUS
 */
public class ReportTag {
 protected Node title;
    protected Node pageHeader;
    protected Node columnHeader;
    protected Node columnData;
    protected Node pageFooter;
    protected Map<String, ValueElement> parameters = new HashMap<>();
    protected Map<String, ValueElement> fields = new HashMap<>();
    public Node getTitle() {
        return title;
    }
    public void setTitle(Node title) {
        this.title = title;
    }
    public Node getPageHeader() {
        return pageHeader;
    }
    public void setPageHeader(Node pageHeader) {
        this.pageHeader = pageHeader;
    }
    public Node getColumnHeader() {
        return columnHeader;
    }
    public void setColumnHeader(Node columnHeader) {
        this.columnHeader = columnHeader;
    }
    public Node getColumnData() {
        return columnData;
    }
    public void setColumnData(Node columnData) {
        this.columnData = columnData;
    }
    public Node getPageFooter() {
        return pageFooter;
    }
    public void setPageFooter(Node pageFooter) {
        this.pageFooter = pageFooter;
    }
    public Map<String, ValueElement> getParameters() {
        return parameters;
    }
    public void setParameters(Map<String, ValueElement> parameters) {
        this.parameters = parameters;
    }
    public Map<String, ValueElement> getFields() {
        return fields;
    }
    public void setFields(Map<String, ValueElement> fields) {
        this.fields = fields;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/process/GenerateJRXML.java
New file
@@ -0,0 +1,724 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.process;
import com.megatim.dynamic.reports.pojo.DisplayCondition;
import com.megatim.reporting.adhoc.pojo.Constantes;
import com.megatim.reporting.adhoc.pojo.components.Border;
import com.megatim.reporting.adhoc.pojo.components.Component;
import com.megatim.reporting.adhoc.pojo.components.Image;
import com.megatim.reporting.adhoc.pojo.components.Label;
import com.megatim.reporting.adhoc.pojo.components.Line;
import com.megatim.reporting.adhoc.pojo.components.Paragraph;
import com.megatim.reporting.adhoc.pojo.components.TextField;
import com.megatim.reporting.adhoc.pojo.components.ValueElement;
import com.megatim.reporting.adhoc.pojo.enums.ReportOrientation;
import static com.megatim.reporting.adhoc.pojo.enums.ValueElementType.FIELD;
import static com.megatim.reporting.adhoc.pojo.enums.ValueElementType.GENERATE;
import static com.megatim.reporting.adhoc.pojo.enums.ValueElementType.PARAMETER;
import com.megatim.reporting.adhoc.pojo.layouts.ColumnData;
import com.megatim.reporting.adhoc.pojo.layouts.ColumnHeader;
import com.megatim.reporting.adhoc.pojo.layouts.MainReport;
import com.megatim.reporting.adhoc.pojo.layouts.PageFooter;
import com.megatim.reporting.adhoc.pojo.layouts.PageHeader;
import com.megatim.reporting.adhoc.pojo.layouts.Report;
import com.megatim.reporting.adhoc.pojo.layouts.SubReport;
import com.megatim.reporting.adhoc.pojo.layouts.Title;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.List;
import java.util.UUID;
/**
 *
 * @author ASUS
 */
public class GenerateJRXML {
//    private final String JRXML_EXTENSION = "jrxml";
    private final String REPORT_PARTS = "report-parts";
    private final ClassLoader classLoader = GenerateJRXML.class.getClassLoader();
    public void generateJrxml(Report report, String jrxmlFolder) throws Exception {
        Path jrxmlPath = Paths.get(jrxmlFolder, report.getName() + ".jrxml");
        generateReport(report, jrxmlPath);
        for (SubReport sub : report.getSubReports()) {
            jrxmlPath = Paths.get(jrxmlFolder, sub.getName() + ".jrxml");
            generateReport(sub, jrxmlPath);
        }
    }
    private void generateReport(MainReport report, Path reportPath) throws Exception {
        try ( BufferedWriter bufferWriter = Files.newBufferedWriter(reportPath, StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.SYNC)) {
            bufferWriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + System.lineSeparator());
            bufferWriter.write("<jasperReport xmlns=\"http://jasperreports.sourceforge.net/jasperreports\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
                    + "xsi:schemaLocation=\"http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd\" "
                    + "name=\"" + report.getName() + "\" pageWidth=\"" + report.getPageWidth() + "\" pageHeight=\"" + report.getPageHeight() + "\"" + orientation(report.getOrientation())
                    + "columnWidth=\"" + report.getColumnWidth() + "\" leftMargin=\"" + report.getLeftMargin() + "\" rightMargin=\"" + report.getRightMargin() + "\" topMargin=\"" + report.getTopMargin() + "\" "
                    + "bottomMargin=\"" + report.getBottomMargin() + "\"" + setWhenResourceMissingType(report.getWhenResourceMissingType())
                    + setWhenNoDataType(report.getWhenNoDataType())
                    + "uuid=\"" + UUID.randomUUID() + "\">" + System.lineSeparator());
            addPageProperties(bufferWriter);
            addParameters(report, bufferWriter);
            addFields(report, bufferWriter);
            addVariables(bufferWriter);
            addGroups(bufferWriter);
            addtitle(report.getTitle(), bufferWriter);
            addPageHeader(report.getPageHeader(), bufferWriter);
            if (report.isDetail()) {
                if (report instanceof Report) {
                    Report rep = (Report) report;
                    addDetailDetail(report.getColumnHeader(), report.getColumnData(), rep.getSubReports(), bufferWriter);
                } else {
                    addDetailDetail(report.getColumnHeader(), report.getColumnData(), null, bufferWriter);
                }
            } else {
                addListeColumnHeader(report.getColumnHeader(), bufferWriter);
                if (report instanceof Report) {
                    Report rep = (Report) report;
                    addListeDetail(report.getColumnData(), rep.getSubReports(), bufferWriter);
                } else {
                    addListeDetail(report.getColumnData(), null, bufferWriter);
                }
            }
            addPageFooter(report.getPageFooter(), bufferWriter);
            bufferWriter.write("</jasperReport>");
        }
    }
    private void addPageProperties(BufferedWriter bufferWriter) throws IOException {
        InputStream inputStream = classLoader.getResourceAsStream(REPORT_PARTS + "/page-properties.xml");
        readFile(inputStream, bufferWriter);
    }
    /**
     * Méthode qui ajoute les paramètres Ã  l'état
     *
     * @param bufferWriter
     * @throws IOException
     */
    private void addParameters(MainReport report, BufferedWriter bufferWriter) throws IOException {
        InputStream inputStream = classLoader.getResourceAsStream(REPORT_PARTS + "/parameters.xml");
        readFile(inputStream, bufferWriter);
        for (ValueElement param : report.getParameters().values()) {
            bufferWriter.write("\t<parameter name=\"" + param.getName() + setClasse(param.getClasse()) + " isForPrompting=\"false\"/>" + System.lineSeparator());
        }
        bufferWriter.write("" + System.lineSeparator());
    }
    /**
     * Méthode qui ajoute les champs de l'entité Ã  l'état
     *
     * @param bufferWriter
     */
    private void addFields(MainReport report, BufferedWriter bufferWriter) throws IOException {
        for (ValueElement field : report.getFields().values()) {
            bufferWriter.write("\t<field name=\"" + field.getName() + setClasse(field.getClasse()) + ">" + System.lineSeparator());
            bufferWriter.write("\t\t<fieldDescription><![CDATA[" + field.getName() + "]]></fieldDescription>" + System.lineSeparator());
            bufferWriter.write("\t</field>" + System.lineSeparator());
        }
        bufferWriter.write("\t" + System.lineSeparator());
    }
    /**
     * Méthode qui ajoute les variables
     *
     * @param bufferWriter
     * @throws IOException
     */
    private void addVariables(BufferedWriter bufferWriter) throws IOException {
        InputStream inputStream = classLoader.getResourceAsStream(REPORT_PARTS + "/variables.xml");
        readFile(inputStream, bufferWriter);
    }
    /**
     * Méthode qui ajoute les groupes
     *
     * @param bufferWriter
     * @throws IOException
     */
    private void addGroups(BufferedWriter bufferWriter) throws IOException {
        InputStream inputStream = classLoader.getResourceAsStream(REPORT_PARTS + "/groups.xml");
        readFile(inputStream, bufferWriter);
    }
    private void addtitle(Title title, BufferedWriter bufferWriter) throws Exception {
        if (title != null) {
            bufferWriter.write("\t <title>" + System.lineSeparator());
            bufferWriter.write("\t\t <band height=\"" + title.getHeight() + setSplitType(title.getSplitType()) + " >" + System.lineSeparator());
            bufferWriter.write("\t\t\t <property name=\"com.jaspersoft.studio.unit.height\" value=\"px\"/>" + System.lineSeparator());
            addComponents(title.getComponents(), bufferWriter);
            bufferWriter.write("\t\t </band>" + System.lineSeparator());
            bufferWriter.write("\t </title>" + System.lineSeparator());
        }
    }
    private void addPageHeader(PageHeader pageHeader, BufferedWriter bufferWriter) throws Exception {
        if (pageHeader != null) {
            bufferWriter.write("\t <pageHeader>" + System.lineSeparator());
            bufferWriter.write("\t\t <band height=\"" + pageHeader.getHeight() + setSplitType(pageHeader.getSplitType()) + " >" + System.lineSeparator());
            bufferWriter.write("\t\t <property name=\"com.jaspersoft.studio.unit.height\" value=\"px\"/>" + System.lineSeparator());
            addComponents(pageHeader.getComponents(), bufferWriter);
            bufferWriter.write("\t\t </band>" + System.lineSeparator());
            bufferWriter.write("\t </pageHeader>" + System.lineSeparator());
        }
    }
    private void addListeColumnHeader(ColumnHeader columnHeader, BufferedWriter bufferWriter) throws Exception {
        if (columnHeader != null) {
            bufferWriter.write("\t <columnHeader>" + System.lineSeparator());
            bufferWriter.write("\t\t <band height=\"" + columnHeader.getHeight() + setSplitType(columnHeader.getSplitType()) + " >" + System.lineSeparator());
            bufferWriter.write("\t\t <property name=\"com.jaspersoft.studio.unit.height\" value=\"px\"/>" + System.lineSeparator());
            addComponents(columnHeader.getComponents(), bufferWriter);
            bufferWriter.write("\t\t </band>" + System.lineSeparator());
            bufferWriter.write("\t </columnHeader>" + System.lineSeparator());
        }
    }
    private void addListeDetail(ColumnData columnData, List<SubReport> subReports, BufferedWriter bufferWriter) throws Exception {
        if (columnData != null || (subReports != null && !subReports.isEmpty())) {
            bufferWriter.write("\t <detail>" + System.lineSeparator());
            addListeColumnData(columnData, bufferWriter);
            addSubReports(subReports, bufferWriter);
            bufferWriter.write("\t </detail>" + System.lineSeparator());
        }
    }
    private void addDetailDetail(ColumnHeader columnHeader, ColumnData columnData, List<SubReport> subReports, BufferedWriter bufferWriter) throws Exception {
        bufferWriter.write("\t <detail>" + System.lineSeparator());
        if ((columnData != null && columnHeader != null)) {
            bufferWriter.write("\t\t <band height=\"" + columnData.getHeight() + setSplitType(columnData.getSplitType()) + " >" + System.lineSeparator());
            bufferWriter.write("\t\t <property name=\"com.jaspersoft.studio.unit.height\" value=\"px\"/>" + System.lineSeparator());
            addComponents(columnData.getComponents(), bufferWriter);
            addComponents(columnHeader.getComponents(), bufferWriter);
            bufferWriter.write("\t\t </band>" + System.lineSeparator());
        }
        if (subReports != null && !subReports.isEmpty()) {
            addSubReports(subReports, bufferWriter);
        }
        bufferWriter.write("\t </detail>" + System.lineSeparator());
    }
    private void addListeColumnData(ColumnData columnData, BufferedWriter bufferWriter) throws Exception {
        if (columnData != null) {
            bufferWriter.write("\t\t <band height=\"" + columnData.getHeight() + setSplitType(columnData.getSplitType()) + " >" + System.lineSeparator());
            bufferWriter.write("\t\t <property name=\"com.jaspersoft.studio.unit.height\" value=\"px\"/>" + System.lineSeparator());
            addComponents(columnData.getComponents(), bufferWriter);
            bufferWriter.write("\t\t </band>" + System.lineSeparator());
        }
    }
    private void addSubReports(List<SubReport> subReports, BufferedWriter bufferWriter) throws Exception {
        if (subReports != null && !subReports.isEmpty()) {
            for (SubReport sub : subReports) {
                bufferWriter.write("\t\t <band height=\"" + sub.getHeight() + setSplitType(sub.getSplitType()) + " >" + System.lineSeparator());
                bufferWriter.write("\t\t\t <property name=\"com.jaspersoft.studio.unit.height\" value=\"px\"/>" + System.lineSeparator());
                bufferWriter.write("\t\t\t<subreport isUsingCache=\"" + sub.isUsingCache() + "\" runToBottom=\"" + sub.isRunToBottom() + "\""
                        + setOverflowType(sub.getOverflowType()) + ">" + System.lineSeparator());
                bufferWriter.write("\t\t\t\t<reportElement stretchType=\"" + sub.getStretchType() + "\" x=\"" + sub.getX() + "\" y=\"" + sub.getY() + "\" width=\"" + sub.getWidth()
                        + "\" height=\"" + sub.getHeight() + "\" isPrintInFirstWholeBand=\"" + sub.isPrintInFirtWholeBand() + "\" isPrintWhenDetailOverflows=\"" + sub.isPrintWhenDetailOverflows()
                        + "\" uuid=\"" + UUID.randomUUID() + "\">" + System.lineSeparator());
                writeUnits(bufferWriter);
                bufferWriter.write("\t\t\t\t</reportElement>" + System.lineSeparator());
                bufferWriter.write("\t\t\t\t<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{" + sub.getDataSource() + "})]]></dataSourceExpression>" + System.lineSeparator());
                bufferWriter.write("\t\t\t\t<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + \"" + sub.getName() + ".jasper\"]]></subreportExpression>" + System.lineSeparator());
                bufferWriter.write("\t\t\t</subreport>" + System.lineSeparator());
                bufferWriter.write("\t\t</band>" + System.lineSeparator());
            }
        }
    }
    private void addPageFooter(PageFooter pageFooter, BufferedWriter bufferWriter) throws Exception {
        if (pageFooter != null) {
            bufferWriter.write("\t <pageFooter>" + System.lineSeparator());
            bufferWriter.write("\t\t <band height=\"" + pageFooter.getHeight() + setSplitType(pageFooter.getSplitType()) + ">" + System.lineSeparator());
            bufferWriter.write("\t\t <property name=\"com.jaspersoft.studio.unit.height\" value=\"px\"/>" + System.lineSeparator());
            addComponents(pageFooter.getComponents(), bufferWriter);
            bufferWriter.write("\t\t </band>" + System.lineSeparator());
            bufferWriter.write("\t </pageFooter>" + System.lineSeparator());
        }
    }
    private void setComponentBorder(Border border, BufferedWriter bufferWriter) throws IOException {
        if (border != null && (border.getLeftBorder() > 0 || border.getTopBorder() > 0 || border.getRightBorder() > 0 || border.getBottomBorder() > 0)) {
            bufferWriter.write("\t\t\t\t<box ");
            if (border.getLeftPadding() > 0) {
                bufferWriter.write("leftPadding=\"" + border.getLeftPadding() + "\" ");
            }
            if (border.getRightPadding() > 0) {
                bufferWriter.write("rightPadding=\"" + border.getRightPadding() + "\" ");
            }
            if (border.getTopPadding() > 0) {
                bufferWriter.write("topPadding=\"" + border.getTopPadding() + "\"");
            }
            if (border.getBottomPadding() > 0) {
                bufferWriter.write("bottomPadding=\"" + border.getBottomPadding() + "\"");
            }
            bufferWriter.write(" >" + System.lineSeparator());
            bufferWriter.write("\t\t\t\t\t<pen");
            bufferWriter.write(setLineStyle(border.getLineStyle()));
            bufferWriter.write(setLineColor(border.getLineColor()));
            bufferWriter.write("/>" + System.lineSeparator());
            if (border.getTopBorder() > 0) {
                bufferWriter.write("\t\t\t\t\t<topPen lineWidth=\"" + border.getTopBorder() + "\"/>" + System.lineSeparator());
            }
            if (border.getLeftBorder() > 0) {
                bufferWriter.write("\t\t\t\t\t<leftPen lineWidth=\"" + border.getLeftBorder() + "\"/>" + System.lineSeparator());
            }
            if (border.getBottomBorder() > 0) {
                bufferWriter.write("\t\t\t\t\t<bottomPen lineWidth=\"" + border.getBottomBorder() + "\"/>" + System.lineSeparator());
            }
            if (border.getRightBorder() > 0) {
                bufferWriter.write("\t\t\t\t\t<rightPen lineWidth=\"" + border.getRightBorder() + "\"/>" + System.lineSeparator());
            }
            bufferWriter.write("\t\t\t\t</box>" + System.lineSeparator());
        }
    }
    private String setSplitType(String splitType) {
        if (splitType != null && !splitType.isEmpty()) {
            return "\" splitType=\"" + splitType + "\" ";
        } else {
            return "";
        }
    }
    private String setClasse(Class<?> classe) {
        if (classe != null) {
            return "\" class=\"" + classe.getName() + "\" ";
        } else {
            return "java.lang.String";
        }
    }
    private String setForeColor(String color) {
        if (color != null && !color.isEmpty()) {
            return " forecolor=\"" + color + "\" ";
        } else {
            return "";
        }
    }
    private String setLineColor(String color) {
        StringBuilder colorMessage = new StringBuilder("");
        if (color != null && !color.isEmpty()) {
            colorMessage.append(" lineColor=\"").append(color).append("\" ");
        } else {
            colorMessage.append(" lineColor=\"#000000\" ");
        }
        return colorMessage.toString();
    }
    private String setLineStyle(String lineStyle) {
        StringBuilder lineMessage = new StringBuilder(" lineWidth=\"1.0\" ");
        if (lineStyle != null && !lineStyle.isEmpty()) {
            lineMessage.append("lineStyle=\"").append(lineStyle).append("\" ");
        } else {
            lineMessage.append("lineStyle=\"Solid\" ");
        }
        return lineMessage.toString();
    }
    private void addComponents(List<Component> components, BufferedWriter bufferWriter) throws Exception {
        for (Component c : components) {
            if (c instanceof Image) {
                Image image = (Image) c;
                addImage(image, bufferWriter);
            } else if (c instanceof TextField) {
                TextField textField = (TextField) c;
                addTextField(textField, bufferWriter);
            } else if (c instanceof Label) {
                Label label = (Label) c;
                addLabel(label, bufferWriter);
            } else if (c instanceof Line) {
                Line line = (Line) c;
                addLine(line, bufferWriter);
            }
        }
    }
    private void writeValueElement(BufferedWriter bufferWriter, ValueElement valueElt) throws IOException, InstantiationException, IllegalAccessException {
        if (valueElt != null) {
            switch (valueElt.getValueElementType()) {
                case PARAMETER:
                    bufferWriter.write("$P{" + valueElt.getName() + "}");
                    break;
                case FIELD:
                    bufferWriter.write("$F{" + valueElt.getName() + "}");
                    break;
                case GENERATE:
                    bufferWriter.write(generateValue(valueElt));
                    break;
                default:
                    bufferWriter.write(valueElt.getValue());
                    break;
            }
        } else {
            bufferWriter.write("" + null);
        }
    }
    //Génère une instance de la classe java.util.Date()
    private String generateValue(ValueElement valueElt) throws InstantiationException, IllegalAccessException {
        Class classe = valueElt.getClasse();
        return "new " + classe.getName() + "()";
    }
    private void writeUnits(BufferedWriter bufferWriter) throws IOException {
        bufferWriter.write("\t\t\t\t\t<property name=\"com.jaspersoft.studio.unit.x\" value=\"px\"/>" + System.lineSeparator());
        bufferWriter.write("\t\t\t\t\t<property name=\"com.jaspersoft.studio.unit.width\" value=\"px\"/>" + System.lineSeparator());
        bufferWriter.write("\t\t\t\t\t<property name=\"com.jaspersoft.studio.unit.y\" value=\"px\"/>" + System.lineSeparator());
        bufferWriter.write("\t\t\t\t\t<property name=\"com.jaspersoft.studio.unit.height\" value=\"px\"/>" + System.lineSeparator());
    }
    private void readFile(InputStream inputStream, BufferedWriter bufferWriter) throws IOException {
        try ( InputStreamReader isr = new InputStreamReader(inputStream, StandardCharsets.UTF_8);  BufferedReader reader = new BufferedReader(isr)) {
            String line = "";
            while ((line = reader.readLine()) != null) {
                bufferWriter.write(line + System.lineSeparator());
            }
        }
    }
    private void addImage(Image image, BufferedWriter bufferWriter) throws Exception {
        if (image != null) {
            bufferWriter.write("\t\t<image scaleImage=\"" + image.getScaleImage() + "\" hAlign=\"" + image.gethAlign() + "\" vAlign=\"" + image.getvAlign() + "\">" + System.lineSeparator());
            bufferWriter.write("\t\t\t<reportElement x=\"" + image.getX() + "\" y=\"" + image.getY() + "\" width=\"" + image.getWidth() + "\" height=\"" + image.getHeight()
                    + setStretchType(image.getStretchType()) + "\" uuid=\"" + UUID.randomUUID() + "\">" + System.lineSeparator());
            writeUnits(bufferWriter);
            bufferWriter.write(setPrintWhenExpression(image.getDisplayCondition()) + System.lineSeparator());
            bufferWriter.write("\t\t\t\t</reportElement>" + System.lineSeparator());
            setComponentBorder(image.getBorder(), bufferWriter);
            bufferWriter.write("\t\t\t<graphicElement fill=\"Solid\"/>" + System.lineSeparator());
            bufferWriter.write("\t\t\t<imageExpression><![CDATA[");
            ValueElement valueElt = image.getValueElement();
            writeValueElement(bufferWriter, valueElt);
            bufferWriter.write("]]></imageExpression>" + System.lineSeparator());
            bufferWriter.write("\t\t</image>" + System.lineSeparator());
        }
    }
    private void addTextField(TextField textField, BufferedWriter bufferWriter) throws Exception {
        if (textField != null) {
            bufferWriter.write("\t\t\t<textField " + addEvaluationTime(textField) + addPattern(textField.getPattern()) + " isBlankWhenNull=\"" + textField.isBlankWhenNull() + "\""
                    + " textAdjust=\"" + textField.getTextAdjust() + "\">" + System.lineSeparator());
            bufferWriter.write("\t\t\t\t <reportElement x=\"" + textField.getX() + "\" y=\"" + textField.getY() + "\" width=\"" + textField.getWidth() + "\" height=\"" + textField.getHeight() + "\""
                    + " isRemoveLineWhenBlank=\"" + textField.isRemoveLineWhenBlank() + "\"" + setForeColor(textField.getForeColor()) + setStretchType(textField.getStretchType()) + " isPrintInFirstWholeBand=\"" + textField.isPrintInFirtWholeBand()
                    + "\" isPrintWhenDetailOverflows=\"" + textField.isPrintWhenDetailOverflows() + "\"" + " uuid=\"" + UUID.randomUUID() + "\">" + System.lineSeparator());
            writeUnits(bufferWriter);
            bufferWriter.write(setPrintWhenExpression(textField.getDisplayCondition()) + System.lineSeparator());
            bufferWriter.write("\t\t\t\t</reportElement>" + System.lineSeparator());
            setComponentBorder(textField.getBorder(), bufferWriter);
            bufferWriter.write("\t\t\t\t<textElement textAlignment=\"" + textField.gethAlign() + "\" verticalAlignment=\"" + textField.getvAlign() + "\">" + System.lineSeparator());
            bufferWriter.write("\t\t\t\t\t<font fontName=\"" + textField.getFontName() + "\" size=\"" + textField.getSize() + "\" isBold=\"" + textField.isBold() + "\" isUnderline=\"" + textField.isUnderLine() + "\""
                    + "/>" + System.lineSeparator());
            bufferWriter.write(setParagraph(textField.getParagraph()) + System.lineSeparator());
            bufferWriter.write("\t\t\t\t</textElement>" + System.lineSeparator());
            bufferWriter.write("\t\t\t\t<textFieldExpression><![CDATA[");
            if (textField.isLineNumber()) {
                bufferWriter.write("String.valueOf($V{LINE_NUMBER})");
            } else if (textField.isPageNumber()) {
                bufferWriter.write("\" Page \"+String.valueOf($V{REPORT_PAGE})+\" / \"+String.valueOf($V{PAGE_NUMBER})");
            } else {
                ValueElement valueElt = textField.getValueElement();
                writeValueElement(bufferWriter, valueElt);
            }
            bufferWriter.write("]]></textFieldExpression>" + System.lineSeparator());
            bufferWriter.write("\t\t\t</textField>" + System.lineSeparator());
        }
    }
    private String addEvaluationTime(TextField textField) {
        if (textField.isPageNumber()) {
            return " evaluationTime=\"Auto\" ";
        } else {
            return "";
        }
    }
    private String addPattern(String pattern) {
        if (pattern != null && !pattern.isEmpty()) {
            return " pattern=\"" + pattern + "\" ";
        } else {
            return "";
        }
    }
    private void addLabel(Label label, BufferedWriter bufferWriter) throws IOException {
        if (label != null) {
            bufferWriter.write("\t\t\t<staticText>" + System.lineSeparator());
            bufferWriter.write("\t\t\t\t <reportElement x=\"" + label.getX() + "\" y=\"" + label.getY() + "\" width=\"" + label.getWidth() + "\" height=\"" + label.getHeight() + "\""
                    + setStretchType(label.getStretchType()) + setForeColor(label.getForeColor()) + " uuid=\"" + UUID.randomUUID() + "\">" + System.lineSeparator());
            writeUnits(bufferWriter);
            bufferWriter.write(setPrintWhenExpression(label.getDisplayCondition()) + System.lineSeparator());
            bufferWriter.write("\t\t\t\t</reportElement>" + System.lineSeparator());
            setComponentBorder(label.getBorder(), bufferWriter);
            bufferWriter.write("\t\t\t\t<textElement textAlignment=\"" + label.gethAlign() + "\" verticalAlignment=\"" + label.getvAlign() + "\">" + System.lineSeparator());
            bufferWriter.write("\t\t\t\t\t<font fontName=\"" + label.getFontName() + "\" size=\"" + label.getSize() + "\" isBold=\"" + label.isBold() + "\" isUnderline=\"" + label.isUnderLine() + "\""
                    + "/>" + System.lineSeparator());
            bufferWriter.write(setParagraph(label.getParagraph()) + System.lineSeparator());
            bufferWriter.write("\t\t\t\t</textElement>" + System.lineSeparator());
            bufferWriter.write("\t\t\t\t<text><![CDATA[" + label.getValue() + "]]></text>" + System.lineSeparator());
            bufferWriter.write("\t\t\t</staticText>" + System.lineSeparator());
        }
    }
    private void addLine(Line line, BufferedWriter bufferWriter) throws IOException {
        if (line != null) {
            bufferWriter.write("\t\t\t<line>" + System.lineSeparator());
            bufferWriter.write("\t\t\t\t <reportElement x=\"" + line.getX() + "\" y=\"" + line.getY() + "\" width=\"" + line.getWidth() + "\" height=\"" + line.getHeight()
                    + setStretchType(line.getStretchType()) + "\" isRemoveLineWhenBlank=\"true\"" + " forecolor=\"" + line.getForeColor() + "\" uuid=\"" + UUID.randomUUID() + "\">" + System.lineSeparator());
            writeUnits(bufferWriter);
            bufferWriter.write(setPrintWhenExpression(line.getDisplayCondition()) + System.lineSeparator());
            bufferWriter.write("\t\t\t\t</reportElement>" + System.lineSeparator());
            bufferWriter.write("\t\t\t\t<graphicElement>" + System.lineSeparator());
            bufferWriter.write("\t\t\t\t\t<pen lineWidth=\"" + line.getLineWidth() + "\" lineStyle=\"" + line.getLineStyle()
                    + "\"/>" + System.lineSeparator());
            bufferWriter.write("\t\t\t\t</graphicElement>" + System.lineSeparator());
            bufferWriter.write("\t\t\t</line>" + System.lineSeparator());
        }
    }
    private String setStretchType(String stretchType) {
        if (stretchType != null && !stretchType.isEmpty()) {
            return " stretchType=\"" + stretchType + "\"";
        } else {
            return "";
        }
    }
    private String setWhenNoDataType(String whenNoDataType) {
        if (whenNoDataType != null && !whenNoDataType.isEmpty()) {
            return " whenNoDataType=\"" + whenNoDataType + "\" ";
        } else {
            return "";
        }
    }
    private String setWhenResourceMissingType(String whenResourceMissingType) {
        if (whenResourceMissingType != null && !whenResourceMissingType.isEmpty()) {
            return " whenResourceMissingType=\"" + whenResourceMissingType + "\" ";
        } else {
            return "";
        }
    }
    private String setOverflowType(String overflowType) {
        if (overflowType != null && !overflowType.isEmpty()) {
            return " overflowType=\"" + overflowType + "\" ";
        } else {
            return "";
        }
    }
    private String setPrintWhenExpression(DisplayCondition condition) {
        StringBuilder chaine = new StringBuilder();
        if (condition != null && condition.getLeftOperand() != null && condition.getRightOperand() != null && condition.getOperator() != null && condition.getOperandType() != null
                && !condition.getLeftOperand().isEmpty() && !condition.getRightOperand().isEmpty() && !condition.getOperator().isEmpty() && !condition.getOperandType().isEmpty()) {
            chaine.append("<printWhenExpression><![CDATA[$");
            if (condition.getOperandType().equalsIgnoreCase(Constantes.OPERAND_TYPE_VARIABLE)) {
                chaine.append("V");
            } else if (condition.getOperandType().equalsIgnoreCase(Constantes.OPERAND_TYPE_PARAMETER)) {
                chaine.append("P");
            } else if (condition.getOperandType().equalsIgnoreCase(Constantes.OPERAND_TYPE_FIELD)) {
                chaine.append("F");
            }
            chaine.append("{").append(condition.getLeftOperand()).append("} ").append(condition.getOperator()).append(condition.getRightOperand());
            chaine.append("]]></printWhenExpression>");
            return chaine.toString();
        } else {
            return "";
        }
    }
    private String setParagraph(Paragraph paragraph) {
        StringBuilder chaine = new StringBuilder("");
        if (paragraph != null) {
            chaine.append("\t\t\t\t\t<paragraph ");
            if (paragraph.getLineSpacing() != null && !paragraph.getLineSpacing().isEmpty()) {
                chaine.append("lineSpacing=\"").append(paragraph.getLineSpacing()).append("\" ");
            }
            chaine.append("lineSpacingSize=\"").append(paragraph.getLineSpacingSize()).append("\" ");
            chaine.append("firstLineIndent=\"").append(paragraph.getFirstLineIndent()).append("\" ");
            chaine.append("leftIndent=\"").append(paragraph.getLeftIndent()).append("\" ");
            chaine.append("rightIndent=\"").append(paragraph.getRightIndent()).append("\" ");
            chaine.append("spacingBefore=\"").append(paragraph.getSpacingBefore()).append("\" ");
            chaine.append("spacingAfter=\"").append(paragraph.getSpacingAfter()).append("\" ");
            chaine.append("/>");
        }
        return chaine.toString();
    }
    private String orientation(ReportOrientation orientation) {
        if (orientation != null && orientation.equals(ReportOrientation.LANDSCAPE)) {
            return " orientation=\"" + ReportOrientation.LANDSCAPE.toString() + "\" ";
        } else {
            return " ";
        }
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/process/ParseXMLTemplate.java
New file
@@ -0,0 +1,1027 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.process;
import com.megatim.reporting.adhoc.pojo.Constantes;
import com.megatim.reporting.adhoc.pojo.layouts.Report;
import com.megatim.reporting.adhoc.pojo.xml.ReportTag;
import com.megatim.reporting.adhoc.pojo.components.Component;
import com.megatim.reporting.adhoc.pojo.components.Image;
import com.megatim.reporting.adhoc.pojo.components.Label;
import com.megatim.reporting.adhoc.pojo.components.Line;
import com.megatim.reporting.adhoc.pojo.components.TextComponent;
import com.megatim.reporting.adhoc.pojo.components.TextField;
import com.megatim.reporting.adhoc.pojo.components.ValueElement;
import com.megatim.reporting.adhoc.pojo.enums.ReportOrientation;
import com.megatim.reporting.adhoc.pojo.enums.ValueElementType;
import com.megatim.reporting.adhoc.pojo.layouts.ColumnData;
import com.megatim.reporting.adhoc.pojo.layouts.ColumnHeader;
import com.megatim.reporting.adhoc.pojo.layouts.Layout;
import com.megatim.reporting.adhoc.pojo.layouts.MainReport;
import com.megatim.reporting.adhoc.pojo.layouts.PageFooter;
import com.megatim.reporting.adhoc.pojo.layouts.PageHeader;
import com.megatim.reporting.adhoc.pojo.layouts.SubReport;
import com.megatim.reporting.adhoc.pojo.layouts.Title;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
 *
 * @author ASUS
 */
public class ParseXMLTemplate {
    private ReportTag reportTag;
    /**
     * Méthode qui parse le fichier de xml de description de l'état
     *
     * @param file
     * @return
     * @throws Exception
     */
    public Report parse(File file) throws Exception {
        reportTag = new ReportTag();
        Report report = new Report();
        Document doc = intialize(file);
        //Liste des noeud <report>
        NodeList reportList = doc.getElementsByTagName(Constantes.TAG_REPORT);
        if (reportList.getLength() > 0) {
            Node reportNode = reportList.item(0);
            //Attributs de <report>
            NamedNodeMap reportAttributes = reportNode.getAttributes();
            setReportProperties(reportAttributes, report);
            //Liste des balises enfant du 1er Noeud <report>
            NodeList reportChildren = reportNode.getChildNodes();
            getFieldsAndParameters(reportChildren);
            report.setParameters(reportTag.getParameters());
            report.setFields(reportTag.getFields());
            if (reportTag.getTitle() != null) {
                Title title = getTitle(reportTag.getTitle());
                report.setTitle(title);
            }
            if (reportTag.getPageHeader() != null) {
                PageHeader pHeader = getPageHeader(reportTag.getPageHeader());
                report.setPageHeader(pHeader);
            }
            if (reportTag.getColumnHeader() != null) {
                ColumnHeader cHeader = getColumnHeader(reportTag.getColumnHeader());
                report.setColumnHeader(cHeader);
            }
            if (reportTag.getColumnData() != null) {
                ColumnData cData = getColumnData(reportTag.getColumnData());
                report.setColumnData(cData);
            }
            if (reportTag.getPageFooter() != null) {
                PageFooter pageFooter = getPageFooter(reportTag.getPageFooter());
                report.setPageFooter(pageFooter);
            }
            NodeList subReportList = doc.getElementsByTagName(Constantes.TAG_SUB_REPORT);
            if (subReportList.getLength() > 0) {
                List<SubReport> subReports = getAllSubReports(subReportList);
                report.getSubReports().addAll(subReports);
//                for (SubReport sub : subReports) {
//                    ValueElement valueElt = new ValueElement(sub.getDataSource(), java.util.List.class, ValueElementType.FIELD);
//                    report.getFields().putIfAbsent(sub.getDataSource(), valueElt);
//                }
            }
        }
        return report;
    }
    /**
     * Méthode qui construit le composant 'Titre' du rapport Ã  partir d'un noeud
     *
     * @param node : Noeud representant la balise 'title' extrait du fichier xml
     * @return
     * @throws ClassNotFoundException
     */
    private Title getTitle(Node node) throws ClassNotFoundException {
        NamedNodeMap attributes = node.getAttributes();
        Title title = new Title();
        //Parcours des attributs de la balise <Title>
        for (int i = 0; i < attributes.getLength(); i++) {
            String nodeName = attributes.item(i).getNodeName();
            String nodeValue = attributes.item(i).getNodeValue();
            if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_STYLE)) {
                title = (Title) getLayoutStyle(nodeValue, title);
            }
        }
        List<Component> components = getComponents(node.getChildNodes());
        title.setComponents(components);
        return title;
    }
    /**
     * Méthode qui construit le composant 'PageHeader' du rapport Ã  partir d'un
     * noeud
     *
     * @param node : Noeud representant la balise 'pageHeader' extrait du
     * fichier xml
     * @return
     * @throws ClassNotFoundException
     */
    private PageHeader getPageHeader(Node node) throws Exception {
        NamedNodeMap attributes = node.getAttributes();
        PageHeader pageHeader = new PageHeader();
        //Prcours des attributs de la balise <Title>
        for (int i = 0; i < attributes.getLength(); i++) {
            String nodeName = attributes.item(i).getNodeName();
            String nodeValue = attributes.item(i).getNodeValue();
            if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_STYLE)) {
                pageHeader = (PageHeader) getLayoutStyle(nodeValue, pageHeader);
            }
        }
        List<Component> components = getComponents(node.getChildNodes());
        pageHeader.setComponents(components);
        return pageHeader;
    }
    /**
     * Méthode qui crée le composant 'ColumnHeader' du rapport Ã  partir d'un
     * noeud
     *
     * @param node : Noeud representant la balise 'columnHeader' extrait du
     * fichier xml
     * @return
     * @throws ClassNotFoundException
     */
    private ColumnHeader getColumnHeader(Node node) throws Exception {
        NamedNodeMap attributes = node.getAttributes();
        ColumnHeader columnHeader = new ColumnHeader();
        //Parcours des attributs de la balise <Title>
        for (int i = 0; i < attributes.getLength(); i++) {
            String nodeName = attributes.item(i).getNodeName();
            String nodeValue = attributes.item(i).getNodeValue();
            if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_STYLE)) {
                columnHeader = (ColumnHeader) getLayoutStyle(nodeValue, columnHeader);
            } else if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_COLUMN_STYLE)) {
                columnHeader.setColumnStyle(nodeValue);
            }
        }
        List<Component> components = getComponents(node.getChildNodes());
        columnHeader.setComponents(components);
        return columnHeader;
    }
    /**
     * Méthode qui crée le composant 'ColumnData'(Detail) du rapport Ã  partir
     * d'un noeud
     *
     * @param node : Noeud representant la balise 'columnData' extrait du
     * fichier xml
     * @return
     * @throws ClassNotFoundException
     */
    private ColumnData getColumnData(Node node) throws ClassNotFoundException {
        ColumnData columnData = new ColumnData();
        NamedNodeMap attributes = node.getAttributes();
        //Parcours des attributs de la balise <ColumnData>
        for (int i = 0; i < attributes.getLength(); i++) {
            String nodeName = attributes.item(i).getNodeName();
            String nodeValue = attributes.item(i).getNodeValue();
            if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_STYLE)) {
                columnData = (ColumnData) getLayoutStyle(nodeValue, columnData);
            } else if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_COLUMN_STYLE)) {
                columnData.setColumnStyle(nodeValue);
            }
        }
        List<Component> components = getComponents(node.getChildNodes());
        columnData.setComponents(components);
        return columnData;
    }
    /**
     * Méthode qui crée le composant 'PageFooter' du rapport Ã  partir d'un noeud
     *
     * @param node : Noeud representant la balise 'pageFooter' extrait du
     * fichier xml
     * @return
     * @throws ClassNotFoundException
     */
    private PageFooter getPageFooter(Node node) throws ClassNotFoundException {
        PageFooter pageFooter = new PageFooter();
        NamedNodeMap attributes = node.getAttributes();
        //Parcours des attributs de la balise <ColumnData>
        for (int i = 0; i < attributes.getLength(); i++) {
            String nodeName = attributes.item(i).getNodeName();
            String nodeValue = attributes.item(i).getNodeValue();
            if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_STYLE)) {
                pageFooter = (PageFooter) getLayoutStyle(nodeValue, pageFooter);
            }
        }
        List<Component> components = getComponents(node.getChildNodes());
        pageFooter.setComponents(components);
        return pageFooter;
    }
    /**
     *
     * @param attributeValue
     * @param layout
     * @return
     */
    private Layout getLayoutStyle(String attributeValue, Layout layout) {
        String[] styles = attributeValue.trim().split(";");
        for (String style : styles) {
            String[] tab = style.split(":");
            if (tab.length == 2) {
                if (tab[0].equals(Constantes.ATTRIBUTE_HEIGHT)) {
                    layout.setHeight(Integer.parseInt(tab[1]));
                } else if (tab[0].equals(Constantes.ATTRIBUTE_SPLIT_TYPE)) {
                    layout.setSplitType(tab[1]);
                }
            }
        }
        return layout;
    }
    /**
     * Méthode qui recupère tous les enfants d'une balise qui représente une
     * section(Title, PageHeader, ColumnHeader,Detail, PageFooter) d'un Ã©tat et
     * construis
     *
     * @param childNodes : Balises enfant
     * @return
     * @throws ClassNotFoundException
     */
    private List<Component> getComponents(NodeList childNodes) throws ClassNotFoundException {
        List<Component> components = new ArrayList<>();
        for (int i = 0; i < childNodes.getLength(); i++) {
            Node child = childNodes.item(i);
            if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_IMAGE)) {
                Image image = getImageTag(child);
                components.add(image);
            } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_TEXT_FIELD)) {
                TextField textField = getTextFieldTag(child);
                components.add(textField);
            } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_LABEL)) {
                Label label = getLabelTag(child);
                components.add(label);
            } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_LINE)) {
                Line line = getLineTag(child);
                components.add(line);
            } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_LINE_NUMBER)) {
                TextField textField = getTextFieldTag(child);
                textField.setLineNumber(true);
                components.add(textField);
            } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_PAGE_NUMBER)) {
                TextField textField = getTextFieldTag(child);
                textField.setPageNumber(true);
                components.add(textField);
            }
        }
        return components;
    }
//    private void get
    /**
     * Méthode qui extrait les attributs communs aux composants de type
     * Text(Label,TextField)
     *
     * @param attributeValue : contenu de l'attribut 'style' de la balise parent
     * @param textComponent : Objet auquel sera affecté les attributs extraits
     */
    public static void getTextComponentAttributes(String attributeValue, TextComponent textComponent) {
        String[] styles = attributeValue.trim().split(";");
        for (String style : styles) {
            String[] tab = style.trim().split(":");
            if (tab.length == 2 && tab[1] != null && !tab[1].isEmpty()) {
                if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_FONT_NAME)) {
                    textComponent.setFontName(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_BOLD)) {
                    textComponent.setBold(Boolean.parseBoolean(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_UNDERLINE)) {
                    textComponent.setUnderLine(Boolean.parseBoolean(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_TEXT_ADJUST)) {
                    textComponent.setTextAdjust(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_IS_BLANK_WHEN_NULL)) {
                    textComponent.setBlankWhenNull(Boolean.parseBoolean(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_IS_PRINT_IN_FIRST_WHOLE_BAND)) {
                    textComponent.setPrintInFirtWholeBand(Boolean.parseBoolean(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_IS_PRINT_WHEN_DETAIL_OVER_FLOWS)) {
                    textComponent.setPrintWhenDetailOverflows(Boolean.parseBoolean(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_SIZE)) {
                    textComponent.setSize(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_FORE_COLOR)) {
                    textComponent.setForeColor(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_RIGHT_INDENT)) {
                    textComponent.getParagraph().setRightIndent(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_LEFT_INDENT)) {
                    textComponent.getParagraph().setLeftIndent(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_SPACING_AFTER)) {
                    textComponent.getParagraph().setSpacingAfter(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_SPACING_BEFORE)) {
                    textComponent.getParagraph().setSpacingBefore(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_FIRST_LINE_INDENT)) {
                    textComponent.getParagraph().setFirstLineIndent(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_LINE_SPACING_SIZE)) {
                    textComponent.getParagraph().setLineSpacingSize(Double.parseDouble(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_LINE_SPACING)) {
                    textComponent.getParagraph().setLineSpacing(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_REMOVE_LINE_WHEN_BLANK)) {
                    textComponent.setRemoveLineWhenBlank(Boolean.parseBoolean(tab[1]));
                }
            }
        }
    }
    /**
     * Méthode qui extrait les attributs communs Ã  tous les composants
     *
     * @param attributeValue : contenu de l'attribut 'style' de la balise parent
     * @param component : Objet auquel sera affecté les attributs extraits
     */
    public static void getComponentAttributes(String attributeValue, Component component) {
        String[] styles = attributeValue.trim().split(";");
        for (String style : styles) {
            String[] tab = style.trim().split(":");
            if (tab.length == 2 && tab[1] != null && !tab[1].isEmpty()) {
                if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_HEIGHT)) {
                    component.setHeight(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_X)) {
                    component.setX(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_Y)) {
                    component.setY(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_WIDTH)) {
                    component.setWidth(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_H_ALIGN)) {
                    component.sethAlign(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_V_ALIGN)) {
                    component.setvAlign(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_LEFT_BORDER)) {
                    component.getBorder().setLeftBorder(Float.parseFloat(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_TOP_BORDER)) {
                    component.getBorder().setTopBorder(Float.parseFloat(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_BOTTOM_BORDER)) {
                    component.getBorder().setBottomBorder(Float.parseFloat(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_RIGHT_BORDER)) {
                    component.getBorder().setRightBorder(Float.parseFloat(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_RIGHT_PADDING)) {
                    component.getBorder().setRightPadding(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_LEFT_PADDING)) {
                    component.getBorder().setLeftPadding(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_TOP_PADDING)) {
                    component.getBorder().setTopPadding(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_BOTTOM_PADDING)) {
                    component.getBorder().setBottomPadding(Integer.parseInt(tab[1]));
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_LINE_STYLE)) {
                    component.getBorder().setLineStyle(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_LINE_COLOR)) {
                    component.getBorder().setLineColor(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_OPERAND_TYPE)) {
                    component.getDisplayCondition().setOperandType(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_LEFT_OPERAND)) {
                    component.getDisplayCondition().setLeftOperand(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_RIGHT_OPERAND)) {
                    component.getDisplayCondition().setRightOperand(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_OPERATOR)) {
                    component.getDisplayCondition().setOperator(tab[1]);
                } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_STRETCH_TYPE)) {
                    component.setStretchType(tab[1]);
                }
            }
        }
    }
    /**
     * Méthode qui parse une balise <image> et construis l'objet Image
     * correspondant
     *
     * @param node
     * @return
     */
    private Image getImageTag(Node node) throws ClassNotFoundException {
        Image image = new Image();
        NamedNodeMap attributes = node.getAttributes();
        for (int i = 0; i < attributes.getLength(); i++) {
            String attributeName = attributes.item(i).getNodeName();
            String attributeValue = attributes.item(i).getNodeValue();
            if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_STYLE) || attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_DISPLAY_CONDITION)) {
                //Récupérer les attributs communs Ã  tous les 'Component'
                getComponentAttributes(attributeValue, image);
            } else if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_SCALE_IMAGE)) {
                image.setScaleImage(attributeValue);
            }
        }
        NodeList imageChildren = node.getChildNodes();
        ValueElement valueElt = getValueElement(imageChildren);
        image.setValueElement(valueElt);
        return image;
    }
    /**
     * Méthode qui parse une balise <textField> et construis l'objet textField
     * correspondant
     *
     * @param node
     * @return
     */
    private TextField getTextFieldTag(Node node) throws ClassNotFoundException {
        NamedNodeMap attributes = node.getAttributes();
        TextField textField = new TextField();
        //Parcours des attributs de la balise <textField>
        for (int i = 0; i < attributes.getLength(); i++) {
            String attributeName = attributes.item(i).getNodeName();
            String attributeValue = attributes.item(i).getNodeValue();
            if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_STYLE)) {
                //Recuperer la valeur des attributs communs Ã  tous les 'Component'
                getComponentAttributes(attributeValue, textField);
                //Recuperer la valeur des attributs communs Ã  tous 'TextComponent'
                getTextComponentAttributes(attributeValue, textField);
                //Recupérer les attibuts spécifiques Ã  'TextField'
            } else if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_PATTERN) && attributeValue != null && !attributeValue.isEmpty()) {
                textField.setPattern(attributeValue.trim());
            } else if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_DISPLAY_CONDITION)) {
                getComponentAttributes(attributeValue, textField);
            }
        }
        NodeList textFieldChildren = node.getChildNodes();
        ValueElement valueElt = getValueElement(textFieldChildren);
        textField.setValueElement(valueElt);
        return textField;
    }
    /**
     *
     * @param node
     * @throws Exception
     */
    private List<SubReport> getAllSubReports(NodeList subReportList) throws Exception {
        List<SubReport> subReports = new ArrayList<>();
        for (int i = 0; i < subReportList.getLength(); i++) {
            Node subReportTag = subReportList.item(i);
            subReports.add(getSubReportTag(subReportTag));
        }
        return subReports;
    }
    private SubReport getSubReportTag(Node subReportTag) throws Exception {
        NamedNodeMap attributes = subReportTag.getAttributes();
        SubReport subReport = new SubReport();
        //Parcours des attributs de la balise <subReport>
        for (int j = 0; j < attributes.getLength(); j++) {
            String attributeName = attributes.item(j).getNodeName();
            String attributeValue = attributes.item(j).getNodeValue();
            if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_STYLE)) {
                setReportStyle(attributeValue, subReport);
            } else if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_NAME)) {
                subReport.setName(attributeValue);
            } else if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_DATASOURCE)) {
                subReport.setDataSource(attributeValue);
            } else if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_BAND_STYLE)) {
                String[] styles = attributeValue.split(";");
                for (String style : styles) {
                    String[] tab = style.trim().split(":");
                    if (tab.length == 2 && tab[1] != null && !tab[1].isEmpty()) {
                        if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_IS_PRINT_IN_FIRST_WHOLE_BAND)) {
                            subReport.setPrintInFirtWholeBand(Boolean.parseBoolean(tab[1]));
                        } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_IS_PRINT_WHEN_DETAIL_OVER_FLOWS)) {
                            subReport.setPrintWhenDetailOverflows(Boolean.parseBoolean(tab[1]));
                        } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_HEIGHT)) {
                            subReport.setHeight(Integer.parseInt(tab[1]));
                        } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_X)) {
                            subReport.setX(Integer.parseInt(tab[1]));
                        } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_Y)) {
                            subReport.setY(Integer.parseInt(tab[1]));
                        } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_WIDTH)) {
                            subReport.setWidth(Integer.parseInt(tab[1]));
                        } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_SPLIT_TYPE)) {
                            subReport.setSplitType(tab[1]);
                        } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_STRETCH_TYPE)) {
                            subReport.setStretchType(tab[1]);
                        } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_RUN_TO_BOTTOM)) {
                            subReport.setRunToBottom(Boolean.parseBoolean(tab[1]));
                        } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_USING_CACHE)) {
                            subReport.setUsingCache(Boolean.parseBoolean(tab[1]));
                        } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_OVERFLOW_TYPE)) {
                            subReport.setOverflowType(tab[1]);
                        }
                    }
                }
            } else if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_PAGE_TITLE_STYLE)) {
                subReport.setPageTitleStyle(attributeValue);
            }
        }
        reportTag = new ReportTag();
        getFieldsAndParameters(subReportTag.getChildNodes());
        subReport.setParameters(reportTag.getParameters());
        subReport.setFields(reportTag.getFields());
        if (reportTag.getTitle() != null) {
            Title title = getTitle(reportTag.getTitle());
            subReport.setTitle(title);
        }
        if (reportTag.getPageHeader() != null) {
            PageHeader pHeader = getPageHeader(reportTag.getPageHeader());
            subReport.setPageHeader(pHeader);
        }
        if (reportTag.getColumnHeader() != null) {
            ColumnHeader cHeader = getColumnHeader(reportTag.getColumnHeader());
            subReport.setColumnHeader(cHeader);
        }
        if (reportTag.getColumnData() != null) {
            ColumnData cData = getColumnData(reportTag.getColumnData());
            subReport.setColumnData(cData);
        }
        if (reportTag.getPageFooter() != null) {
            PageFooter pageFooter = getPageFooter(reportTag.getPageFooter());
            subReport.setPageFooter(pageFooter);
        }
        return subReport;
    }
    private ValueElement getValueElement(NodeList children) throws ClassNotFoundException {
        ValueElement valueElt = null;
        for (int i = 0; i < children.getLength(); i++) {
            Node child = children.item(i);
            if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_PARAMETER) || child.getNodeName().equalsIgnoreCase(Constantes.TAG_FIELD)) {
                NamedNodeMap textFieldChildAttributes = child.getAttributes();
                String classe = "java.lang.String";
                String name = null;
                for (int j = 0; j < textFieldChildAttributes.getLength(); j++) {
                    Node attNode = textFieldChildAttributes.item(j);
                    String attributeValue = attNode.getNodeValue();
                    String attributeName = attNode.getNodeName();
                    if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_CLASSE)) {
                        classe = attributeValue;
                    } else if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_NAME)) {
                        name = attributeValue;
                    }
                }
                Class<?> clazz = Class.forName(classe);
                if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_PARAMETER)) {
                    valueElt = new ValueElement(name, clazz, ValueElementType.PARAMETER);
                } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_FIELD)) {
                    valueElt = new ValueElement(name, clazz, ValueElementType.FIELD);
                }
            } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_TEXT)) {
                NamedNodeMap textFieldChildAttributes = child.getAttributes();
                valueElt = new ValueElement(ValueElementType.TEXT);
                for (int j = 0; j < textFieldChildAttributes.getLength(); j++) {
                    Node attNode = textFieldChildAttributes.item(j);
                    String attributeValue = attNode.getNodeValue();
                    String attributeName = attNode.getNodeName();
                    if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_VALUE)) {
                        valueElt.setValue(attributeValue);
                    }
                }
            } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_GENERATE)) {
                NamedNodeMap textFieldChildAttributes = child.getAttributes();
                valueElt = new ValueElement(ValueElementType.GENERATE);
                for (int j = 0; j < textFieldChildAttributes.getLength(); j++) {
                    Node attNode = textFieldChildAttributes.item(j);
                    String attributeValue = attNode.getNodeValue();
                    String attributeName = attNode.getNodeName();
                    if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_PATTERN)) {
                        valueElt.setPattern(attributeValue);
                    } else if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_CLASSE)) {
                        valueElt.setClasse(Class.forName(attributeValue));
                    }
                }
            }
        }
        return valueElt;
    }
    /**
     * Méthode qui parse une balise <label> et construis l'objet label
     * correspondant
     *
     * @param node
     * @return
     */
    private Label getLabelTag(Node node) {
        NamedNodeMap attributes = node.getAttributes();
        Label label = new Label();
        //Parcours des attributs de la balise <label>
        for (int i = 0; i < attributes.getLength(); i++) {
            String attributeName = attributes.item(i).getNodeName();
            String attributeValue = attributes.item(i).getNodeValue();
            if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_STYLE)) {
                //Récuperer la valeur des attributs communs Ã  tous les 'Component'
                getComponentAttributes(attributeValue, label);
                //Récuperer la valeur des attributs communs Ã  tous les 'TextComponent'
                getTextComponentAttributes(attributeValue, label);
            } else if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_VALUE)) { //Recupérer les attibuts spécifiques Ã  'Label'
                label.setValue(attributeValue);
            } else if (attributeName.equalsIgnoreCase(Constantes.ATTRIBUTE_DISPLAY_CONDITION)) {
                getComponentAttributes(attributeValue, label);
            }
        }
        return label;
    }
    /**
     * Méthode qui parse une balise <line> et construis l'objet line
     * correspondant
     *
     * @param node
     * @return
     */
    private Line getLineTag(Node node) {
        NamedNodeMap attributes = node.getAttributes();
        Line line = new Line();
        //Parcours des attributs de la balise <line>
        for (int i = 0; i < attributes.getLength(); i++) {
            String attributeName = attributes.item(i).getNodeName();
            String attributeValue = attributes.item(i).getNodeValue();
            if (attributeName.equals(Constantes.ATTRIBUTE_STYLE)) {
                //Recupérer la valeur des attributs commun Ã  'Component'
                getComponentAttributes(attributeValue, line);
                //Recupérer les attibuts spécifiques Ã  'Line'
                String[] styles = attributeValue.trim().split(";");
                for (String style : styles) {
                    String[] tab = style.trim().split(":");
                    if (tab.length == 2 && tab[1] != null && !tab[1].isEmpty()) {
                        if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_LINE_STYLE)) {
                            line.setLineStyle(tab[1]);
                        } else if (tab[0].equalsIgnoreCase(Constantes.ATTRIBUTE_LINE_WIDTH)) {
                            line.setLineWidth(Float.parseFloat(tab[1]));
                        }
                    }
                }
            } else if (attributeName.equals(Constantes.ATTRIBUTE_DISPLAY_CONDITION)) {
                getComponentAttributes(attributeValue, line);
            }
        }
        return line;
    }
    /**
     * Méthode qui recupère tous les champs et paramètres trouvés dans le
     * fichier xml de template
     *
     * @param reportChildren
     * @throws ClassNotFoundException
     */
    private void getFieldsAndParameters(NodeList reportChildren) throws ClassNotFoundException {
        for (int i = 0; i < reportChildren.getLength(); i++) {
            Node child = reportChildren.item(i);
            if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_TITLE)) {
                reportTag.setTitle(child);
            } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_PAGE_HEADER)) {
                reportTag.setPageHeader(child);
            } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_COLUMN_HEADER)) {
                reportTag.setColumnHeader(child);
            } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_COLUMN_DATA)) {
                reportTag.setColumnData(child);
            } else if (child.getNodeName().equalsIgnoreCase(Constantes.TAG_PAGE_FOOTER)) {
                reportTag.setPageFooter(child);
            }
            if (child.getNodeName().equals(Constantes.TAG_PARAMETER) || child.getNodeName().equals(Constantes.TAG_FIELD)) {
                NamedNodeMap valueElementeterAttributes = child.getAttributes();
                String classe = "java.lang.String";
                String name = null;
                String defaultValue = null;
                for (int j = 0; j < valueElementeterAttributes.getLength(); j++) {
                    String nodeName = valueElementeterAttributes.item(j).getNodeName();
                    String nodeValue = valueElementeterAttributes.item(j).getNodeValue();
                    if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_CLASSE)) {
                        classe = nodeValue;
                    } else if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_NAME)) {
                        name = nodeValue;
                    } else if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_DEFAULT_VALUE)) {
                        defaultValue = nodeValue;
                    }
                }
                ValueElement valueElement = null;
                final Class<?> clazz = Class.forName(classe);
                if (child.getNodeName().equals(Constantes.TAG_PARAMETER)) {
                    valueElement = new ValueElement(name, clazz, ValueElementType.PARAMETER);
                    if (defaultValue != null) {
                        valueElement.setValue(defaultValue);
                    }
                    reportTag.getParameters().merge(valueElement.getName(), valueElement, (v1, v2) -> v1.getValue() != null ? v2 : v1);
                } else if (child.getNodeName().equals(Constantes.TAG_FIELD)) {
                    valueElement = new ValueElement(name, clazz, ValueElementType.FIELD);
                    reportTag.getFields().putIfAbsent(valueElement.getName(), valueElement);
                }
            } else {
                if (child.getChildNodes().getLength() > 0 && !child.getNodeName().equalsIgnoreCase(Constantes.TAG_SUB_REPORT)) {
                    getFieldsAndParameters(child.getChildNodes());
                }
            }
        }
    }
    /**
     * Méthode qui recherche les attributs de la balise <report>
     *
     * @param reportAttributes
     * @return
     * @throws Exception
     */
    private Report setReportProperties(NamedNodeMap reportAttributes, Report report) throws Exception {
        for (int i = 0; i < reportAttributes.getLength(); i++) {
            String nodeName = reportAttributes.item(i).getNodeName();
            String nodeValue = reportAttributes.item(i).getNodeValue();
            if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_NAME)) {
                report.setName(nodeValue);
            } else if (nodeName.equalsIgnoreCase(Constantes.ATTRIBUTE_STYLE)) {
                setReportStyle(nodeValue, report);
            }
        }
        return report;
    }
    private MainReport setReportStyle(String styles, MainReport report) {
        if (styles != null && !styles.isEmpty()) {
            String[] tab = styles.split(";");
            for (String str : tab) {
                String[] style = str.split(":");
                if (style.length == 2 && style[1] != null && !style[1].isEmpty()) {
                    if (style[0].equalsIgnoreCase(Constantes.ATTRIBUTE_BOTTOM_MARGIN)) {
                        report.setBottomMargin(Integer.parseInt(style[1]));
                    } else if (style[0].equalsIgnoreCase(Constantes.ATTRIBUTE_TOP_MARGIN)) {
                        report.setTopMargin(Integer.parseInt(style[1]));
                    } else if (style[0].equalsIgnoreCase(Constantes.ATTRIBUTE_LEFT_MARGIN)) {
                        report.setLeftMargin(Integer.parseInt(style[1]));
                    } else if (style[0].equalsIgnoreCase(Constantes.ATTRIBUTE_RIGHT_MARGIN)) {
                        report.setRightMargin(Integer.parseInt(style[1]));
                    } else if (style[0].equalsIgnoreCase(Constantes.ATTRIBUTE_ORIENTATION)) {
                        report.setOrientation(ReportOrientation.reportOrientation(style[1]));
                    } else if (style[0].equalsIgnoreCase(Constantes.ATTRIBUTE_PAGE_HEIGHT)) {
                        report.setPageHeight(Integer.parseInt(style[1]));
                    } else if (style[0].equalsIgnoreCase(Constantes.ATTRIBUTE_PAGE_WIDTH)) {
                        report.setPageWidth(Integer.parseInt(style[1]));
                    } else if (style[0].equalsIgnoreCase(Constantes.ATTRIBUTE_COLUMN_WIDTH)) {
                        report.setColumnWidth(Integer.parseInt(style[1]));
                    }
                }
            }
        }
        return report;
    }
    /**
     * Méthode utilitaire pour extraire les données dans un fichier xml
     *
     * @valueElement array
     * @return
     * @throws Exception
     */
    private Document intialize(File file) throws Exception {
        /**
         * Défini un factory qui aide Ã  obtenir un parseur qui produit un arbre
         * d'objets DOM Ã  partir d'un docuent XML.
         */
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        /**
         * création d'un objet du builder pour parser le fichier XML.
         */
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(file);
        doc.getDocumentElement().normalize();
        return doc;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/process/Processor.java
New file
@@ -0,0 +1,92 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.process;
import com.megatim.reporting.adhoc.pojo.DescriptionEtat;
import com.megatim.reporting.adhoc.pojo.DescriptionSousEtat;
import com.megatim.reporting.adhoc.pojo.ElementToDisplay;
import com.megatim.reporting.adhoc.pojo.ProcessorElements;
import com.megatim.reporting.adhoc.pojo.ReportDefinition;
import com.megatim.reporting.adhoc.pojo.SubReportDefinition;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author ASUS
 */
public class Processor {
    /**
     * Point d'entrée dans le moteur de reporting
     * @param desc :  objet contenant l'ensemble des Ã©léments de l'état(liste des colonnes Ã  imprimer, liste des sous-rapports,
     * liste des Ã©léments d'entête, etc)
     * @return
     * @throws Exception
     */
    public String process(DescriptionEtat desc) throws Exception {
        ProcessorElements elements = constructReportElements(desc);
        return new SecondProcessor().generateJasperFile(elements);
    }
    private ProcessorElements constructReportElements(DescriptionEtat desc) {
        ReportDefinition repDef = reportDefinition(desc);
        List<SubReportDefinition> liste = new ArrayList<>();
        for (DescriptionSousEtat ds : desc.getSubReportDescriptions()) {
            SubReportDefinition subRepDef = subReportDefinition(ds);
            liste.add(subRepDef);
        }
        repDef.getSubReportDefs().addAll(liste);
        ProcessorElements elements = new ProcessorElements(desc.getTemplateFile(),
                desc.getRepositoryFolder(), desc.getRepositoryFolder(), repDef);
        return elements;
    }
    private SubReportDefinition subReportDefinition(DescriptionSousEtat ds) {
        SubReportDefinition subRepDef = new SubReportDefinition(ds.getSubReportName(), ds.getDataField().getName(), ds.getReportTitle(), ds.getRangSousEtat());
        subRepDef.setHaveLineNumber(ds.isHaveLineNumber());
        List<ElementToDisplay> subEltToDisplay = new ArrayList<>();
        for (ElementToDisplay e : ds.getElementsToDisplay()) {
            ElementToDisplay elt = new ElementToDisplay(
                    e.getLibelle(), e.getValue());
            elt.setPosition(e.getPosition());
            elt.setElementType(e.getElementType());
            subEltToDisplay.add(elt);
        }
        subRepDef.getElementsToDisplay().addAll(subEltToDisplay);
        subRepDef.getCustomFields().addAll(ds.getFieldsToDisplay());
        return subRepDef;
    }
    private ReportDefinition reportDefinition(DescriptionEtat desc) {
        ReportDefinition repDef = new ReportDefinition(desc.getReportName());
        repDef.setDetail(desc.isDetail());
        List<ElementToDisplay> eltToDisplay = new ArrayList<>();
        repDef.setHaveLineNumber(desc.isHaveLineNumber());
        for (ElementToDisplay e : desc.getElementsToDisplay()) {
            ElementToDisplay elt = new ElementToDisplay(e.getLibelle(), e.getValue());
            elt.setPosition(e.getPosition());
            elt.setElementType(e.getElementType());
            eltToDisplay.add(elt);
        }
        repDef.getElementsToDisplay().addAll(eltToDisplay);
        repDef.getCustomFields().addAll(desc.getFieldsToDisplay());
        return repDef;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/process/SecondProcessor.java
New file
@@ -0,0 +1,501 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.process;
import com.megatim.dynamic.reports.pojo.LargestWidth;
import com.megatim.reporting.adhoc.pojo.Constantes;
import com.megatim.reporting.adhoc.pojo.components.Component;
import com.megatim.reporting.adhoc.pojo.CustomField;
import com.megatim.reporting.adhoc.pojo.ProcessorElements;
import com.megatim.reporting.adhoc.pojo.components.Label;
import com.megatim.reporting.adhoc.pojo.components.TextComponent;
import com.megatim.reporting.adhoc.pojo.components.TextField;
import com.megatim.reporting.adhoc.pojo.components.ValueElement;
import com.megatim.reporting.adhoc.pojo.enums.ElementType;
import com.megatim.reporting.adhoc.pojo.enums.Position;
import com.megatim.reporting.adhoc.pojo.enums.Section;
import com.megatim.reporting.adhoc.pojo.enums.ValueElementType;
import com.megatim.reporting.adhoc.pojo.ElementToDisplay;
import com.megatim.reporting.adhoc.pojo.MainReportDefinition;
import com.megatim.reporting.adhoc.pojo.ReportDefinition;
import com.megatim.reporting.adhoc.pojo.SubReportDefinition;
import com.megatim.reporting.adhoc.pojo.layouts.MainReport;
import com.megatim.reporting.adhoc.pojo.layouts.Report;
import com.megatim.reporting.adhoc.pojo.layouts.SubReport;
import com.megatim.reporting.adhoc.pojo.layouts.Title;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
/**
 *
 * @author ASUS
 */
public class SecondProcessor {
    /**
     * Point de de début des traitements en vue de générer le .jrxml et le
     * .jasper
     *
     * @param elements
     * @return : retourne le chemin absolu du fichier .jasper
     * @throws Exception
     */
    public String generateJasperFile(ProcessorElements elements) throws Exception {
        //Parcours du template .xml afin d'extraire certaines propriétés de l'état
        Report report = (new ParseXMLTemplate()).parse(elements.getTemplateFile());
        //Ajout des Ã©léments provenant de l'interface
        addReportElements(report, elements.getReportDefinition());
        (new GenerateJRXML()).generateJrxml(report, elements.getJrxmlFolder());
        //Compilation des sous-rapports
        for (SubReport sub : report.getSubReports()) {
            compileJrxmlToJasper(Paths.get(elements.getJrxmlFolder(), sub.getName() + ".jrxml").toString(),
                    Paths.get(elements.getJasperFolder(), sub.getName() + ".jasper").toString());
        }
        //Compilation  du rapport parent
        compileJrxmlToJasper(Paths.get(elements.getJrxmlFolder(), report.getName() + ".jrxml").toString(),
                Paths.get(elements.getJasperFolder(), report.getName() + ".jasper").toString());
        return Paths.get(elements.getJasperFolder(), report.getName() + ".jasper").toString();
    }
    /**
     * Méthode qui compile le .jrxml en . jasper
     *
     * @param jrxmlPath
     * @param jasperPath
     * @throws JRException
     */
    private void compileJrxmlToJasper(String jrxmlPath, String jasperPath) throws JRException {
        JasperCompileManager.compileReportToFile(jrxmlPath, jasperPath);
    }
    /**
     * Méthode qui ajoute les Ã©léments provenant de la vue
     *
     * @param report
     * @param reportDefinition
     */
    private void addReportElements(MainReport report, MainReportDefinition reportDefinition) {
        report.setDetail(reportDefinition.isDetail());
        //Ajout des colonnes de données et leurs entêtes
        addColumnsHeaderAndColumnsData(report, reportDefinition);
        //Ajout des labels de l'entête
        addElementsToDisplayToHeader(report, reportDefinition.getElementsToDisplay());
        if (reportDefinition.getReportName() != null && !reportDefinition.getReportName().isEmpty()) {
            report.setName(reportDefinition.getReportName());
        }
        for (CustomField f : reportDefinition.getCustomFields()) {
            ValueElement valueElt = new ValueElement(f.getName(), f.getClasse(), ValueElementType.FIELD);
            report.getFields().putIfAbsent(valueElt.getName(), valueElt);
        }
        //Ajout des sous-états
        if ((report instanceof Report) && (reportDefinition instanceof ReportDefinition)) {
            Report rep = (Report) report;
            ReportDefinition repDef = (ReportDefinition) reportDefinition;
            if (!repDef.getSubReportDefs().isEmpty() && !rep.getSubReports().isEmpty()) {
                addSubReportsElelements(rep, repDef.getSubReportDefs());
            } else {
                //Retirer la description de subReport provenant du xml, afin de ne pas l'afficher car il n'ya pas de sous-rapport
                //provenant de l'interface
                rep.getSubReports().clear();
            }
        }
    }
    /**
     * .
     * @param report
     * @param reportDefinition
     */
    private void addColumnsHeaderAndColumnsData(MainReport report, MainReportDefinition reportDefinition) {
        //Filter afin de ne garder que les champs qui sont des nombres, chaines de caractères, date ou booleen
        List<CustomField> fields = reportDefinition.getCustomFields().stream()
                .filter(f -> String.class.isAssignableFrom(f.getClasse())
                || Number.class.isAssignableFrom(f.getClasse())
                || Boolean.class.isAssignableFrom(f.getClasse())
                || java.util.Date.class.isAssignableFrom(f.getClasse())
                || java.time.temporal.Temporal.class.isAssignableFrom(f.getClasse())
                ).collect(Collectors.toList());
        Collections.sort(fields, (CustomField f1, CustomField f2) -> Integer.valueOf(f1.getRang()).compareTo(f2.getRang()));
        if (report.isDetail()) {
            addDetailColumnsHeaderAndColumnsData(report, fields);
        } else {
            addListeColumnsHeaderAndColumnsData(report, reportDefinition.isHaveLineNumber(), fields);
        }
    }
    private void addListeColumnsHeaderAndColumnsData(MainReport report, boolean isHaveLineNumber, List<CustomField> fields) {
        int x = 0;
        int i = 1;
        String columnDataStyle = report.getColumnData().getColumnStyle();
        String columnHeaderStyle = report.getColumnHeader().getColumnStyle();
        if (isHaveLineNumber) {
            x = 38;
            TextField textField = new TextField();
            textField.setLineNumber(true);
            Label label = new Label();
            label.setValue("N°");
            setTextComponentStyle(textField, columnDataStyle);
            setTextComponentStyle(label, columnHeaderStyle);
            textField.setX(0);
            label.setX(0);
            textField.setWidth(x);
            label.setWidth(x);
            report.getColumnData().getComponents().add(textField);
            report.getColumnHeader().getComponents().add(label);
        }
        int totalWidth = report.getPageWidth() - report.getRightMargin() - report.getLeftMargin() - x - 10;
        int nbFieldsWithoutWidth = fields.size();
        for (CustomField f : fields) {
            if (f.getWidth() > 0) {
                totalWidth -= f.getWidth();
                nbFieldsWithoutWidth--;
            }
        }
        for (CustomField f : fields) {
            int width = f.getWidth() > 0 ? f.getWidth() : totalWidth / nbFieldsWithoutWidth;
            f.setWidth(width);
            TextField textField = new TextField();
            Label label = new Label();
            setTextComponentStyle(textField, columnDataStyle);
            setTextComponentStyle(label, columnHeaderStyle);
            ValueElement valueElement = new ValueElement(f.getName(), f.getClasse(), ValueElementType.FIELD);
            textField.setValueElement(valueElement);
            label.setValue(f.getLibelle());
            textField.setX(x);
            label.setX(x);
            textField.setWidth(f.getWidth());
            label.setWidth(f.getWidth());
            textField.setPattern(f.getPattern());
            report.getColumnData().getComponents().add(textField);
            report.getColumnHeader().getComponents().add(label);
            x = x + f.getWidth();
            i++;
        }
    }
    private void addDetailColumnsHeaderAndColumnsData(MainReport report, List<CustomField> fields) {
        final int xColumnHeader = 10;
        String columnDataStyle = report.getColumnData().getColumnStyle();
        String columnHeaderStyle = report.getColumnHeader().getColumnStyle();
        int totalWidth = report.getPageWidth() - report.getRightMargin() - report.getLeftMargin() - xColumnHeader - 20;
        //Recherche du champ ayant le libellé le plus long
        Optional<CustomField> optionalCustomField = fields.stream().max((c1, c2) -> Integer.valueOf(c1.getLibelle().length()).compareTo(c2.getLibelle().length()));
        final int columnHeaderLength = (optionalCustomField.isPresent() ? optionalCustomField.get().getLibelle().length() : 0) * 7;
        final int columnDataLength = totalWidth - columnHeaderLength;
        final int xColumnData = xColumnHeader + columnHeaderLength;
        int y = 10;
        int columnDataHeight = y;
        for (CustomField f : fields) {
            TextField textField = new TextField();
            Label label = new Label();
            setTextComponentStyle(textField, columnDataStyle);
            setTextComponentStyle(label, columnHeaderStyle);
            ValueElement valueElement = new ValueElement(f.getName(), f.getClasse(), ValueElementType.FIELD);
            textField.setValueElement(valueElement);
            label.setValue(f.getLibelle());
            label.setX(xColumnHeader);
            textField.setX(xColumnData);
            textField.setY(y);
            label.setY(y);
            textField.setWidth(columnDataLength);
            label.setWidth(columnHeaderLength);
            textField.setPattern(f.getPattern());
            columnDataHeight += textField.getHeight();
            y += textField.getHeight();
            report.getColumnData().getComponents().add(textField);
            report.getColumnHeader().getComponents().add(label);
        }
        report.getColumnData().setHeight(columnDataHeight);
        report.getColumnHeader().setHeight(columnDataHeight);
    }
    /**
     * Méthode qui applique la mise en forme sur les composants
     *
     * @param component
     * @param attributeValue
     */
    private void setTextComponentStyle(TextComponent component, String attributeValue) {
        if (attributeValue != null && !attributeValue.isEmpty()) {
            ParseXMLTemplate.getComponentAttributes(attributeValue, component);
            ParseXMLTemplate.getTextComponentAttributes(attributeValue, component);
        }
    }
    private void addSubReportsElelements(Report report, List<SubReportDefinition> subReportDefs) {
        List<SubReport> subReports = new ArrayList<>();
        for (SubReportDefinition subReportDef : subReportDefs) {
            SubReport subReport = report.getSubReports().get(0);
            String pageTitleStyle = subReport.getPageTitleStyle();
            Label label = new Label();
            label.setValue(subReportDef.getTitle());
            ParseXMLTemplate.getComponentAttributes(pageTitleStyle, label);
            ParseXMLTemplate.getTextComponentAttributes(pageTitleStyle, label);
            subReport.getPageHeader().getComponents().add(label);
            subReport.setDataSource(subReportDef.getDataSource());
            addReportElements(subReport, subReportDef);
            subReports.add(subReport);
        }
        report.getSubReports().clear();
        report.getSubReports().addAll(subReports);
    }
    private void addElementsToDisplayToHeader(MainReport report, List<ElementToDisplay> elementsToDisplay) {
        List<ElementToDisplay> liste = elementsToDisplay.stream().filter(e -> e.getSection().equals(Section.TITLE))
                .collect(Collectors.toList());
        if (!liste.isEmpty()) {
            if (report.getTitle() == null) {
                report.setTitle(new Title());
            }
            List<Component> components = new ArrayList<>();
            int y = 0;
            for (Component c : report.getTitle().getComponents()) {
                if (c != null) {
                    y += c.getY();
                }
            }
            //Ajouter un espace avant les labels Ã  ajouter
            y += y > 0 ? 50 : 10;
            LargestWidth largestWidth = getLargestWidth(elementsToDisplay);
            int yLeft = y;
            int yRight = y;
            for (ElementToDisplay e : elementsToDisplay) {
                int xLeft = 0;
                int xRight = 0;
                if (report.isDetail()) {
                    Component columnData = !report.getColumnData().getComponents().isEmpty() ? report.getColumnData().getComponents().get(0) : null;
                    xRight = report.getRightMargin() + report.getLeftMargin() + (columnData != null ? columnData.getWidth() + columnData.getX() : 0) + 10;
                } else {
                    xRight = report.getRightMargin() + report.getLeftMargin() + report.getColumnData().getComponents().stream().mapToInt(c -> c.getWidth()).sum() + 10;
                }
                Label keyLabel = new Label();
                Component labelValue = new Component();
                Label deuxPointsLabel = new Label();
                keyLabel.setValue(e.getLibelle());
                deuxPointsLabel.setValue(":");
                switch (e.getElementType()) {
                    case PARAMETRE:
                        ValueElement valueElt = new ValueElement(e.getValue(), java.lang.String.class, ValueElementType.PARAMETER);
                        try {
                            report.getParameters().put(e.getValue(), valueElt);
                        } catch (Exception ex) {
                        }
                        TextField textField = new TextField();
                        textField.setValueElement(valueElt);
                        textField.setSize(10);
                        labelValue = textField;
                        break;
                    case DATE_GENERE:
                        valueElt = new ValueElement(e.getValue(), java.util.Date.class, ValueElementType.GENERATE);
                        textField = new TextField();
                        textField.setValueElement(valueElt);
                        textField.setSize(10);
                        textField.setPattern("dd/MM/yyyy HH:mm:ss");
                        labelValue = textField;
                        break;
                    default:
                        Label label = new Label();
                        label.setValue(e.getValue());
                        label.setSize(10);
                        labelValue = label;
                        break;
                }
                keyLabel.setSize(10);
                deuxPointsLabel.setSize(10);
                keyLabel.setHeight(Constantes.LABEL_HEIGHT);
                labelValue.setHeight(Constantes.LABEL_HEIGHT);
                deuxPointsLabel.setHeight(Constantes.LABEL_HEIGHT);
                deuxPointsLabel.setWidth(Constantes.DEUX_POINTS_WIDTH);
                keyLabel.setvAlign(Constantes.V_ALIGN_MIDDLE);
                labelValue.setvAlign(Constantes.V_ALIGN_MIDDLE);
                deuxPointsLabel.setvAlign(Constantes.V_ALIGN_MIDDLE);
                keyLabel.setBold(true);
                deuxPointsLabel.setBold(true);
                keyLabel.sethAlign(Constantes.H_ALIGN_LEFT);
                labelValue.sethAlign(Constantes.H_ALIGN_LEFT);
                deuxPointsLabel.sethAlign(Constantes.H_ALIGN_CENTER);
                if (e.getPosition() == null) {
                    e.setPosition(Position.LEFT);
                }
                switch (e.getPosition()) {
                    case LEFT:
                        keyLabel.setY(yLeft);
                        labelValue.setY(yLeft);
                        deuxPointsLabel.setY(yLeft);
                        keyLabel.setX(xLeft);
                        deuxPointsLabel.setX(xLeft + largestWidth.getLeftLargestKey());
                        labelValue.setX(xLeft + largestWidth.getLeftLargestKey() + 2 * Constantes.DEUX_POINTS_WIDTH);
                        keyLabel.setWidth(largestWidth.getLeftLargestKey());
                        labelValue.setWidth(largestWidth.getLeftLargestValue());
                        keyLabel.setX(0);
                        yLeft += Constantes.LABEL_HEIGHT;
                        break;
                    case RIGHT:
                        keyLabel.setY(yRight);
                        labelValue.setY(yRight);
                        deuxPointsLabel.setY(yRight);
                        labelValue.setX(xRight - largestWidth.getRightLargestValue() - Constantes.DEUX_POINTS_WIDTH);
                        deuxPointsLabel.setX(xRight - largestWidth.getRightLargestValue() - Constantes.DEUX_POINTS_WIDTH * 3);
                        keyLabel.setX(xRight - largestWidth.getRightLargestValue() - Constantes.DEUX_POINTS_WIDTH * 3 - largestWidth.getRightLargestKey());
                        keyLabel.setWidth(largestWidth.getRightLargestKey());
                        labelValue.setWidth(largestWidth.getRightLargestValue());
                        yRight += Constantes.LABEL_HEIGHT;
                        break;
                }
                components.add(keyLabel);
                components.add(labelValue);
                components.add(deuxPointsLabel);
            }
            y = yLeft > yRight ? yLeft : yRight;
            report.getTitle().getComponents().addAll(components);
            report.getTitle().setHeight(y);
        }
    }
    private LargestWidth getLargestWidth(List<ElementToDisplay> elementsToDisplay) {
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss");
        Integer leftLargestKey = 0;
        Integer leftLargestValue = 0;
        Integer rightLargestKey = 0;
        Integer rightLargestValue = 0;
        for (ElementToDisplay e : elementsToDisplay) {
            //Fixer des valeurs qui permettront de calculer la longueur de chaque label
            if (e.getElementType().equals(ElementType.DATE_GENERE)) {
                e.setValue(dtf.format(LocalDateTime.now()));
            }
            if (e.getPosition() != null) {
                if (e.getPosition().equals(Position.RIGHT)) {
                    rightLargestValue = e.getValue() != null && e.getValue().length() > rightLargestValue ? e.getValue().length() : rightLargestValue;
                    rightLargestKey = e.getLibelle() != null && e.getLibelle().length() > rightLargestKey ? e.getLibelle().length() : rightLargestKey;
                } else if (e.getPosition().equals(Position.LEFT)) {
                    leftLargestValue = e.getValue() != null && e.getValue().length() > leftLargestValue ? e.getValue().length() : leftLargestValue;
                    leftLargestKey = e.getLibelle() != null && e.getLibelle().length() > leftLargestKey ? e.getLibelle().length() : leftLargestKey;
                }
            }
        }
        leftLargestKey = leftLargestKey * 6;
        leftLargestValue = leftLargestValue * 6;
        rightLargestValue = rightLargestValue * 6;
        rightLargestKey = rightLargestKey * 6;
        return new LargestWidth(leftLargestKey, leftLargestValue, rightLargestKey, rightLargestValue);
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/test/CategorieConstruct.java
New file
@@ -0,0 +1,98 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.test;
import com.megatim.reporting.adhoc.App;
import com.megatim.reporting.adhoc.process.Processor;
import com.megatim.reporting.adhoc.pojo.DescriptionEtat;
import com.megatim.reporting.adhoc.pojo.enums.ElementType;
import com.megatim.reporting.adhoc.pojo.enums.Position;
import com.megatim.reporting.adhoc.pojo.CustomField;
import com.megatim.reporting.adhoc.pojo.ElementToDisplay;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author ASUS
 *
 */
public class CategorieConstruct {
    public DescriptionEtat construct(String repositoryPath) {
        DescriptionEtat desc = new DescriptionEtat();
        desc.setHaveLineNumber(true);
        desc.setReportName("CategorieRapport");
         desc.setTemplateFile(App.templateListe);
        ArrayList<CustomField> fields = new ArrayList<>();
        CustomField customField = new CustomField("Libellé", "libelle");
        customField.setClasse(java.lang.String.class);
        customField.setRang(1);
        fields.add(customField);
        customField = new CustomField("Description", "description");
        customField.setClasse(java.lang.String.class);
        customField.setRang(2);
        fields.add(customField);
        customField = new CustomField("Crée par", "utilisateurCreation");
        customField.setClasse(java.lang.String.class);
        customField.setRang(3);
        fields.add(customField);
        customField = new CustomField("Crée le", "dateCreation");
        customField.setClasse(java.util.Date.class);
        customField.setPattern("dd/MM/yyyy");
        customField.setRang(4);
        fields.add(customField);
        customField = new CustomField("Modifié par", "utilisateurModification");
        customField.setClasse(java.lang.String.class);
        customField.setRang(5);
        fields.add(customField);
        customField = new CustomField("Modifié le", "dateDerniereModification");
        customField.setClasse(java.util.Date.class);
        customField.setPattern("dd/MM/yyyy");
        customField.setRang(6);
        fields.add(customField);
        desc.getFieldsToDisplay().addAll(fields);
        desc.setRepositoryFolder(repositoryPath);
        desc.getElementsToDisplay().addAll(setElementToDisplay());
        return desc;
    }
    public String construct(File templateFile, String repositoryPath) throws Exception {
        DescriptionEtat desc = construct(repositoryPath);
        Processor processor = new Processor();
        return processor.process(desc);
    }
    private List<ElementToDisplay> setElementToDisplay() {
        List<ElementToDisplay> labels = new ArrayList<>();
        ElementToDisplay label = new ElementToDisplay("Edité le", "");
        label.setElementType(ElementType.DATE_GENERE);
        label.setPosition(Position.RIGHT);
        labels.add(label);
        label = new ElementToDisplay("Edité par", "LOGIN_UTILISATEUR");
        label.setElementType(ElementType.PARAMETRE);
        label.setPosition(Position.RIGHT);
        labels.add(label);
        label = new ElementToDisplay("Nombre Total", "NOMBRE_TOTAL");
        label.setElementType(ElementType.PARAMETRE);
        label.setPosition(Position.LEFT);
        labels.add(label);
        return labels;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/test/CategorieDetailConstruct.java
New file
@@ -0,0 +1,93 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.test;
import com.megatim.reporting.adhoc.App;
import com.megatim.reporting.adhoc.process.Processor;
import com.megatim.reporting.adhoc.pojo.DescriptionEtat;
import com.megatim.reporting.adhoc.pojo.enums.ElementType;
import com.megatim.reporting.adhoc.pojo.enums.Position;
import com.megatim.reporting.adhoc.pojo.CustomField;
import com.megatim.reporting.adhoc.pojo.ElementToDisplay;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author ASUS
 */
public class CategorieDetailConstruct {
    public DescriptionEtat construct(String repositoryPath) {
        DescriptionEtat desc = new DescriptionEtat();
        desc.setHaveLineNumber(true);
        desc.setReportName("CategorieDetailRapport");
        desc.setRepositoryFolder(repositoryPath);
        desc.setDetail(true);
        desc.setTemplateFile(App.templateDetail);
        ArrayList<CustomField> fields = new ArrayList<>();
        CustomField customField = new CustomField("Libellé", "libelle");
        customField.setClasse(java.lang.String.class);
        customField.setRang(1);
        fields.add(customField);
        customField = new CustomField("Description", "description");
        customField.setClasse(java.lang.String.class);
        customField.setRang(2);
        fields.add(customField);
        customField = new CustomField("Crée par", "utilisateurCreation");
        customField.setClasse(java.lang.String.class);
        customField.setRang(3);
        fields.add(customField);
        customField = new CustomField("Crée le", "dateCreation");
        customField.setClasse(java.util.Date.class);
        customField.setPattern("dd/MM/yyyy");
        customField.setRang(4);
        fields.add(customField);
        customField = new CustomField("Modifié par", "utilisateurModification");
        customField.setClasse(String.class);
        customField.setRang(5);
        fields.add(customField);
        customField = new CustomField("Modifié le", "dateCreation");
        customField.setClasse(java.util.Date.class);
        customField.setPattern("dd/MM/yyyy");
        customField.setRang(6);
        fields.add(customField);
        desc.getFieldsToDisplay().addAll(fields);
        desc.getElementsToDisplay().addAll(setElementToDisplay());
        return desc;
    }
    public String construct(File templateFile, String repositoryPath) throws Exception {
        DescriptionEtat desc = construct(repositoryPath);
        Processor processor = new Processor();
        return processor.process(desc);
    }
    private List<ElementToDisplay> setElementToDisplay() {
        List<ElementToDisplay> labels = new ArrayList<>();
        ElementToDisplay label = new ElementToDisplay("Edité le", "");
        label.setElementType(ElementType.DATE_GENERE);
        label.setPosition(Position.RIGHT);
        labels.add(label);
        label = new ElementToDisplay("Edité par", "LOGIN_UTILISATEUR");
        label.setElementType(ElementType.PARAMETRE);
        label.setPosition(Position.RIGHT);
        labels.add(label);
        return labels;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/test/EntrepriseConstruct.java
New file
@@ -0,0 +1,118 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.test;
import com.megatim.reporting.adhoc.App;
import com.megatim.reporting.adhoc.process.Processor;
import com.megatim.reporting.adhoc.pojo.DescriptionEtat;
import com.megatim.reporting.adhoc.pojo.enums.ElementType;
import com.megatim.reporting.adhoc.pojo.enums.Position;
import com.megatim.reporting.adhoc.pojo.CustomField;
import com.megatim.reporting.adhoc.pojo.ElementToDisplay;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author ASUS
 */
public class EntrepriseConstruct {
    public DescriptionEtat construct(String repositoryPath) {
        DescriptionEtat desc = new DescriptionEtat();
        desc.setHaveLineNumber(true);
        desc.setRepositoryFolder(repositoryPath);
        desc.setReportName("EntrepriseRapport");
        desc.setTemplateFile(App.templateListe);
        ArrayList<CustomField> fields = new ArrayList<>();
        CustomField customField = new CustomField("Sigle", "sigle");
        customField.setClasse(java.lang.String.class);
        customField.setRang(1);
        fields.add(customField);
        customField = new CustomField("Catégorie", "categorie");
        customField.setClasse(java.lang.String.class);
        customField.setRang(2);
        fields.add(customField);
        customField = new CustomField("Tutelle", "tutelle");
        customField.setClasse(java.lang.String.class);
        customField.setRang(2);
        fields.add(customField);
        customField = new CustomField("Secteur activité", "secteurActivite");
        customField.setClasse(java.lang.String.class);
        customField.setRang(3);
        fields.add(customField);
        customField = new CustomField("StatutEntreprise", "statutEntreprise");
        customField.setClasse(java.lang.String.class);
        customField.setRang(4);
        fields.add(customField);
        customField = new CustomField("StatutEntreprise", "statutEntreprise");
        customField.setClasse(java.lang.String.class);
        customField.setRang(5);
        fields.add(customField);
        customField = new CustomField("Crée par", "utilisateurCreation");
        customField.setClasse(String.class);
        customField.setRang(6);
        fields.add(customField);
        customField = new CustomField("Crée le", "dateCreation");
        customField.setClasse(java.util.Date.class);
        customField.setPattern("dd/MM/yyyy");
        customField.setRang(7);
        fields.add(customField);
        customField = new CustomField("Modifié par", "utilisateurModification");
        customField.setClasse(String.class);
        customField.setRang(8);
        fields.add(customField);
        customField = new CustomField("Modifié le", "dateCreation");
        customField.setClasse(java.util.Date.class);
        customField.setPattern("dd/MM/yyyy");
        customField.setRang(9);
        fields.add(customField);
        desc.getFieldsToDisplay().addAll(fields);
        desc.getElementsToDisplay().addAll(setElementToDisplay());
        return desc;
    }
    public String construct(File templateFile, String repositoryPath) throws Exception {
        DescriptionEtat desc = construct(repositoryPath);
        Processor processor = new Processor();
        return processor.process(desc);
    }
    private List<ElementToDisplay> setElementToDisplay() {
        List<ElementToDisplay> labels = new ArrayList<>();
        ElementToDisplay label = new ElementToDisplay("Edité le", "");
        label.setElementType(ElementType.DATE_GENERE);
        label.setPosition(Position.RIGHT);
        labels.add(label);
        label = new ElementToDisplay("Edité par", "LOGIN_UTILISATEUR");
        label.setElementType(ElementType.PARAMETRE);
        label.setPosition(Position.RIGHT);
        labels.add(label);
        label = new ElementToDisplay("Nombre Total", "NOMBRE_TOTAL");
        label.setElementType(ElementType.PARAMETRE);
        label.setPosition(Position.LEFT);
        labels.add(label);
        return labels;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/util/PdfUtil.java
New file
@@ -0,0 +1,55 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.reporting.adhoc.util;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.util.JRLoader;
/**
 *
 * @author ASUS
 */
public class PdfUtil {
    public static File generatePdfFile(List<?> datas, String pdfFile, String jasperFilePath, Map params) throws Exception {
        // Creation d'un File sur le fichier
        File jasperFile = new File(jasperFilePath);
        File fichierGenerer = new File(pdfFile);
        //On cree le fichier s'ile n'existe pas
        if (!fichierGenerer.exists()) {
            //On cree le fichier
            fichierGenerer.createNewFile();
        }
        // Chargement du Rapport
        JasperReport report = null;
        // Etat rempli
        JasperPrint jasperPrint = null;
        // Chargement du report
        report = (JasperReport) JRLoader.loadObject(jasperFile);
        jasperPrint = JasperFillManager.fillReport(report, params, new JRBeanCollectionDataSource(datas, false));
        OutputStream output = new FileOutputStream(fichierGenerer);
        JasperExportManager.exportReportToPdfStream(jasperPrint, output);
        output.close();
        return fichierGenerer;
    }
}
reporting-adhoc/src/main/java/com/megatim/reporting/adhoc/util/PrintableColumnExtractor.java
New file
@@ -0,0 +1,115 @@
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
 */
package com.megatim.reporting.adhoc.util;
import com.megatim.reporting.adhoc.annotations.PrintColumn;
import com.megatim.reporting.adhoc.annotations.PrintList;
import com.megatim.reporting.adhoc.pojo.CustomField;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
 *
 * @author ASUS
 */
public class PrintableColumnExtractor {
    private PrintableColumnExtractor() {
    }
    public static List<CustomField> extract(Class<?> clazz) {
        List<CustomField> customFields = new ArrayList<>();
        customFields.addAll(extractFromFields(clazz));
        customFields.addAll(extractFromMethods(clazz));
        List<CustomField> sortedFields = customFields.stream()
            .sorted(Comparator.comparingInt(CustomField::getRang))
            .collect(Collectors.toList());
        return sortedFields;
    }
    public static List<CustomField> extractListFields(Class<?> clazz, CustomField printableListField) {
        List<CustomField> customFields = new ArrayList<>();
        List<Field> fields = Arrays.asList(clazz.getDeclaredFields());
        fields.stream()
                .filter(f -> {
                    PrintList printList = f.getAnnotation(PrintList.class);
                    return printList != null && printList.titre().equals(printableListField.getLibelle());
                })
                .findFirst()
                .ifPresent(c -> {
                    PrintList printList = c.getAnnotation(PrintList.class);
                    customFields.addAll(extract(printList.classe()));
                });
        return customFields;
    }
    private static List<CustomField> extractFromFields(Class<?> clazz) {
        List<CustomField> customFields = new ArrayList<>();
        Field[] fields = clazz.getDeclaredFields();
        for (Field f : fields) {
            PrintColumn printColumn = f.getAnnotation(PrintColumn.class);
            PrintList printList = f.getAnnotation(PrintList.class);
            if (printColumn != null) {
                CustomField customField = new CustomField(printColumn.libelle(), f.getName());
                customField.setClasse(f.getType());
                customField.setRang(printColumn.rang());
                customField.setWidth(printColumn.width());
                customFields.add(customField);
            } else {
                if (printList != null
                        && (java.util.List.class.isAssignableFrom(f.getType()) || java.util.Set.class.isAssignableFrom(f.getType()))) {
                    CustomField customField = new CustomField(printList.titre(), f.getName());
                    customField.setClasse(f.getType());
                    customFields.add(customField);
                }
            }
        }
        return customFields;
    }
    private static List<CustomField> extractFromMethods(Class<?> clazz) {
        List<CustomField> customFields = new ArrayList<>();
        Method[] methods = clazz.getDeclaredMethods();
        for (Method m : methods) {
            PrintColumn printColumn = m.getAnnotation(PrintColumn.class);
            String fieldName = extractFieldNameFromMethod(m);
            if (printColumn != null && fieldName != null) {
                CustomField customField = new CustomField(printColumn.libelle(), fieldName);
                customField.setClasse(m.getReturnType());
                customField.setRang(printColumn.rang());
                customFields.add(customField);
            }
        }
        return customFields;
    }
    private static String extractFieldNameFromMethod(Method method) {
        String methodName = method.getName();
        if (methodName.length() > 4 && methodName.startsWith("get")
                && ((int) methodName.charAt(3) >= 65 && (int) methodName.charAt(3) <= 90)) {
            String firstChar = methodName.charAt(3) + "";
            return firstChar.toLowerCase() + methodName.substring(4);
        }
        return null;
    }
}
reporting-adhoc/src/main/resources/report-parts/groups.xml
New file
@@ -0,0 +1,12 @@
    <group name="Groupe1" isStartNewPage="true" minHeightToStartNewPage="60">
        <groupHeader>
            <band splitType="Immediate">
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
            </band>
        </groupHeader>
        <groupFooter>
            <band splitType="Immediate">
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
            </band>
        </groupFooter>
    </group>
reporting-adhoc/src/main/resources/report-parts/page-properties.xml
New file
@@ -0,0 +1,10 @@
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
reporting-adhoc/src/main/resources/report-parts/parameters.xml
New file
@@ -0,0 +1 @@
    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="true"/>
reporting-adhoc/src/main/resources/report-parts/variables.xml
New file
@@ -0,0 +1,7 @@
    <variable name="REPORT_PAGE" class="java.lang.Integer" resetType="None" incrementType="Page">
        <variableExpression><![CDATA[$V{PAGE_NUMBER}]]></variableExpression>
    </variable>
    <variable name="LINE_NUMBER" class="java.lang.Long" resetType="Group" resetGroup="Groupe1" calculation="Count">
        <variableExpression><![CDATA[Boolean.TRUE]]></variableExpression>
        <initialValueExpression><![CDATA[new Long(1)]]></initialValueExpression>
    </variable>
reporting-adhoc/target/classes/.netbeans_automatic_build
reporting-adhoc/target/classes/report-parts/groups.xml
New file
@@ -0,0 +1,12 @@
    <group name="Groupe1" isStartNewPage="true" minHeightToStartNewPage="60">
        <groupHeader>
            <band splitType="Immediate">
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
            </band>
        </groupHeader>
        <groupFooter>
            <band splitType="Immediate">
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
            </band>
        </groupFooter>
    </group>
reporting-adhoc/target/classes/report-parts/page-properties.xml
New file
@@ -0,0 +1,10 @@
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
reporting-adhoc/target/classes/report-parts/parameters.xml
New file
@@ -0,0 +1 @@
    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="true"/>
reporting-adhoc/target/classes/report-parts/variables.xml
New file
@@ -0,0 +1,7 @@
    <variable name="REPORT_PAGE" class="java.lang.Integer" resetType="None" incrementType="Page">
        <variableExpression><![CDATA[$V{PAGE_NUMBER}]]></variableExpression>
    </variable>
    <variable name="LINE_NUMBER" class="java.lang.Long" resetType="Group" resetGroup="Groupe1" calculation="Count">
        <variableExpression><![CDATA[Boolean.TRUE]]></variableExpression>
        <initialValueExpression><![CDATA[new Long(1)]]></initialValueExpression>
    </variable>
reporting-adhoc/target/maven-archiver/pom.properties
New file
@@ -0,0 +1,5 @@
#Generated by Maven
#Wed Oct 22 11:55:14 WAT 2025
version=1.0
groupId=com.megatim
artifactId=reporting-adhoc
reporting-adhoc/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
New file
@@ -0,0 +1,54 @@
com\megatim\reporting\adhoc\pojo\layouts\ColumnHeader.class
com\megatim\reporting\adhoc\pojo\enums\ElementType.class
com\megatim\reporting\adhoc\pojo\enums\Section.class
com\megatim\reporting\adhoc\pojo\Constantes.class
com\megatim\reporting\adhoc\dto\Column.class
com\megatim\reporting\adhoc\pojo\ElementToDisplay.class
com\megatim\reporting\adhoc\pojo\DescriptionSousEtat.class
com\megatim\reporting\adhoc\pojo\components\Component.class
com\megatim\reporting\adhoc\test\CategorieConstruct.class
com\megatim\reporting\adhoc\pojo\DescriptionEtat.class
com\megatim\reporting\adhoc\annotations\PrintColumn.class
com\megatim\reporting\adhoc\pojo\ProcessorElements.class
com\megatim\reporting\adhoc\dto\HeaderData.class
com\megatim\reporting\adhoc\pojo\components\ValueElement.class
com\megatim\reporting\adhoc\pojo\enums\Position.class
com\megatim\reporting\adhoc\process\ParseXMLTemplate.class
com\megatim\reporting\adhoc\pojo\enums\ValueElementType.class
com\megatim\reporting\adhoc\pojo\layouts\Report.class
com\megatim\reporting\adhoc\pojo\enums\ComponentType.class
com\megatim\reporting\adhoc\pojo\SubReportDefinition.class
com\megatim\reporting\adhoc\pojo\layouts\ColumnData.class
com\megatim\reporting\adhoc\dto\ReportConfiguration.class
com\megatim\reporting\adhoc\pojo\MainReportDefinition.class
com\megatim\reporting\adhoc\util\PdfUtil.class
com\megatim\reporting\adhoc\test\CategorieDetailConstruct.class
com\megatim\dynamic\reports\pojo\LargestWidth.class
com\megatim\reporting\adhoc\process\SecondProcessor.class
com\megatim\reporting\adhoc\pojo\components\Border.class
com\megatim\reporting\adhoc\pojo\layouts\Layout.class
com\megatim\reporting\adhoc\pojo\components\Label.class
com\megatim\reporting\adhoc\pojo\components\TextField.class
com\megatim\reporting\adhoc\pojo\CustomField.class
com\megatim\dynamic\reports\pojo\DisplayCondition.class
com\megatim\reporting\adhoc\pojo\layouts\MainReport.class
com\megatim\reporting\adhoc\pojo\components\Line.class
com\megatim\reporting\adhoc\pojo\layouts\SubReport.class
com\megatim\reporting\adhoc\pojo\layouts\PageFooter.class
com\megatim\reporting\adhoc\pojo\enums\ReportOrientation.class
com\megatim\reporting\adhoc\pojo\xml\ReportTag.class
com\megatim\reporting\adhoc\dto\PrintableColumn.class
com\megatim\reporting\adhoc\pojo\components\Paragraph.class
com\megatim\reporting\adhoc\pojo\layouts\PageHeader.class
com\megatim\reporting\adhoc\pojo\layouts\Title.class
com\megatim\reporting\adhoc\pojo\components\Image.class
com\megatim\reporting\adhoc\App.class
com\megatim\reporting\adhoc\process\GenerateJRXML$1.class
com\megatim\reporting\adhoc\process\GenerateJRXML.class
com\megatim\reporting\adhoc\annotations\PrintList.class
com\megatim\reporting\adhoc\pojo\components\TextComponent.class
com\megatim\reporting\adhoc\process\Processor.class
com\megatim\reporting\adhoc\test\EntrepriseConstruct.class
com\megatim\reporting\adhoc\util\PrintableColumnExtractor.class
com\megatim\reporting\adhoc\process\SecondProcessor$1.class
com\megatim\reporting\adhoc\pojo\ReportDefinition.class
reporting-adhoc/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
New file
@@ -0,0 +1,52 @@
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\layouts\PageFooter.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\layouts\ColumnHeader.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\dto\ReportConfiguration.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\MainReportDefinition.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\dto\PrintableColumn.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\Constantes.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\layouts\Report.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\layouts\MainReport.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\ProcessorElements.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\components\Border.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\annotations\PrintColumn.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\dto\Column.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\enums\ElementType.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\enums\ComponentType.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\LargestWidth.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\App.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\enums\Section.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\components\ValueElement.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\CustomField.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\layouts\Layout.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\components\TextComponent.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\test\CategorieConstruct.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\DescriptionEtat.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\util\PdfUtil.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\layouts\Title.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\xml\ReportTag.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\test\CategorieDetailConstruct.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\process\GenerateJRXML.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\dto\HeaderData.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\process\Processor.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\components\Image.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\SubReportDefinition.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\layouts\PageHeader.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\ReportDefinition.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\components\Component.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\DescriptionSousEtat.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\DisplayCondition.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\ElementToDisplay.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\layouts\ColumnData.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\process\ParseXMLTemplate.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\process\SecondProcessor.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\annotations\PrintList.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\components\Line.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\components\Paragraph.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\enums\ValueElementType.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\enums\Position.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\layouts\SubReport.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\enums\ReportOrientation.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\test\EntrepriseConstruct.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\util\PrintableColumnExtractor.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\components\Label.java
C:\Users\ASUS\Documents\NetBeansProjects\share_sources\dynamic-reports\src\main\java\com\megatim\reporting\adhoc\pojo\components\TextField.java
reporting-adhoc/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
reporting-adhoc/target/test-classes/.netbeans_automatic_build