-
1. Re: How to move assets in different directory using java service
Ove Lindström Mar 4, 2013 7:13 AM (in response to sachin1107)Sounds to me that you should develop a workflow process or try to use some of the already defined. Then you could do your workflow model and use your custom made process.
See http://dev.day.com/docs/en/cq/current/workflows/wf-extending.html
Moving/Copying an asset could be done using the static method copy(Item, Node, String) in class com.day.cq.commons.jcr.JcrUtil or the copy/move methods in com.adobe.granite.asset.api.AssetManager.
-
2. Re: How to move assets in different directory using java service
Jörg Hoh Mar 4, 2013 9:31 AM (in response to Ove Lindström)If you can use a high-level API to achieve the same as the low-level API, prefer the highlevel one ...
Jörg
-
3. Re: How to move assets in different directory using java service
Ove Lindström Mar 5, 2013 12:10 AM (in response to Jörg Hoh)Yes, that is a really important principle that Jörg states. You should as far as possible use as high-level API as you can. You could do a lot of things using other techniques in CQ and JCR but using the AssetManager saves you a lot of "painfull" coding and makes it easier to upgrade to new versions of CQ.
Good point Jörg.
-
4. Re: How to move assets in different directory using java service
sachin1107 Mar 5, 2013 12:40 AM (in response to Jörg Hoh)We have been using the following code in java class to move the assets from one location to another and it is not working. Please suggest.
public void execute(WorkItem item, WorkflowSession arg1, MetaDataMap arg2)
throws WorkflowException {
WorkflowData workflowData = item.getWorkflowData();
String source = "/content/dam/ABC/working1/campus/";
String dest = "/content/dam/ABC/working1/southafrica";
damPath = workflowData.getPayload().toString();
arg1.getSession().move(source, dest);
arg1.getSession().save();
For testing purpose just taken static source and dest values.
Here source and destination is the classification already created in the dam.
Thanks,
Sachin Srivastava -
5. Re: How to move assets in different directory using java service
Jörg Hoh Mar 5, 2013 9:45 AM (in response to sachin1107)Sachin,
please check your log for any exceptions.
-
6. Re: How to move assets in different directory using java service
snayakar Jul 24, 2013 1:19 AM (in response to sachin1107)Hi ,
When you moved your nodes, Did the payload reflecting the moved node path as the new payload?
In case if we use the payload in the further workflow process steps, this will give an error , as the payload which the workflow process is pointing at has been moved now.
Can anybody help me to update the payload after the node is moved to a different position.
For example: when I started the workflow my Node is point at sourcepath= /content/usergenerated/mycomments/mycommentpage
If I moved this node path to destination path= /etc/commerce/products/approvedcomments/mycommentpage.
Do we need to set the new payload path ?
Why there is no method called setPayload in WorkflowData?
Your help in this regard will be much appreciated
Thanks


