Cm:preferences aspect so Cm:preferenceValues content is not keeped on the 1.0 version of documents in Alfresco 4.2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2014 04:49 AM
Hi,
I have a web script that add cmreference aspect and some json content to cmreferenceValues 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.
I have a web script that add cmreference aspect and some json content to cmreferenceValues 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.
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2014 05:08 AM
The problem might be caused by the way you add aspect to your node.
For example you might forget adding cmreferences aspect when create a node,but during creating new versions you added the 'cmreferences' aspect.
can you paste your code here?
By the way have you tried to use
For example you might forget adding cmreferences aspect when create a node,but during creating new versions you added the 'cmreferences' aspect.
can you paste your code here?
By the way have you tried to use
mandatory-aspects
in your model definition and force the 'cmreferences' aspect to be applied automatically
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2014 06:23 AM
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.
When I create (upload a new document), it has <strong>preferences</strong> aspect. And I add some content to the <strong>cmreferenceValues</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>cmreferenceValues</strong> property. And the second one which has <strong>cm:content</strong> of the new version of the document, contains <strong>cmreferenceValues</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>cmreferenceValues</strong> property is in the second one. This process is same for all other versions.
We can get the <strong>cmreferenceValues</strong> content of the next sibling for each node to resolve this problem.
But, perhaps there is some way to keep this property.
Thanks.
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>cmreferenceValues</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>cmreferenceValues</strong> property. And the second one which has <strong>cm:content</strong> of the new version of the document, contains <strong>cmreferenceValues</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>cmreferenceValues</strong> property is in the second one. This process is same for all other versions.
We can get the <strong>cmreferenceValues</strong> content of the next sibling for each node to resolve this problem.
But, perhaps there is some way to keep this property.
Thanks.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2014 04:16 AM
I guess your problem might cause by the operating order between making your node versionable and adding cmreference aspect
In your case you might makeing your node versionable(add versionable aspect)first and then adding cmreference aspect to it.
In this case,your original version which dose not have cmreference aspect is 1.0 ,then you add cmreference aspect to the node , a new version 1.1 with cmreference aspect is auto created ,and the original version 1.0 dose not have cmreference aspect.
So I guess by adding cmreference aspect first and then making it versinable will solve your problem.
In your case you might makeing your node versionable(add versionable aspect)first and then adding cmreference aspect to it.
In this case,your original version which dose not have cmreference aspect is 1.0 ,then you add cmreference aspect to the node , a new version 1.1 with cmreference aspect is auto created ,and the original version 1.0 dose not have cmreference aspect.
So I guess by adding cmreference aspect first and then making it versinable will solve your problem.