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):
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?
Hi sujaypillai, this is the whole xml file describing the model. I double checked it a lot of times, andf I can't find the "closing tag" missing.. but I am a rea newbie on XML and Alfresco too so….
<?xml version="1.0" encoding="UTF-8"?>
<!– ACME Content Model –>
<!– Note: This model is pre-configured to load at startup of the Repository. So, all custom –> <!– types and aspects added here will automatically be registered –>
<!– Optional meta-data about the model –> <description>ACME Content Model - based upon J.Potts example work SomeCo Model</description> <author>Francesco Sordi</author> <version>1.0</version>
<!– Introduction of new namespaces defined by this model –> <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –> <namespaces> <namespace uri="sals.ACMEContentModel" prefix="sals"/> </namespaces>
Best approach is don't try to override any properties of core alfresco. Instead you can define your own aspect with your own properties and can attach to your custom type. To display those properties in explore or share you have to modify share-form-config.xml, share-config.xml or web-client-config.xml related files depending on your requirement.
Infact, gawadesk, I don't try to override aspects of cm:content but an aspect of a child of cm:content. In the model, first I define a content as a child of cm:content and then, only for that kind of content, I try to override the property "description". Furthermore I am only trying to have a mandatory description field, named as something else. If it is possible to achieve this in the forms of web-client and share… the better.