AnsweredAssumed Answered

[Résolu] Création d'un modèle de données

Question asked by zubrows on Aug 27, 2009
Latest reply on Aug 27, 2009 by zubrows
Bonjour,

je fais appel à vos services, car je n'arrive pas à voir où j'ai pu faire une erreur.
J'ai créé mes différents fichiers:
achat-model-context.xml
<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>



<beans>



    <!– Registration of new models –>   

    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">

        <property name="models">

            <list>

                <value>alfresco/extension/achatModel.xml</value>

            </list>

        </property>

    </bean>

         

</beans>

achatModel.xml:
<?xml version="1.0" encoding="UTF-8"?>



<!– Definition of new Model –>



<!– The important part here is the name - Note: the use of the my: namespace

     which is defined further on in the document –>

<model name="achat:model" xmlns="http://www.alfresco.org/model/dictionary/1.0">



   <!– Optional meta-data about the model –>  

   <description>Modèle pour les demandes d'achat</description>

   <author>Laurent Ammar-Khodja</author>

   <version>1.0</version>



   <!– Imports are required to allow references to definitions in other models –>  

   <imports>

        <!– Import Alfresco Dictionary Definitions –>

      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>

      <!– Import Alfresco Content Domain Model Definitions –>

      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>

   </imports>


<!– Introduction of new namespaces defined by this model –>
<namespaces>
  <namespace uri="http://www.satelec-etec.fr/model/achat/1.0" prefix="achat" />
</namespaces>

<types>
  <!– Definition of new Content Type: Demande d'achat –>
  <type name="achat:achat">
      <title>Demande d'achat</title>
      <parent>cm:content</parent>
      <properties>
     <property name="achat:nom">
      <title>Nom</title>
                <type>d:text</type>
      <mandatory>true</mandatory>
          </property>
     <property name="achat:validation_compta">
      <title>Validation de la comptabilité</title>
                <type>d:text</type>
      <mandatory>true</mandatory>
          </property>
     <property name="achat:date_compta">
      <title>Date de validation de la comptabilité</title>
                <type>d:date</type>
      <mandatory>true</mandatory>
          </property>
     <property name="achat:validation_direction">
      <title>Validation de la direction</title>
                <type>d:text</type>
      <mandatory>true</mandatory>
          </property>
     <property name="achat:date_direction">
      <title>Date de validation de la direction</title>
                <type>d:date</type>
      <mandatory>true</mandatory>
          </property>
     <property name="achat:commande">
      <title>Date de réalisation de la commande</title>
                <type>d:date</type>
      <mandatory>true</mandatory>
          </property>
     <property name="achat:validation_reception">
      <title>Validation à de la réception du/des produit(s)</title>
                <type>d:text</type>
      <mandatory>true</mandatory>
          </property>
     <property name="achat:date_reception">
      <title>Date de validation de la réception du/des produit(s)</title>
                <type>d:date</type>
      <mandatory>true</mandatory>
          </property>
  </type>
</types>

</model>

Et j'ai modifié le web-client-config-custom.xml:
<!– Description du modèle de demande d'achat–>

<!– show related documents association on doc property sheet –>

<config evaluator="node-type" condition="achat:doc">
  <property-sheet>
      <show-property name="achat:nom" display-label-id="Nom de l'achat" />
      <show-property name="achat:validation_compta" display-label-id="Validation de la comptabilité" />
      <show-property name="achat:date_compta" display-label-id="Date de validation de la comptabilité" />
      <show-property name="achat:validation_direction" display-label-id="Validation de la direction" />
      <show-property name="achat:date_direction" display-label-id="Date de validation de la direction" />
      <show-property name="achat:commande" display-label-id="Date de réalisation de la commande" />
      <show-property name="achat:validation_reception" display-label-id="Validation de la récetion du/des produit(s)" />
      <show-property name="achat:date_reception" display-label-id="Date de validation de la réception" />
  </property-sheet>
</config>

<!–  add achat types to add content list –>
<config evaluator="string-compare" condition="Content Wizards">
  <content-types>
      <type name="achat:doc" />
  </content-types>
</config>

<config evaluator="string-compare" condition="Action Wizards">
  <!– The list of types shown in the is-subtype condition –>
  <subtypes>
      <type name="achat:doc" />
  </subtypes>

  <!– The list of content and/or folder types shown in the specialise-type action –>
  <specialise-types>
      <type name="achat:doc" />
  </specialise-types> 
</config>

<config evaluator="string-compare" condition="Advanced Search">
  <advanced-search>
      <content-types>
          <type name="achat:doc" />
      </content-types>
  </advanced-search>
</config>


Je relance Alfresco, et il m'affiche cette erreur dans le log:
14:55:50,528 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extension.dictionaryBootstrap' defined in file [/opt/Alfresco/tomcat/shared/classes/alfresco/extension/achat-model-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 07270001 Could not import bootstrap model alfresco/extension/achatModel.xml
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 07270001 Could not import bootstrap model alfresco/extension/achatModel.xml
   at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:151)
   at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:108)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1242)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1208)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
   at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:69)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
   at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
   at org.apache.catalina.core.StandardService.start(StandardService.java:516)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 07270000 Failed to parse model
   at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:99)
   at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:146)
   … 43 more
Caused by: org.jibx.runtime.JiBXException: Error parsing document (line 73, col 10)
   at org.jibx.runtime.impl.XMLPullReaderFactory$XMLPullReader.next(XMLPullReaderFactory.java:285)
   at org.jibx.runtime.impl.UnmarshallingContext.isAt(UnmarshallingContext.java:598)
   at org.alfresco.repo.dictionary.JiBX_root_projects_repository_source_java_org_alfresco_repo_dictionary_m2bindingM2Property_access.isPresent()
   at org.alfresco.repo.dictionary.JiBX_MungeAdapter.JiBX_root_projects_repository_source_java_org_alfresco_repo_dictionary_m2binding_unmarshal_1_10()
   at org.alfresco.repo.dictionary.M2Class.JiBX_root_projects_repository_source_java_org_alfresco_repo_dictionary_m2binding_unmarshal_1_1(M2Class.java)
   at org.alfresco.repo.dictionary.M2Type.JiBX_root_projects_repository_source_java_org_alfresco_repo_dictionary_m2binding_unmarshal_2_0(M2Type.java)
   at org.alfresco.repo.dictionary.JiBX_root_projects_repository_source_java_org_alfresco_repo_dictionary_m2bindingM2Type_access.unmarshal()
   at org.alfresco.repo.dictionary.JiBX_MungeAdapter.JiBX_root_projects_repository_source_java_org_alfresco_repo_dictionary_m2binding_unmarshal_1_4()
   at org.alfresco.repo.dictionary.M2Model.JiBX_root_projects_repository_source_java_org_alfresco_repo_dictionary_m2binding_unmarshal_1_0(M2Model.java)
   at org.alfresco.repo.dictionary.JiBX_root_projects_repository_source_java_org_alfresco_repo_dictionary_m2bindingM2Model_access.unmarshal()
   at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2773)
   at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2916)
   at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:94)
   … 44 more

Je pense pourtant ne pas m'être trompé dans la déclaration de mes préfix, namespace, etc…

Si vous pouviez m'aider à résoudre ce problème, cela m'aiderait grandement ;)

Cordialement,
Laurent

Outcomes