ERP en LOGICIEL LIBRE dédié aux PME-PMI

           Devenez partenaire Principal ou Majeur de Neogia

Chargement de donnée avec Neogia


Cette page va vous permettre de charger rapidement un jeu de données dans n'importe quelle base. Dans notre exemple, nous prendrons MySQL comme exemple d'un SGBD et Demo comme base de données.

Contents

Création de la Base de données

 :~$ mysql -u root -p
 mysql> create database demoNeogia;
 mysql> use demoNeogia;
 mysql> create user neogia;
 mysql> grant all privileges on demoNeogia.* to 'neogia'@'localhost' identified by 'neogia' with grant option;
 msql> \q
 :~$ mysql demoNeogia -u neogia -p neogia

Changement de la configuration standard de Neogia

Dans un environnement Neogia qui fonctionne correctement :

pour plus de détail, cliquer sur le lien

de

 <inline-jdbc
               jdbc-driver="com.mysql.jdbc.Driver"
               jdbc-uri="jdbc:mysql://127.0.0.1/ofbiz?autoReconnect=true"
               jdbc-username="ofbiz"
               jdbc-password="ofbiz"
               isolation-level="ReadCommitted"
               pool-minsize="2"
               pool-maxsize="20"/>

à

 <inline-jdbc
               jdbc-driver="org.gjt.mm.mysql.Driver"
               jdbc-uri="jdbc:mysql://127.0.0.1/demoNeogia"
               jdbc-username="neogia"
               jdbc-password="neogia"
               isolation-level="ReadCommitted"
               pool-minsize="2"
               pool-maxsize="20"/>


à partir du fichier exemple-site.properties en modifiant juste la dernière ligne de

 # ofbiz.neogia.site.conf=conf/postgresql-8.0

à

 ofbiz.neogia.site.conf=conf/demoPentaho

description du schéma de la base de données

 <entitygroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/entitygroup.xsd">
    <entity-group group="org.ofbiz.pentaho" entity="costFact"/>
 </entitygroup>
   <entity entity-name="costFact"
           package-name="org.ofbiz.manufacturing.project">
       <field name="timeId" type="date-time"></field>
       <field name="elementId" type="name"></field>
       <field name="phaseCode" type="name"></field>
       <field name="totalCost" type="floating-point"></field>
       <prim-key field="timeId"/>
       <prim-key field="elementID"/>
       <prim-key field="phaseCode"/>
       <relation type="one" fk-name="costElement" rel-entity-name="costElement">
           <key-map field-name="elementId" rel-field-name="elementId"/>
       </relation>
       <relation type="one" fk-name="phase" rel-entity-name="phases">
           <key-map field-name="phaseCode" rel-field-name="phase_code"/>
       </relation>
       <relation type="one" fk-name="timePeriod" rel-entity-name="timePeriod">
           <key-map field-name="timeId" rel-field-name="time_id"/>
       </relation>
 </entity>


description du jeu de données de base

data : il suffit d'importer un fichier de description d'un jeu de données d'un autre répertoire data exemple: $INSTALL_DIR/neogia/manufacturing/data/mesDonnees.xml qui a la forme suivante :

 <entity-engine-xml>
   <accountFact timeId="1" elementId="2" phaseCode="3" totalCost="100000"/>
 </entity-engine-xml>


où accountFact est le nom de la table et timeId est l'une des colonnes de la table.

La derniére étape consiste à spécifier à Neogia, que le nouveau dossier "pentaho" est un composant OFBiz à charger avec les autres composants en quatre étapes :

de

 <ofbiz-component name="facility"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/ofbiz-component.xsd">
   <resource-loader name="main" type="component"/>
   
   <classpath type="jar" location="build/lib/*"/>
   
   <classpath type="dir" location="config"/>
   <classpath type="dir" location="script"/>    
   <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
   <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/>
   <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_view.xml"/>
   <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup_view.xml"/>
   <entity-resource type="eca" reader-name="main" loader="main" location="entitydef/eecas.xml"/>
   <entity-resource type="data" reader-name="seed" loader="main" location="data/FacilityData.xml"/>
   <entity-resource type="data" reader-name="neogiademo" loader="main" location="data/DemoFacilityData.xml"/>
   <service-resource type="model" loader="main" location="servicedef/generated/services.xml"/>
   <service-resource type="model" loader="main" location="servicedef/developed/services.xml"/>
   <service-resource type="eca" loader="main" location="servicedef/developed/secas.xml"/>     
   <webapp name="facility" 
           title="Facility" 
   	    server="default-server" 
   	    location="webapp/facility"
           base-permission="FACILITY"
   	    mount-point="/facility"/>    	    
 </ofbiz-component>

à

 <ofbiz-component name="pentaho"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/ofbiz-component.xsd">
   <resource-loader name="main" type="component"/>
   <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/>
   <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
   <entity-resource type="data" reader-name="ComptaBIDemo" loader="main" location="data/ComptaBIDemo.xml"/>    
 </ofbiz-component>
   <load-component component-location="${ofbiz.home}/neogia/pentaho"/>

à l'intérieur de l'élément component-loader

   <target name="run-install-ComptaBIDemo" depends="build">
       <java jar="ofbiz.jar" fork="true">
           <jvmarg value="${memory.max.param}"/>
           <arg value="install"/>
           <arg value="readers=ComptaBIDemo"/>
       </java>
   </target>
   <entity-data-reader name="ComptaBIDemo"/>

et la ligne suivante dans le datasource:

   <datasource name="localmysql".................................
       <read-data reader-name="ComptaBIDemo"/>..................................
 </datasource>

lancement du chargement