Association in custom content model change

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

Association in custom content model change

Hi Dev support team,

I have a question on an association in custom content model.

Earlier had created an association named as avs:imageAttachment in our module. And created some content.

But later on , the design was changed in next release and to make it more flexible the association avs:imageAssociation was removed from the content model and a association crm:imageAttchment was added to custom relationship model named as crm-relationship-model.xml in Repository> Data Dictionary> Models and we are using that in code for creation of content.

Now the old contents which are having avs:imageAttachment are not being deleted.
Is there any way that the avs:imageAttachment can be replaced to crm:imageAttachment in database and SOLR?

Alfresco Content Services Certified Engineer (ACSCE)
3 Replies
kalpesh_c2
Senior Member

Re: Association in custom content model change

Hi,

Normally it is not recommended to make changes in custom content model.

If you have to then you should make only incremental changes in it.

It means add something rather than removing or changing the existing stuff in your model.

If you have removed/changed something in the content model then such problem will occur.

As a solution you can remove all the old contents before deploying new content model. Then deploy new content model and upload the contents with your fresh newly deployed content model. This is advisable in case of very less amount of documents already created of old type.

Thanks,

Kalpesh

ContCentric

ranjeetsi
Established Member II

Re: Association in custom content model change

Hi Kalpesh,

Thanks for the update!

Correct , we could have removed the old contents 

But for now , 

1. Is there any way that we can query avs:imageAttachment association in our repository. 

2. Also , if there is any way to replace all "avs:imageAttchment " to"crm:imageAttchment". 

3. Doe the query needs to changed in db query or lucene query.

Alfresco Content Services Certified Engineer (ACSCE)
ranjeetsi
Established Member II

Re: Association in custom content model change

Hi Kalpesh,

Earlier our content model had below entry for association:

--------------------------------------------
<association name="avs:imageAttachment">
<title>Related Image</title>
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cm:content</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>

---------------------------------------------------------------------


Later on it was above entry was renmoved from the content model and the below extract was added to Repository> Data Dictionary> Models>crm-relationship-model.xml
with association name as crm:imageAttachment

-------------------------------------------------------------------------------------------------------
<association name="crm:imageAttachment">
<title>Image attachment</title>
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm:cmobject</class>
<mandatory enforced="false">false</mandatory>
<many>true</many>
</target>
</association>
-----------------------------------------------------------------------------

At this point of time we are not able to delete the earlier smartlinks:


1. Is there any way that we can query avs:imageAttachment association in our repository.
2. Also , if there is any way to replace all "avs:imageAttchment " to"crm:imageAttchment".
3. Please let us know if both above would be db query or lucene query.
(With this approach earlier contents can be reused.

OR

we need to add another custom relationship model file and add avs:imageAttachment in that xml file.
And then delete.
With this approach earlier content cannot be reused.

Alfresco Content Services Certified Engineer (ACSCE)