This commit is contained in:
Lucio Lelii 2018-11-20 16:31:26 +00:00
parent 12ff4fcbeb
commit 78291e0ef8
1 changed files with 6 additions and 3 deletions

View File

@ -652,7 +652,7 @@ public class ItemsManager {
ses.getWorkspace().copy(nodeToCopy.getPath(), newPath); ses.getWorkspace().copy(nodeToCopy.getPath(), newPath);
Node newNode = ses.getNode(newPath); Node newNode = ses.getNode(newPath);
newFileIdentifier = newNode.getIdentifier(); newFileIdentifier = newNode.getIdentifier();
//TODO: copy on storage and modify content
if (item instanceof AbstractFileItem) { if (item instanceof AbstractFileItem) {
String oldStorageId = ((AbstractFileItem)item).getContent().getStorageId(); String oldStorageId = ((AbstractFileItem)item).getContent().getStorageId();
String newStorageID = Utils.getStorageClient(login).getClient().copyFile(true).from(oldStorageId).to(newPath); String newStorageID = Utils.getStorageClient(login).getClient().copyFile(true).from(oldStorageId).to(newPath);
@ -660,12 +660,15 @@ public class ItemsManager {
((AbstractFileItem) item).getContent().setStorageId(newStorageID); ((AbstractFileItem) item).getContent().setStorageId(newStorageID);
((AbstractFileItem) item).getContent().setRemotePath(newPath); ((AbstractFileItem) item).getContent().setRemotePath(newPath);
item2Node.replaceContent(ses, newNode, (AbstractFileItem) item, ItemAction.CLONED); item2Node.replaceContent(ses, newNode, (AbstractFileItem) item, ItemAction.CLONED);
} else }
Utils.setPropertyOnChangeNode(newNode, login, ItemAction.CLONED);
Utils.setPropertyOnChangeNode(newNode, login, ItemAction.CLONED);
newNode.setProperty(NodeProperty.PORTAL_LOGIN.toString(), login);
String mimeTypeForAccounting = (item instanceof AbstractFileItem)? ((AbstractFileItem) item).getContent().getMimeType(): null; String mimeTypeForAccounting = (item instanceof AbstractFileItem)? ((AbstractFileItem) item).getContent().getMimeType(): null;
accountingHandler.createFolderAddObj(uniqueName, item.getClass().getSimpleName(), mimeTypeForAccounting, ses, destination, false); accountingHandler.createFolderAddObj(uniqueName, item.getClass().getSimpleName(), mimeTypeForAccounting, ses, destination, false);
ses.save(); ses.save();
}finally { }finally {