AnsweredAssumed Answered

cm:description override.. is it possible?

Question asked by sbixsbix on Mar 27, 2013
Latest reply on Apr 2, 2013 by sbixsbix
Hi eveybody,
for my cm I need to create such "specialised folders" which should containts only some types of document of my model.
For these folders I need to make mandatory the cm:description property (of cm:titled aspect).
Furthermore I need to show that field as "Location" instead of "Description".
So I wrote my custom model as follows, (I am using Alfresco 4.2 community edition):

<types>
….
<type name="xxx:realtyFolders">
<title>realties</title>
<parent>cm:folder</parent>
<mandatory-aspects>
<aspect>sals:realtyLoc</aspect>
</mandatory-aspects>
</type>
….
</types>
<aspects>
<aspect name="sals:realtyLoc">
<title>Titled</title>
<parent>cm:titled</parent>
<overrides>
<property name="cm:description">
<title>Address</title>
<mandatory>true</mandatory>
</property>
</overrides>
</aspect>
</aspects>

The only "brilliant" result is the following compilation error:

SEVERE: Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sals.dictionaryBootstrap' defined in file [/opt/AlFresco/community/tomcat/shared/classes/alfresco/extension/acme-model-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 02260001 Could not import bootstrap model alfresco/extension/salsContentModel.xml
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 02260001 Could not import bootstrap model alfresco/extension/salsContentModel.xml
at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:158)
at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
… 27 more
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 02260000 Failed to parse model
at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:102)
at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:88)
at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:147)
… 35 more
Caused by: org.jibx.runtime.JiBXException: Expected "{http://www.alfresco.org/model/dictionary/1.0}property" end tag, found "{http://www.alfresco.org/model/dictionary/1.0}title" start tag (line 2201, col 43)
at org.jibx.runtime.impl.UnmarshallingContext.parsePastCurrentEndTag(UnmarshallingContext.java:731)
at org.alfresco.repo.dictionary.JiBX_defaultMungeAdapter.JiBX_default_unmarshal_1_12()
at org.alfresco.repo.dictionary.M2Class.JiBX_default_unmarshal_1_0(M2Class.java)
at org.alfresco.repo.dictionary.M2Aspect.JiBX_default_unmarshal_2_0(M2Aspect.java)
at org.alfresco.repo.dictionary.JiBX_defaultM2Aspect_access.unmarshal()
at org.alfresco.repo.dictionary.JiBX_defaultMungeAdapter.JiBX_default_unmarshal_1_5()
at org.alfresco.repo.dictionary.M2Model.JiBX_default_unmarshal_1_0(M2Model.java)
at org.alfresco.repo.dictionary.JiBX_defaultM2Model_access.unmarshal()
at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2757)
at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2900)
at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:97)
… 37 more

So what? Where is the error? Is it possible to override cm:content aspects? Am I doing in the wrong way?

Outcomes