AnsweredAssumed Answered

Content Aspect with Constraint for a List-Box

Question asked by schneika on Aug 15, 2007
Latest reply on Jan 17, 2008 by roby71
Alfresco V2.1.0 CE on Linux. I need a aspect with list box. This is my exampleModel.xml:

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

<model name="my:mynewmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>Example custom Model</description>
   <author></author>
   <version>1.0</version>

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

   <namespaces>
      <namespace uri="my.new.model" prefix="my"/>
   </namespaces>

   <contraints>    <!– This is the typo, an error –>

     <!– Definition of new constraints: Fachbereich –>
     <constraint name="my:Fachbereich" type="LIST">
       <parameter name="allowedValues">
          <list>
             <value>AM</value>
             <value>PrM</value>
             <value>KB</value>
             <value>VAD</value>
             <value>VID</value>
          </list>
       </parameter>
      </constraint>
 
   </constraints>


   <types>
  
      <!– Definition of new Content Type: Standard Operating Procedure –>
      <type name="my:sop">
         <title>Standard Operating Procedure</title>
         <parent>cm:content</parent>
         <properties>
            <property name="my:publishedDate">
               <type>d:datetime</type>
            </property>
            <property name="my:authorisedBy">
               <type>d:text</type>
            </property>
         </properties>
         <associations>
            <association name="my:signOff">
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:content</class>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </target>
            </association>
            <child-association name="my:processSteps">
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:content</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
         </child-association>           
         </associations>
      </type>
     
    </types>
   
    <aspects>

      <!– Definition of new Content Aspect: Fachbereichszuordnung –>
      <aspect name="my:Fachbereichszuordnung">
         <title>Fachbereichszuordnung</title>
         <properties>
            <property name="my:Fachbereich">
               <type>d:text</type>
               <constraints>
                 <constraint ref="my:Fachbereich" />
               </constraints>
            </property>
         </properties>
      </aspect>
     
   </aspects>
  
</model>

But i got this error in alfresco.log:

[16:37:16,799 INFO  [org.alfresco.repo.dictionary.DictionaryDAO] Loading model from alfresco/extension/exampleModel.xml
16:37:16,886 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extension.dictionaryBootstrap' defined in file [/data/opt/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/exampleModel.xml
Caused by:
org.alfresco.service.cmr.dictionary.DictionaryException: Could not import bootstrap model alfresco/extension/exampleModel.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:585)
   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:585)
   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 parse model
   at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:99)
   at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:106)
   … 42 more
Caused by: org.jibx.runtime.JiBXException: Expected end tag, found start tag "{http://www.alfresco.org/model/dictionary/1.0}constraint" (line 21, col 52)
   at org.jibx.runtime.impl.UnmarshallingContext.toEnd(UnmarshallingContext.java:548)
   at org.jibx.runtime.impl.UnmarshallingContext.parsePastEndTag(UnmarshallingContext.java:805)
   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:2515)
   at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2675)
   at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:94)
   … 43 more
16:37:16,893 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/alfresco]] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extension.dictionaryBootstrap' defined in file [/data/opt/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/exampleModel.xml
Caused by:
org.alfresco.service.cmr.dictionary.DictionaryException: Could not import bootstrap model alfresco/extension/exampleModel.xml
   at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:111)

Whats going wrong with my constraints-Defintion  :( ?
Wrong order?  :?:

Outcomes