02-21-2023 08:22 AM
Hi,
I have a question about deleting (moving) a document with multiple versions to another folder. I have a case where a document has two versions of nodeId;1.0 and nodeId;2.0. As part of anonymization, I want to move all versions of this document to a different folder.
When I try to move all versions and add the DELETED flag, I get an error with the "Document is not the latest version".
This error appears when I want to change properties of lower version of document.
How can I change properties for lower version?
String targetFolderPath = getFolderPathForAnonymize(order.getReportId(), order.getId()); Folder folder = getFolder(targetFolderPath); if (folder == null) { folder = createFolderTree(targetFolderPath); } Session session = getSession(); Document doc = (Document) session.getLatestDocumentVersion(session.createObjectId(nodeId)); doc.addToFolder(folder, true); Map<String, Object> updateProperties = new HashMap<>(); updateProperties.put(Config.PROP_NAME_STATUS, Config.CONST_DOK_USUNIETY); doc.updateProperties(updateProperties);
This erro appears when run doc.updateProperties(updateProperties)
02-27-2023 01:05 AM
A change propretys only for the latest version
for (Document version : doc.getAllVersions()) {
if(Boolean.TRUE.equals(version.isLatestVersion())) {
version.updateProperties(updateProperties);
}
}
02-27-2023 01:05 AM
A change propretys only for the latest version
for (Document version : doc.getAllVersions()) {
if(Boolean.TRUE.equals(version.isLatestVersion())) {
version.updateProperties(updateProperties);
}
}
Explore our Alfresco products with the links below. Use labels to filter content by product module.