cancel
Showing results for 
Search instead for 
Did you mean: 

Creating version-specific renditions

andrewg5e
Champ in-the-making
Champ in-the-making
I'm using a space rule to automatically create PDF renditions of MSOffice documents that are created or versioned in a space. I'm using CMIS to talk to Alfresco, via the OpenCMIS ATOM endpoint (alfresco/cmisatom).

My script is very simple, based on the examples in the wiki for the Version Service:

var renditionDef = renditionService.createRenditionDefinition('cm:wsptPdfRendition', 'reformat');
renditionDef.parameters['mime-type'] = 'application/pdf';

renditionService.render(document, renditionDef);

What I notice using the OpenCMIS browser and the Node browser is that each new version of a document points to the same rendition. There's a rendition child association with the primary node (e.g. workspace://SpacesStore/xxxxx). In the version history in the version2Store, each version has a child node that's a rendition, but the "reference" property for each rendition node points to the same rendition node in the SpacesStore. That node is also a child node of the primary node (latest version) in the SpacesStore.

So this means that all the "old" versions have the same PDF rendition.

I suspect the problem is that I'm not passing the correct node into RenditionService.render in my script. Is that correct? Is there something else required to tie a rendition to a specific version of a document?

I'm using Alfresco 4.0.d, and OpenCMIS 0.7.0 (Java) as a client.

Thanks in advance.
3 REPLIES 3

afaust
Legendary Innovator
Legendary Innovator
Hello,

the behavior described is actually the correct default behavior of the versioning feature of Alfresco. By default, a new version of a node "just" creates a new version for the property state of the node - it will not create a recursive version, where both the node and its primary children (your renditions) are being versioned and the created version of your node then refers to the precise version of its children at the time the version was created. This can only be achieved by programmatic versioning in Alfresco (e.g. via policies) and not by the standard behavior of the VersionableAspect.

The RenditionService is not relevant to this at all as far as I see it - it is just about the behavior of the VersionService.

Regards
Axel

andrewg5e
Champ in-the-making
Champ in-the-making
Thanks Axel,

I think the default behavior of the versioning feature is OK, whereby new versions reference the renditions of the prior version. What doesn't seem to be working is having new renditions set for the current version. When my rule runs on the new version (e.g. 2.0), shouldn't it replace the association with the original PDF rendition with a new association to the PDF for the 2.0 content?

Maybe I need to programmatically remove the existing rendition association first?

afaust
Legendary Innovator
Legendary Innovator
Hello,

that depends on the internals of the rendition action being used, but I would expect the rendition action simply updates the content of the existing rendition and does not delete and create the old rendition.

Regards
Axel