AnsweredAssumed Answered

Why cant i set properties on versions?

Question asked by gyro.gearless on Mar 23, 2010
Hi folks,

strange guy that i am, i would like to alter some properties on versioned documents, i.e. those parts held in the "version2Store".
This is what i tried (this code was supposed to be in some server-side action):

                Version targetVersion = versionService.getVersionHistory(actionedUponNodeRef).getVersion(versionLabel);
                NodeRef frozenNodeRef = targetVersion.getFrozenStateNodeRef();

                // Get node properties
                Map<QName, Serializable> properties = nodeService.getProperties(frozenNodeRef);

                // Set new properties, if applicable
                properties.put(ContentModel.PROP_CREATOR, creator);
                properties.put(ContentModel.PROP_CREATED, created)
                nodeService.setProperties(frozenNodeRef, properties);

Of course this doesnt work as expected, as the corresponding method in org.alfresco.repo.version.NodeServiceImpl just throws an Exception

    public void setProperties(NodeRef nodeRef, Map<QName, Serializable> properties) throws InvalidNodeRefException
        // This operation is not supported for a version store
        throw new UnsupportedOperationException(MSG_UNSUPPORTED);

So my question is: is there any particular reason why these and related methods are not implemented for version stores? Is it just because until today nobody would have used this feature, or is there a deeper reason? For the curious, i am trying to write an import tool for some existing legacy DMS and would like to retain the original creation date of each version  :D