01-15-2019 06:18 AM
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?
01-16-2019 04:30 AM
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.
01-16-2019 12:10 AM
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,
01-16-2019 12:45 AM
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?
01-16-2019 04:05 AM
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.
01-16-2019 04:12 AM
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?
01-16-2019 04:30 AM
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.
Explore our Alfresco products with the links below. Use labels to filter content by product module.