cancel
Showing results for 
Search instead for 
Did you mean: 

Cm:preferences aspect so Cm:preferenceValues content is not keeped on the 1.0 version of documents in Alfresco 4.2

thbaymet
Champ in-the-making
Champ in-the-making
Hi,

I have a web script that add cmSmiley Tonguereference aspect and some json content to cmSmiley TonguereferenceValues property.
I try to keep the content in all versions of a document.
When I look at to the version 1.0 of a document I can't see that aspect, neither its property.
However, the problem is only in that version. It's working normally in 1.1, 1.2, 1.3, …

I'm using Alfresco E. 4.2.1.

Thanks.
3 REPLIES 3

kaynezhang
World-Class Innovator
World-Class Innovator
The problem might be caused by the way  you add aspect to your node.
For example you might forget adding cmSmiley Tonguereferences aspect when create a node,but during creating new versions you added the 'cmSmiley Tonguereferences' aspect.
can you paste your code here?
By the way have you tried to use
mandatory-aspects ‍
in your model definition and force the 'cmSmiley Tonguereferences' aspect to be applied automatically

thbaymet
Champ in-the-making
Champ in-the-making
Firstly, thank you for your reply.

I came back to that problem. I did as you say. Here is my "cm:content" type definition in "model/contentModel.xml" file.
<type name="cm:content"> <title>Content</title> <parent>cm:cmobject</parent> <archive>true</archive> <properties>    <property name="cm:content">       <type>d:content</type>       <mandatory>false</mandatory>       <index enabled="true">          <atomic>true</atomic>          <stored>false</stored>          <tokenised>true</tokenised>       </index>    </property> </properties><mandatory-aspects>    <aspect>cm:preferences</aspect></mandatory-aspects></type>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


When I create (upload a new document), it has <strong>preferences</strong> aspect. And I add some content to the <strong>cmSmiley TonguereferenceValues</strong> property. When I upload a new version of a document, there are two nodes created in the version store. The first one which has cm:content of the old version doesn't contain <strong>cmSmiley TonguereferenceValues</strong> property. And the second one which has <strong>cm:content</strong> of the new version of the document, contains <strong>cmSmiley TonguereferenceValues</strong> of the old version. So while I try to preview the old version the document, I use the nodeRef of the first one, but the content (json text) that I've stored in <strong>cmSmiley TonguereferenceValues</strong> property is in the second one. This process is same for all other versions.

We can get the <strong>cmSmiley TonguereferenceValues</strong> content of the next sibling for each node to resolve this problem.
But, perhaps there is some way to keep this property.

Thanks.

kaynezhang
World-Class Innovator
World-Class Innovator
I guess your problem might cause by the operating order between making your node versionable and adding cmSmiley Tonguereference aspect

In your case you might makeing your node versionable(add versionable aspect)first and then  adding cmSmiley Tonguereference aspect to it.
In this case,your original version which dose not have cmSmiley Tonguereference aspect is 1.0 ,then you add cmSmiley Tonguereference aspect to the node , a new version 1.1 with cmSmiley Tonguereference aspect is auto created ,and the original version 1.0 dose not have cmSmiley Tonguereference aspect.

So I guess by adding cmSmiley Tonguereference aspect first and then making it versinable will solve your problem.
Welcome to the new Hyland Connect. Get started or submit feedback.