AnsweredAssumed Answered

Bootstrapping the xml file issue

Question asked by yuva on Nov 1, 2017
Latest reply on Nov 6, 2017 by muralidharand

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="myc:publishedDate">
<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="myc:processSteps">
<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>

Outcomes