Switch Model from Model Manager to XML using Bootstrap approach

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Established Member

Switch Model from Model Manager to XML using Bootstrap approach

Jump to solution

I have created a model using a model manager and model is active and Aspects from the model is already applied to the documents and data in the properties is also populated and it is important.

Now the requirement is to add association in the Aspect which is not possible using model manager approach.

How could I change the model from model manager to XML using Bootstrap approach without any data loss?

1 Solution

Accepted Solutions
Highlighted
Master

Re: Switch Model from Model Manager to XML using Bootstrap approach

Jump to solution

If you have use the aspects / properties on any files that are versioned, then you are quite frankly out of luck - you would have to write quite custom logic to create a consistent export of the data, then delete the nodes, activate the model, re-import.

If you don't have any versions, then you can simply use the default export / import actions to extract / backup the current data and reimport after switching the model.
Note that by default, the export / import actions are not available in the UI. You'd either have to customise the UI or use the JavaScript Console (or some other admin tooling) to be able to trigger those actions.

View solution in original post

5 Replies
Highlighted
Senior Member II

Re: Switch Model from Model Manager to XML using Bootstrap approach

Jump to solution

1)Export you xxxModel.xml and edit as per your requirement and place it inside \alfresco\tomcat\shared\classes\alfresco\extension.

2)Create  xxx-context.xml file and register your contentmodel using below code. 

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

<!-- Registration of new models -->
<bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/xxxModel.xml</value>
</list>
</property>
</bean>
</beans>

Thanks,

Contcentric

Thanks & Regards,
Sanjay
Highlighted
Established Member

Re: Switch Model from Model Manager to XML using Bootstrap approach

Jump to solution

But it won't give exception if we would have two models with the same namespace one by the model manager and another by XML?

Highlighted
Master

Re: Switch Model from Model Manager to XML using Bootstrap approach

Jump to solution

Of course it will give an exception. You also need to first undeploy / deactivate the model in the model manager, and then restart with the model bootstrapped via the Spring context file. Of course to undeploy / disable the model from the model manager, you'd need to delete all uses of it, i.e. all nodes of types defined in the model, and remove all aspects / properties from nodes which were defined in the model. Also make sure to clear the trashcan as any nodes there using the model will also prevent its deactivation.

Highlighted
Established Member

Re: Switch Model from Model Manager to XML using Bootstrap approach

Jump to solution

Axel Faust‌ How could I retrieve data of the already applied model, because the data is important in the properties of files to which the model's Aspects are applied?

Highlighted
Master

Re: Switch Model from Model Manager to XML using Bootstrap approach

Jump to solution

If you have use the aspects / properties on any files that are versioned, then you are quite frankly out of luck - you would have to write quite custom logic to create a consistent export of the data, then delete the nodes, activate the model, re-import.

If you don't have any versions, then you can simply use the default export / import actions to extract / backup the current data and reimport after switching the model.
Note that by default, the export / import actions are not available in the UI. You'd either have to customise the UI or use the JavaScript Console (or some other admin tooling) to be able to trigger those actions.

View solution in original post