AnsweredAssumed Answered

how to add multiple content types

Question asked by plakshmi on Dec 11, 2009
Latest reply on Dec 14, 2009 by plakshmi
Hi
I am new to Alfresco. I am working on a requirement wherein a separate content type(with corresponding fields) has to attached while adding different types of documents.
I created a custom content type (say Category 1) by modifying customModel.xml, web-client-config-custom.xml and defining my model in custom-model-context.xml.
My new content type (Category 1) is getting listed in the Content Tpye drop-down menu and I could succesfully attach values to the document as defined in Category 1.

Now that I want to add another content type (say Category 2 with a differnt set of fields) to the Content Type menu, I am unable to succeed.
This is what I did:
1. created a new file custom1Model.xml and defined my new model "res.customModel" with types , imports, namespaces etc similar to customModel.xml.
2. modified web-client-config-custom.xml to display and invoke my new model when selected.
3. In custom-model-context.xml made changes as below:
<bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/customModel.xml</value>
               <value>alfresco/extension/custom1Model.xml</value>

           </list>
        </property>
    </bean>


I am getting the following errors:
15:05:47,968 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'extension.dictionaryBootstrap' defined in file [C:\Alfresco\tomcat\shared\classes\alfresco\extension\custom-model-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 11110001 Could not import bootstrap model alfresco/extension/custom1Model.xml
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 11110001 Could not import bootstrap model alfresco/extension/custom1Model.xml
.
.
.
.Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 11110000 Failed to compile model res.customModel
   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:274)
   at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:147)
   … 43 more
Caused by: org.alfresco.service.namespace.NamespaceException: Namespace prefix  is not mapped to a namespace URI
   at org.alfresco.service.namespace.QName.createQName(QName.java:105)
   at org.alfresco.service.namespace.QName.createQName(QName.java:127)
   at org.alfresco.repo.dictionary.M2ModelDefinition.<init>(M2ModelDefinition.java:47)
   at org.alfresco.repo.dictionary.CompiledModel.constructDefinitions(CompiledModel.java:137)
   at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:94)
   … 46 more


I want to know if my approach is correct and what could be the problem.

Thanks
Ponnulakshmi.

Outcomes