[MGNLUI-4021] Introduce Copy & Paste actions in content apps Created: 01/Sep/16  Updated: 14/Feb/17  Resolved: 28/Sep/16

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: None
Fix Version/s: 5.5

Type: Task Priority: Neutral
Reporter: Michael Mühlebach Assignee: Robert Šiška
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
dependency
is depended upon by PAGES-92 Rewrite component clipboard to use ne... Closed
duplicate
is duplicated by MGNLUI-2631 Copy action in configuration app is m... Closed
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Release notes required:
Yes
Date of First Response:
Sprint: Kromeriz 63
Story Points: 8

 Description   

See the concept page: https://wiki.magnolia-cms.com/pages/viewpage.action?pageId=125179001



 Comments   
Comment by Milan Divilek [ 23/Sep/16 ]

Reopen:

2016-09-23 08:36:25,557 ERROR fo.magnolia.ui.contentapp.browser.BrowserPresenter: An error occurred while executing action [paste]
info.magnolia.ui.api.action.ActionExecutionException: Error while pasting the items on given location.
Caused by: info.magnolia.ui.framework.ContentClipboardException: Failed while pasting items under JCR item with UUID [d216a58a-27df-489f-9f6a-27b4251cdd10] from [config] workspace.
	at info.magnolia.ui.contentapp.browser.JcrContentClipboard.paste(JcrContentClipboard.java:83)
	at info.magnolia.ui.contentapp.browser.JcrContentClipboard.paste(JcrContentClipboard.java:60)
	at info.magnolia.ui.contentapp.browser.action.PasteContentAction.execute(PasteContentAction.java:83)
	... 123 more
Caused by: javax.jcr.PathNotFoundException: /modules/core
	at org.apache.jackrabbit.core.BatchedItemOperations.getNodeState(BatchedItemOperations.java:1449)
	at org.apache.jackrabbit.core.BatchedItemOperations.getNodeState(BatchedItemOperations.java:1298)
	at org.apache.jackrabbit.core.BatchedItemOperations.copy(BatchedItemOperations.java:381)
	at org.apache.jackrabbit.core.WorkspaceImpl.internalCopy(WorkspaceImpl.java:430)
	at org.apache.jackrabbit.core.WorkspaceImpl.copy(WorkspaceImpl.java:656)
	at info.magnolia.jcr.wrapper.DelegateWorkspaceWrapper.copy(DelegateWorkspaceWrapper.java:104)
	at info.magnolia.jcr.wrapper.DelegateWorkspaceWrapper.copy(DelegateWorkspaceWrapper.java:104)
	at info.magnolia.jcr.wrapper.DelegateWorkspaceWrapper.copy(DelegateWorkspaceWrapper.java:104)
	at info.magnolia.jcr.wrapper.MgnlPropertySettingContentDecorator$MgnlPropertySettingWorkspaceWrapper.copy(MgnlPropertySettingContentDecorator.java:458)
	at info.magnolia.jcr.wrapper.DelegateWorkspaceWrapper.copy(DelegateWorkspaceWrapper.java:104)
	at info.magnolia.audit.MgnlAuditLoggingContentDecoratorWorspaceWrapper.copy(MgnlAuditLoggingContentDecoratorWorspaceWrapper.java:66)
	at info.magnolia.ui.contentapp.browser.JcrContentClipboard.pasteSingleItem(JcrContentClipboard.java:99)
	at info.magnolia.ui.contentapp.browser.JcrContentClipboard.paste(JcrContentClipboard.java:79)
	... 125 more

This happens when copy/paste between different workspaces (via JCR Browser).

Theoretically could be fixed by

--- a/magnolia-ui-contentapp/src/main/java/info/magnolia/ui/contentapp/browser/JcrContentClipboard.java
+++ b/magnolia-ui-contentapp/src/main/java/info/magnolia/ui/contentapp/browser/JcrContentClipboard.java
@@ -96,9 +96,9 @@ public class JcrContentClipboard implements ContentClipboard<JcrItemId> {
             String newName = getUniqueNewItemName(destinationNode, sourceNode.getName());
             String newPath = Path.getAbsolutePath(destinationNode.getPath(), newName);
 
-            sourceNode.getSession().getWorkspace().copy(sourceNode.getPath(), newPath);
-            sourceNode.getSession().save();
-            Node newNode = sourceNode.getSession().getNode(newPath);
+            destinationNode.getSession().getWorkspace().copy(sourceNode.getSession().getWorkspace().getName(), sourceNode.getPath(), newPath);
+            destinationNode.getSession().save();
+            Node newNode = destinationNode.getSession().getNode(newPath);
             return JcrItemUtil.getItemId(newNode);
         } else {
             Property property = (Property) sourceItem;

but this would not work between different repositories. Also it doesn't handle any availability so you can paste node with page nodetype into users repo...

We should disable copy/paste between different workspaces.

Generated at Mon Feb 12 09:12:28 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.