diff --git a/src/main/java/org/gcube/data/access/storagehub/services/ItemsManager.java b/src/main/java/org/gcube/data/access/storagehub/services/ItemsManager.java index 86b7710..f14c640 100644 --- a/src/main/java/org/gcube/data/access/storagehub/services/ItemsManager.java +++ b/src/main/java/org/gcube/data/access/storagehub/services/ItemsManager.java @@ -652,7 +652,7 @@ public class ItemsManager { ses.getWorkspace().copy(nodeToCopy.getPath(), newPath); Node newNode = ses.getNode(newPath); newFileIdentifier = newNode.getIdentifier(); - //TODO: copy on storage and modify content + if (item instanceof AbstractFileItem) { String oldStorageId = ((AbstractFileItem)item).getContent().getStorageId(); 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().setRemotePath(newPath); 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; accountingHandler.createFolderAddObj(uniqueName, item.getClass().getSimpleName(), mimeTypeForAccounting, ses, destination, false); + ses.save(); }finally {