Association to specific version on another node
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2012 01:23 AM
Dear All.
I've created custom model and I'd like to create association with specific version of another node.
Is this possible? If so, could someone please advise on how to achieve that?
So far, association point to working copy of node, which is not what I want.
Thanks in advance.
I've created custom model and I'd like to create association with specific version of another node.
Is this possible? If so, could someone please advise on how to achieve that?
So far, association point to working copy of node, which is not what I want.
Thanks in advance.
Labels:
- Labels:
-
Archive
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2012 05:11 AM
Hi kokachev,
I guess you will have to code it by getting the nodeRef of the version you want to create the association to.
You could do it using the VersionService if you know the version or you could run through the versionHistory and get the one you want.
I must say I've never tried doing so… so I don't know if there will be any policy of permission issues…
Regards,
Adei
I guess you will have to code it by getting the nodeRef of the version you want to create the association to.
You could do it using the VersionService if you know the version or you could run through the versionHistory and get the one you want.
VersionHistory versionHistory = versionService.getVersionHistory(nodeRef);Version version = null;if(myVersionString != null && !myVersionString.equals("")){ //if you know the version version = versionHistory.getVersion(myVersionString);}else{ for(Version currentVersion : versionHistory.getAllVersions) { if(… whatever your condition is …) { version = currentVersion; break; } }}if(version != null){ // Get the nodeRef of the version NodeRef versionNodeRef = version.getFrozenStateNodeRef(); // Create the association}
I must say I've never tried doing so… so I don't know if there will be any policy of permission issues…
Regards,
Adei
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2012 09:12 PM
Thanks Adei.
Could you please advise on how/when this script should be called? (sorry, I'm new to Alfresco)
My idea was to select association in Share, in edit properties. So user suppose to press "Edit properties", then press "Select" button
and choose related files.
Thanks.
Could you please advise on how/when this script should be called? (sorry, I'm new to Alfresco)
My idea was to select association in Share, in edit properties. So user suppose to press "Edit properties", then press "Select" button
and choose related files.
Thanks.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2012 03:50 AM
Oh that is java…
You would have to do quite few changes for that…. Check the association control out, it has some parameters to be configured but no one will help you… You'll need to hack it
You can otherwise create your own control…
Adei
You would have to do quite few changes for that…. Check the association control out, it has some parameters to be configured but no one will help you… You'll need to hack it
You can otherwise create your own control…
Adei
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2015 05:46 AM
Hi,
As per your answer above @amandaluniz_z ,you are suggesting to modify the versioned node refrence and make an association with it.
But that is not possible as all versioned node refrences are read only and doing so will get you an error. sumthing like this
/*
<strong>java.lang.UnsupportedOperationException: This operation is not supported by a version store implementation of the node service.</strong>
*/
So, I think you have no other option than to fetch individual versions of each node and somehow set up an relationship amongst them.unless u find some other workaround to modify/update versioned nodes.
As per your answer above @amandaluniz_z ,you are suggesting to modify the versioned node refrence and make an association with it.
But that is not possible as all versioned node refrences are read only and doing so will get you an error. sumthing like this
/*
<strong>java.lang.UnsupportedOperationException: This operation is not supported by a version store implementation of the node service.</strong>
*/
So, I think you have no other option than to fetch individual versions of each node and somehow set up an relationship amongst them.unless u find some other workaround to modify/update versioned nodes.
