Bootstrapping the xml file issue

cancel
Showing results for 
Search instead for 
Did you mean: 
yuva
Active Member

Bootstrapping the xml file issue

Hi

I am having a content model and workflow model xml in bootstrap-model.xml by default. And I created a content model inside of content-model.xml file. Now I added a new value of another one xml file in bootstrap-model xml namely as exampleModel.xml. I have created a file called exampleModel.xml in a path : alfresco/module/alf-repo-amp/model/exampleModel.xml.

But it throws error and its saying namespace defined in exampleModel.xml is already defined here.I have given a unique namespace for that,but still its showing a same error. Please see the below codings related to this issue and anyone can help me to know why its not taking. Thank you.

Bootstrap-context.xml :

<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<!-- The bootstrap-context.xml file is used for patch definitions, importers,
workflow, and loading custom content models. -->


<!-- Registration of new models -->
<bean id="alfmodule-repo-amp.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/module/${project.artifactId}/model/content-model.xml</value>
<value>alfresco/module/${project.artifactId}/model/workflow-model.xml</value>
<value>alfresco/module/${project.artifactId}/model/exampleModel.xml</value>
<!-- <value>alfresco/extension/templates/webscripts/slingshot/search/search-config.xml</value> -->
</list>
</property>
</bean>

</beans>

exampleModel.xml  :

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

<!-- Definition of new Model -->

<!-- The important part here is the name - Note: the use of the myc: namespace
which is defined further on in the document -->
<model name="myc:mycnewmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

<!-- Optional meta-data about the model -->
<description>Example custom Model</description>
<author></author>
<version>1.0</version>

<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>

<!-- Introduction of new namespaces defined by this model -->
<!-- NOTE: The following namespace myc.new.model should be changed to reflect your own namespace -->
<namespaces>
<namespace uri="my.model.search.content" prefix="myc"/>
</namespaces>

<types>

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

<type name="myc:tradeLicense">
<title>Trade License</title>
<parent>myc:salesCustomerCare</parent>
<properties>
<property name="myc:licenseNumber">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="myc:companyName">
<type>d:text</type>
<mandatory>true</mandatory>
<index enabled="true">
<tokenised>TRUE</tokenised>
<facetable>false</facetable>
</index>
</property>
<property name="myc:legalType">
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="myc:expiryDate">
<type>d:date</type>
<mandatory>true</mandatory>
</property>
<property name="myc:issueDate">
<type>d:date</type>
<mandatory>false</mandatory>
</property>
</properties>
</type>

</types>

<aspects>

<!-- Definition of new Content Aspect: Image Classification -->
<aspect name="myc:imageClassification">
<title>Image Classfication</title>
<properties>
<property name="myc:width">
<type>d:int</type>
</property>
<property name="myc:height">
<type>d:int</type>
</property>
<property name="myc:resolution">
<type>d:int</type>
</property>
</properties>
</aspect>

</aspects>

</model>

6 Replies
douglascrp
Advanced II

Re: Bootstrapping the xml file issue

Please, share the full log file.

zhihailiu
Active Member

Re: Bootstrapping the xml file issue

You defined this namespace in exampleModel.xml. What is the namespace you defined in content-model.xml?

<namespaces>
<namespace uri="my.model.search.content" prefix="myc"/>
</namespaces>

yuva
Active Member

Re: Bootstrapping the xml file issue

content-model namespace is 

<namespaces>
<namespace uri="http://www.mycompany.com/model/content/1.0" prefix="my"/>
</namespaces>

douglascrp
Advanced II

Re: Bootstrapping the xml file issue

Haven't you, by mistake, deployed the same content model in more than one place, like, using an AMP, a JAR or even directly inside the extension folder?

yuva
Active Member

Re: Bootstrapping the xml file issue

Are we shouldn't use the same type in different places or different content model files? 

muralidharand
Established Member II

Re: Bootstrapping the xml file issue

Content-Type should be unique across the content model. You can use the inheritance if you want to extend the behavior.