hey,I have a versioned document (1.0, 1.1, 1.2, 1.3, …) based on a custom model and I want to change properties of older versions (eg 1.1).Well, I thought thats not a big deal but im stuck
I im trying to realize this with a java backed webscript.I am able to find the corresponding NodeRef to the passed version.When I try to set the property I get the following exception: java.lang.UnsupportedOperationException: This operation is not supported by a version store implementation of the node service.
at org.alfresco.repo.version.NodeServiceImpl.setProperty(NodeServiceImpl.java:466)
…
So its not allowed to do any modifications on a "frozen" Node? From what I read in the forums its possible to do so. But how? here is my testcode
//custom model
static final String NAMESPACE = "http://www.sourcesense.com/model/1.0";
static final QName TYPE_AUTHORTY = QName.createQName(NAMESPACE, "authority");
public void execute(WebScriptRequest req, WebScriptResponse res)
throws IOException {
final String nodeUuid = (String) req.getParameter("uuid");
final String versionLabel = (String) req.getParameter("versionLabel");
final String authority = (String) req.getParameter("authority");
String nodePath = "workspace://SpacesStore/" + nodeUuid;
VersionHistory versionHistory = registry.getVersionService().getVersionHistory(new NodeRef(nodePath));
if(null!= versionHistory){
Iterator<Version> versionIterator = versionHistory.getAllVersions().iterator();
Version version;
while(versionIterator.hasNext()){
version = versionIterator.next();
if(version.getVersionLabel().equals(versionLabel)){
System.out.println("Trying to change Property of version: "+versionLabel);
NodeRef node = version.getFrozenStateNodeRef();
registry.getNodeService().setProperty(node, TYPE_AUTHORTY, authority);
}
}
}
}
and the request http://localhost:8080/alfresco/service/demo/changeProperties?uuid=da8b67e3-7f72-43b3-bc00-7a85fd5a20ef&versionLabel=1.1&authority=my_new_value
thank you