cancel
Showing results for 
Search instead for 
Did you mean: 

Move a node in a schedule task.

damunoz
Champ in-the-making
Champ in-the-making
Hello,

I am new to alfresco, and I have been trying to implement a schedule task that would move contract (nodes of type contracts) from a node called Active to a node called Archived.

The idea es that I can have many ClientX/Contract nodes, and inside each Contract node I can have Active/Archived nodes…  So for example, if in ClientA/Contracts/Active I have a expired contract, i have to move it to ClientA/Contracts/Archived.  The same for ClientB, ClientC, etc…

I have been successful at creating the search query that finds all the nodes that need to move, but I am having difficulties creating the destination-folder code.  This is what I have:

<entry>
                    <key>
                        <value>destination-folder</value>
                    </key>
                    <value>${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/../Archived/"' )}</value>
                </entry>

Someone suggested me to use the following:

<entry>
                    <key>
                        <value>destination-folder</value>
                    </key>
                    <value>${node.childrenByXPath("../Archived/")}</value>
                </entry>

But that is returning an error message sayin that expected something else, so I am guessing that is not the correct approach. (Also, I haven't seen this approach in other posts).

Any help will be greatly appreciated.
1 REPLY 1

damunoz
Champ in-the-making
Champ in-the-making
This is the error message I am getting (using ${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/../Archived/"' )} ).


10:42:00,027  ERROR [quartz.core.ErrorLogger] Job (jobGroup.jobA threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.alfresco.error.AlfrescoRuntimeException: 09120005 Invalid store ref: Does not contain ://   //SpacesStore', 'lucene', 'PATH:"/../Archived]
   at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 09120005 Invalid store ref: Does not contain ://   //SpacesStore', 'lucene', 'PATH:"/../Archived
   at org.alfresco.service.cmr.repository.StoreRef.<init>(StoreRef.java:74)
   at org.alfresco.service.cmr.repository.NodeRef.<init>(NodeRef.java:87)