<?xml version="1.0" encoding="ISO-8859-1"?>
<persistence-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../defs/config-metier/Persistence.xsd">
    <layer name="mysql" persistence-model="xemelios-sql">
        <!-- persistence-model defines the way informations are defined -->
        <!-- only xemelios-sql is defined at this moment -->
        <document id="DocServiceFait" repository-import-xslt-file="">
            <table type="repository" base-name="FEN0072A_REPOSITORY" version="2">
                CREATE TABLE IF NOT EXISTS ${base-name} ( ID VARCHAR(25), LIBELLE VARCHAR(100), COLLECTIVITE VARCHAR(15) NOT NULL, REPOSITORY LONGBLOB, ENCODING VARCHAR(20) ) TYPE MYISAM <patch from-version="1">
                    <sql failonerror="false">ALTER TABLE ${base-name} ADD ID VARCHAR(25)</sql>
                    <sql failonerror="false">ALTER TABLE ${base-name} ADD LIBELLE VARCHAR(100)</sql>
                </patch>
            </table>
            <table type="special-key" base-name="FEN0072A_SPECIAL_KEYS" version="1"> CREATE TABLE IF NOT EXISTS ${base-name} ( COLLECTIVITE VARCHAR(15) NOT NULL, BUDGET VARCHAR(24) NOT NULL, INITIAL_DOC_NAME VARCHAR(100) NOT NULL, KEY1 VARCHAR(100) NOT NULL, LIB1 VARCHAR(200), KEY2 VARCHAR(100), LIB2 VARCHAR(200), KEY3 VARCHAR(100), LIB3 VARCHAR(200), INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET) ) TYPE MYISAM </table>
            <table type="list-bc" base-name="FEN0072A_LIST_BUDG_COLL" version="1"> CREATE TABLE IF NOT EXISTS ${base-name} ( COLLECTIVITE VARCHAR(15) NOT NULL, BUDGET VARCHAR(24) NOT NULL, BUDGET_LIB VARCHAR(200), COLLECTIVITE_LIB VARCHAR(200), INITIAL_DOC_NAME VARCHAR(100) NOT NULL, INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET) ) TYPE MYISAM </table>

            <etat id="FEN0072A" import-xslt-file="service-fait/etatFen0072a-import-mysql.xsl">
                    <key1>
                        <path>/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/@added:generated-id</path>
                    </key1>
                    
                    <table type="document" base-name="SERVICE_FAIT_DOCUMENTS" version="1">
                        CREATE TABLE IF NOT EXISTS ${base-name} ( 
                        COLLECTIVITE VARCHAR(15) NOT NULL, 
                        BUDGET VARCHAR(24) NOT NULL, 
                        INITIAL_DOC_NAME VARCHAR(100) NOT NULL, 
                        DOC_ID VARCHAR(100) NOT NULL, 
                        DOC LONGBLOB, 
                        ENCODING VARCHAR(20), 
                        INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET,DOC_ID) 
                        ) TYPE MYISAM
                    </table>
                <table type="index" id="FEN0072A_SERVICE_FAIT_IX" base-name="SERVICE_FAIT_IX" version="2" main="true">
                        CREATE TABLE IF NOT EXISTS ${base-name} ( 
                        COLLECTIVITE VARCHAR(15) NOT NULL, 
                        BUDGET VARCHAR(24) NOT NULL, 
                        DOC_ID VARCHAR(100) NOT NULL, 
                        NODE_ID VARCHAR(50) NOT NULL, 
                        BILL_OF_LADING VARCHAR(255) ,
                        GR_GI_SLIP_NO VARCHAR(255) ,
                        DATE_CPT VARCHAR(255) ,
                        TXT_ENTETE VARCHAR(255) ,
                        CODE_APPLI VARCHAR(255) ,
                        MOTIF_MVT VARCHAR(255) ,
                        DATE_DOC VARCHAR(255) ,
                        CODE_MVT VARCHAR(255) ,
                        ID_AE VARCHAR(255) ,
                        ID_UNIQUE VARCHAR(75),
                        PR_UNAME VARCHAR(255) ,
                        INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET,DOC_ID), 
                        INDEX IX_${base-name}_DC (DOC_ID) 
                        ) TYPE MYISAM
                        <patch from-version="1">
                            <sql failonerror="false">ALTER TABLE ${base-name} ADD ID_UNIQUE VARCHAR(75)</sql>
                        </patch>
                    </table>
                    <table type="index" id="FEN0072A_SERVICE_FAIT_POSTE_IX" base-name="SERVICE_FAIT_POSTE_IX" version="2" main="false" based-on="key1">
                        CREATE TABLE IF NOT EXISTS ${base-name} ( 
                        COLLECTIVITE VARCHAR(15) NOT NULL, 
                        BUDGET VARCHAR(24) NOT NULL, 
                        DOC_ID VARCHAR(100) NOT NULL, 
                        NODE_ID VARCHAR(50) NOT NULL, 
                        ID_FONC_SUPPL VARCHAR(255) ,
                        GR_COMPTES_SUPPL VARCHAR(255) ,
                        TXT_PST VARCHAR(255) ,
                        PO_NUMBER VARCHAR(255) ,
                        PO_ITEM VARCHAR(255) ,
                        QUANTITY VARCHAR(255) ,
                        ID_CHOR_SUPPL VARCHAR(255) ,
                        UNIT VARCHAR(255) ,
                        ID_LIG VARCHAR(255) ,
                        STGE_LOC VARCHAR(255) ,
                        ID_AE VARCHAR(255) ,
                        INDEX IX_${base-name}_BC (COLLECTIVITE,BUDGET,DOC_ID), 
                        INDEX IX_${base-name}_DC (DOC_ID) 
                        ) TYPE MYISAM
                        <patch from-version="1">
                            <sql failonerror="false">ALTER TABLE ${base-name} ADD GR_COMPTES_SUPPL VARCHAR(225)</sql>
                        </patch> 
                    </table>
                    
                    
                    <!-- CRITERIA /FEN0072A -->
                    
                    <!-- CRITERIA /FEN0072A/SERVICE_FAIT -->
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_BILL_OF_LADING" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_BILL_OF_LADING">
                        <where-clause>fn:string-compare(${table}.${column},BILL_OF_LADING)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_GR_GI_SLIP_NO" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_GR_GI_SLIP_NO">
                        <where-clause>fn:string-compare(${table}.${column},GR_GI_SLIP_NO)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_DATE_CPT" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_DATE_CPT">
                        <where-clause>fn:string-compare(${table}.${column},DATE_CPT)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_TXT_ENTETE" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_TXT_ENTETE">
                        <where-clause>fn:string-compare(${table}.${column},TXT_ENTETE)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_CODE_APPLI" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_CODE_APPLI">
                        <where-clause>fn:string-compare(${table}.${column},CODE_APPLI)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_MOTIF_MVT" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_MOTIF_MVT">
                        <where-clause>fn:string-compare(${table}.${column},MOTIF_MVT)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_DATE_DOC" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_DATE_DOC">
                        <where-clause>fn:string-compare(${table}.${column},DATE_DOC)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_CODE_MVT" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_CODE_MVT">
                        <where-clause>fn:string-compare(${table}.${column},CODE_MVT)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_ID_AE" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_ID_AE">
                        <where-clause>fn:string-compare(${table}.${column},ID_AE)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_PR_UNAME" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_PR_UNAME">
                        <where-clause>fn:string-compare(${table}.${column},PR_UNAME)</where-clause>
                    </criteria>
                    
                    <!-- CRITERIA /FEN0072A/SERVICE_FAIT/POSTE -->
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_POSTE_ID_FONC_SUPPL" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_POSTE_ID_FONC_SUPPL">
                        <where-clause>fn:string-compare(${table}.${column},ID_FONC_SUPPL)</where-clause>
                    </criteria>
                <criteria id="CRI_FEN0072A_SERVICE_FAIT_POSTE_GR_COMPTES_SUPPL" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_POSTE_GR_COMPTES_SUPPL">
                    <where-clause>fn:string-compare(${table}.${column},GR_COMPTES_SUPPL)</where-clause>
                   </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_POSTE_TXT_PST" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_POSTE_TXT_PST">
                        <where-clause>fn:string-compare(${table}.${column},TXT_PST)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_POSTE_PO_NUMBER" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_POSTE_PO_NUMBER">
                        <where-clause>fn:string-compare(${table}.${column},PO_NUMBER)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_POSTE_PO_ITEM" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_POSTE_PO_ITEM">
                        <where-clause>fn:string-compare(${table}.${column},PO_ITEM)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_POSTE_QUANTITY" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_POSTE_QUANTITY">
                        <where-clause>fn:string-compare(${table}.${column},QUANTITY)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_POSTE_ID_CHOR_SUPPL" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_POSTE_ID_CHOR_SUPPL">
                        <where-clause>fn:string-compare(${table}.${column},ID_CHOR_SUPPL)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_POSTE_UNIT" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_POSTE_UNIT">
                        <where-clause>fn:string-compare(${table}.${column},UNIT)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_POSTE_ID_LIG" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_POSTE_ID_LIG">
                        <where-clause>fn:string-compare(${table}.${column},ID_LIG)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_POSTE_STGE_LOC" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_POSTE_STGE_LOC">
                        <where-clause>fn:string-compare(${table}.${column},STGE_LOC)</where-clause>
                    </criteria>
                    <criteria id="CRI_FEN0072A_SERVICE_FAIT_POSTE_ID_AE" type="1" sql-index-id="SQI_FEN0072A_SERVICE_FAIT_POSTE_ID_AE">
                        <where-clause>fn:string-compare(${table}.${column},ID_AE)</where-clause>
                    </criteria>
                    
                    
                    <!-- SQL-INDEX /FEN0072A -->
                    
                    <!-- SQL-INDEX /FEN0072A/SERVICE_FAIT -->
                    <sql-index id="EF_UNIQUE_ID_IX" table="FEN0072A_SERVICE_FAIT_IX" column="ID_UNIQUE" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/@ano:unique-id" datatype="string"/>
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT__NODE_ID" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/@added:generated-id" column="NODE_ID" datatype="string" table="FEN0072A_SERVICE_FAIT_IX"/>
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_BILL_OF_LADING" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:ENTETE/n:BILL_OF_LADING/text()" datatype="string" column="BILL_OF_LADING" table="FEN0072A_SERVICE_FAIT_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_GR_GI_SLIP_NO" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:ENTETE/n:GR_GI_SLIP_NO/text()" datatype="string" column="GR_GI_SLIP_NO" table="FEN0072A_SERVICE_FAIT_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_DATE_CPT" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:ENTETE/n:DATE_CPT/text()" datatype="string" column="DATE_CPT" table="FEN0072A_SERVICE_FAIT_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_TXT_ENTETE" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:ENTETE/n:TXT_ENTETE/text()" datatype="string" column="TXT_ENTETE" table="FEN0072A_SERVICE_FAIT_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_CODE_APPLI" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:ENTETE/n:CODE_APPLI/text()" datatype="string" column="CODE_APPLI" table="FEN0072A_SERVICE_FAIT_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_MOTIF_MVT" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:ENTETE/n:MOTIF_MVT/text()" datatype="string" column="MOTIF_MVT" table="FEN0072A_SERVICE_FAIT_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_DATE_DOC" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:ENTETE/n:DATE_DOC/text()" datatype="string" column="DATE_DOC" table="FEN0072A_SERVICE_FAIT_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_CODE_MVT" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:ENTETE/n:CODE_MVT/text()" datatype="string" column="CODE_MVT" table="FEN0072A_SERVICE_FAIT_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_ID_AE" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:ENTETE/n:ID_AE/text()" datatype="string" column="ID_AE" table="FEN0072A_SERVICE_FAIT_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_PR_UNAME" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:ENTETE/n:PR_UNAME/text()" datatype="string" column="PR_UNAME" table="FEN0072A_SERVICE_FAIT_IX" />
                    
                    <!-- SQL-INDEX /FEN0072A/SERVICE_FAIT/POSTE -->
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE__NODE_ID" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:@added:generated-id" column="NODE_ID" datatype="string" table="FEN0072A_SERVICE_FAIT_POSTE_IX"/>
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE_ID_FONC_SUPPL" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:ID_FONC_SUPPL/text()" datatype="string" column="ID_FONC_SUPPL" table="FEN0072A_SERVICE_FAIT_POSTE_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE_GR_COMPTES_SUPPL" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:GR_COMPTES_SUPPL/text()" datatype="string" column="GR_COMPTES_SUPPL" table="FEN0072A_SERVICE_FAIT_POSTE_IX" />
                   <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE_TXT_PST" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:TXT_PST/text()" datatype="string" column="TXT_PST" table="FEN0072A_SERVICE_FAIT_POSTE_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE_PO_NUMBER" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:PO_NUMBER/text()" datatype="string" column="PO_NUMBER" table="FEN0072A_SERVICE_FAIT_POSTE_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE_PO_ITEM" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:PO_ITEM/text()" datatype="string" column="PO_ITEM" table="FEN0072A_SERVICE_FAIT_POSTE_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE_QUANTITY" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:QUANTITY/text()" datatype="string" column="QUANTITY" table="FEN0072A_SERVICE_FAIT_POSTE_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE_ID_CHOR_SUPPL" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:ID_CHOR_SUPPL/text()" datatype="string" column="ID_CHOR_SUPPL" table="FEN0072A_SERVICE_FAIT_POSTE_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE_UNIT" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:UNIT/text()" datatype="string" column="UNIT" table="FEN0072A_SERVICE_FAIT_POSTE_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE_ID_LIG" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:ID_LIG/text()" datatype="string" column="ID_LIG" table="FEN0072A_SERVICE_FAIT_POSTE_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE_STGE_LOC" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:STGE_LOC/text()" datatype="string" column="STGE_LOC" table="FEN0072A_SERVICE_FAIT_POSTE_IX" />
                    <sql-index id="SQI_FEN0072A_SERVICE_FAIT_POSTE_ID_AE" path="/n:DocServiceFait/n:FEN0072A/n:SERVICE_FAIT/n:POSTE/n:ID_AE/text()" datatype="string" column="ID_AE" table="FEN0072A_SERVICE_FAIT_POSTE_IX" />
                    
                    <element id="FEN0072A_SERVICE_FAIT_POSTE_IX"> 
                        <sql-count>COUNT(DISTINCT(CONCAT(FEN0072A_SERVICE_FAIT_IX.DOC_ID,FEN0072A_SERVICE_FAIT_POSTE_IX.NODE_ID)))</sql-count>
                        <special-cond>FEN0072A_SERVICE_FAIT_POSTE_IX.NODE_ID IS NOT NULL</special-cond>
                    </element>
                    
                </etat>
        </document>
    </layer>
</persistence-config>
