AnsweredAssumed Answered

[résolu] Probleme nouveau modele

Question asked by loicb on Apr 18, 2008
Latest reply on Apr 18, 2008 by loicb
Bonjour,
je debute avec alfresco et je me trouve face a un probleme.
J'ai créer un nouveau model afin d'ajouter de nouvelles propriétés aux documents que l'on importe dans alfresco.
Seulement, je me trouve désormais face à un probleme.
J'ai créer mon nouveau model:

<?xml version="1.0" encoding="UTF-8"?>
<model name="dm:OceModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <description>Alfresco Document Model</description>
   <author>Stagiaire</author>
   <published>2008-04-18</published>
   <version>1.0</version>

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

   <namespaces>
      <namespace uri="dm.Oce.Model" prefix="dm"/>
   </namespaces>

   <types>

   <type name="dm:document">
      <title>document</title>
      <parent>cm:content</parent>
      <properties>
         <property name="dm:datecreation">
            <title>Date Creation</title>
            <type>d:date</type>
            <mandatory>true</mandatory>
                 </property>
         <property name="dm:NomCommercial">
            <title>Nom Commercial</title>
            <type>d:text</type>
            <mandatory>true</mandatory>                 
         </property>
         <property name="dm:Secteur">
            <title>Secteur</title>
            <type>d:int</type>
            <mandatory>true</mandatory>
                 </property>
         <property name="dm:Client">
            <title>Client</title>
            <type>d:text</type>
            <mandatory>true</mandatory>
                 </property>
         <property name="dm:BU">
            <title>Business Unit</title>
            <type>d:text</type>
            <mandatory>true</mandatory>
                 </property>
         <property name="dm:OBS">
            <title>OBS</title>
            <type>d:boolean</type>
            <mandatory >true</mandatory>
                 </property>
         <property name="dm:Adresse">
            <title>Adresse livraison</title>
            <type>d:text</type>
            <mandatory>true</mandatory>
                 </property>
         <property name="dm:LocOce">
            <title>Location OCE france</title>
            <type>d:int</type>
            <mandatory>false</mandatory>
                 </property>
         <property name="dm:Vente">
            <title>Vente</title>
            <type>d:int</type>
            <mandatory>false</mandatory>
                 </property>
         <property name="dm:LocOCEFI">
            <title>Location OCEFI</title>
            <type>d:int</type>
            <mandatory>false</mandatory>
                 </property>
         <property name="dm:LocDLL">
            <title>Location DLL</title>
            <type>d:int</type>
            <mandatory>false</mandatory>
                 </property>
         <property name="dm:Service">
            <title>Service</title>
            <type>d:int</type>
            <mandatory>false</mandatory>
                 </property>
         <property name="dm:BmLiv">
            <title>BM Livraison</title>
            <type>d:int</type>
            <mandatory>false</mandatory>
                 </property>
         <property name="dm:BmRep">
            <title>BM Reprise</title>
            <type>d:int</type>
            <mandatory>false</mandatory>
                 </property>
         <property name="dm:TypeMa">
            <title>Type Machine</title>
            <type>d:text</type>
            <mandatory>true</mandatory>
                 </property>
         <property name="dm:NumSerie">
            <title>Numero de Serie</title>
            <type>d:int</type>
            <mandatory>true</mandatory>
                 </property>
      </properties>   
   </type>
      
</types>   
</model>

Ensuite, dans le fichier example-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/exampleModel.xml</value>
          <value>alfresco/extension/OceModel.xml</value>
            </list>
        </property>
    </bean>
         
</beans>

puis, dans le fichier web-client-custom-model.xml:


- <config evaluator="string-compare" condition="Content Wizards">
- <content-types>
  <type name="my:sop" />
  </content-types>
  </config>
- <config evaluator="node-type" condition="my:sop">
- <property-sheet>
  <show-property name="mimetype" display-label-id="content_type" component-generator="MimeTypeSelectorGenerator" />
  <show-property name="size" display-label-id="size" converter="org.alfresco.faces.ByteSizeConverter" show-in-edit-mode="false" />
  <show-property name="my:publishedDate" />
  <show-association name="my:signOff" />
  <show-property name="my:authorisedBy" />
  <show-child-association name="my:processSteps" />
  </property-sheet>
  </config>
- <config evaluator="aspect-name" condition="my:imageClassification">
- <property-sheet>
  <show-property name="my:width" />
  <show-property name="my:height" />
  <show-property name="my:resolution" />
  </property-sheet>
  </config>
- <config evaluator="string-compare" condition="Action Wizards">
- <aspects>
  <aspect name="my:imageClassification" />
  </aspects>
  </config>
- <config evaluator="string-compare" condition="Advanced Search">
- <advanced-search>
- <content-types>
  <type name="my:sop" />
  </content-types>
- <custom-properties>
  <meta-data type="my:sop" property="my:authorisedBy" />
  <meta-data aspect="my:imageClassification" property="my:resolution" />
  </custom-properties>
  </advanced-search>
  </config>
- <config evaluator="node-type" condition="dm:document">
- <property-sheet>
  <show-property name="dm:datecreation" />
  <show-property name="dm:NomCommercial" />
  <show-property name="dm:Secteur" />
  <show-property name="dm:Client" />
  <show-property name="dm:BU" />
  <show-property name="dm:OBS" />
  <show-property name="dm:Adresse" />
  <show-property name="dm:LocOce" />
  <show-property name="dm:Vente" />
  <show-property name="dm:LocOCEFI" />
  <show-property name="dm:LocDLL" />
  <show-property name="dm:Service" />
  <show-property name="dm:BmLiv" />
  <show-property name="dm:BmRep" />
  <show-property name="dm:TypeMa" />
  <show-property name="dm:NumSerie" />
  </property-sheet>
  </config>
  </alfresco-config>



Au moment du lancement d'alfresco, j'ai une erreur:

14:47:38,984 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/alfresco]] Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.alfresco.web.app.ContextListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extension.dictionaryBootstrap' defined in file [C:\alfresco\tomcat\shared\classes\alfresco\extension\example-model-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: Could not import bootstrap model alfresco/extension/OceModel.xml
Caused by:
org.alfresco.service.cmr.dictionary.DictionaryException: Could not import bootstrap model alfresco/extension/OceModel.xml
   at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:111)
   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:1160)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1122)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1085)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:429)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:250)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:247)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:161)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346)
   at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
   at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
   at org.apache.catalina.core.StandardService.start(StandardService.java:448)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
   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:295)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: Failed to compile model dm:OceModelAdv
   at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:112)
   at org.alfresco.repo.dictionary.M2Model.compile(M2Model.java:134)
   at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModel(DictionaryDAOImpl.java:93)
   at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:107)
   … 42 more
Caused by: org.alfresco.service.namespace.NamespaceException: Namespace prefix cm is not mapped to a namespace URI
   at org.alfresco.service.namespace.QName.createQName(QName.java:103)
   at org.alfresco.service.namespace.QName.createQName(QName.java:125)
   at org.alfresco.repo.dictionary.M2ClassDefinition.<init>(M2ClassDefinition.java:88)
   at org.alfresco.repo.dictionary.M2TypeDefinition.<init>(M2TypeDefinition.java:47)
   at org.alfresco.repo.dictionary.CompiledModel.constructDefinitions(CompiledModel.java:153)
   at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:94)
   … 45 more


Il n'arrive pas à compiler mon nouveau model et le namespace prefix cm n'est pas mapped. Ok, mais ca veut dire quoi???
C'est ce qui est dit de faire dans le forum, mais je suis perdu la!!!

Merci d'avance

Outcomes