cancel
Showing results for 
Search instead for 
Did you mean: 

Archival

naveenkumar
Champ in-the-making
Champ in-the-making
hi all,
   For my application i need to move the content from one space to another after the expirationdate. Outside the web project i am able to do. But inside i have no idea about the path.here is my schedular job


<bean id="moveAction" class="org.alfresco.repo.action.scheduled.SimpleTemplateActionDefinition">
        <property name="actionName">
            <value>move</value>
        </property>
        <property name="parameterTemplates">
            <map>
               <entry>
                    <key>
                        <value>destination-folder</value>
                    </key>
                    <value>${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"//cm:Folder_x0020_Archive"')</value>
                </entry>
                <entry>
                    <key>
                        <value>assoc-type</value>
                    </key>
                    <value>${node.primaryParentAssoc.typeQName}</value>
                </entry>
                <entry>
                    <key>
                        <value>assoc-name</value>
                    </key>
                    <value>${node.primaryParentAssoc.QName}</value>
                </entry>
               <!– <entry>
                    <key>
                        <value>deep-copy</value>
                    </key>
                    <value>false</value>
                </entry> –>
            </map>
        </property>
        <property name="templateActionModelFactory">
            <ref bean="templateActionModelFactory"/>
        </property>
        <property name="dictionaryService">
            <ref bean="DictionaryService"/>
        </property>
        <property name="actionService">
            <ref bean="ActionService"/>
        </property>
        <property name="templateService">
            <ref bean="TemplateService"/>
        </property>
    </bean>

<bean id="moveTutorialEveryTenMinutes" class="org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition">
        <property name="transactionMode">
            <value>UNTIL_FIRST_FAILURE</value>
        </property>
        <property name="compensatingActionMode">
            <value>IGNORE</value>
        </property>
        <property name="searchService">
            <ref bean="SearchService"/>
        </property>
        <property name="templateService">
            <ref bean="TemplateService"/>
        </property>
        <property name="queryLanguage">
            <value>lucene</value>
        </property>
        <property name="stores">
            <list>
                <value>workspace://SpacesStore</value>
            </list>
        </property>
        <property name="queryTemplate">
           <value> @wca\:expirationDate:${luceneDateRange(today,today)}</value>
        </property>
        <property name="cronExpression">
            <value>0 0/1 * * * ?</value>
        </property>
        <property name="jobName">
            <value>jobC</value>
        </property>
        <property name="jobGroup">
            <value>jobGroup</value>
        </property>
        <property name="triggerName">
            <value>triggerC</value>
        </property>
        <property name="triggerGroup">
            <value>triggerGroup</value>
        </property>
        <property name="scheduler">
            <ref bean="schedulerFactory"/>
        </property>
        <property name="actionService">
            <ref bean="ActionService"/>
        </property>
        <property name="templateActionModelFactory">
            <ref bean="templateActionModelFactory"/>
        </property>
        <property name="templateActionDefinition">
            <ref bean="moveAction"/>
        </property>
        <property name="transactionService">
            <ref bean="TransactionService"/>
        </property>
        <property name="runAsUser">
            <value>System</value>
        </property>
    </bean>

Created two folders(Folder Archive and software) inside the web project, After expiry i want to move the content from software folder to Archive folder.here is my destination folder location:: I think the path is wrong??
<value>${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"//cm:Folder_x0020_Archive"')</value>

Here is my query template based on the property.
<property name="queryTemplate">
           <value> @wca\:expirationDate:${luceneDateRange(today,today)}</value>
        </property>

Please any one help me..

Thanks
Naveen
7 REPLIES 7

derek
Star Contributor
Star Contributor
Hi,

You can use your Node Browser to locate the node and see the real path.  For instance, I browsed to the "Guest Home" and the following Lucene query pulls it back:
PATH:"//app:guest_home"
What I'm saying is that you should check the path to the node in the Node Browser.

Regards

naveenkumar
Champ in-the-making
Champ in-the-making
hi derek,

   Is that possible to move the content from one space to another inside web projects based on expiration date?? If yes tell me the way… I tried using the above code its not worked.

Please help me.

Thanks
Naveen

naveenkumar
Champ in-the-making
Champ in-the-making
when i ran my tomcat i am getting erorr like this:

11:38:00,046 ERROR [org.quartz.core.JobRunShell] Job jobGroup.jobC threw an unhandled Exception: 
org.alfresco.service.cmr.repository.TemplateException: IO Error during processing of the template '${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"//cm:Folder_x0200_Archive"')'. Please contact your system administrator.
   at org.alfresco.repo.template.FreeMarkerProcessor.processString(FreeMarkerProcessor.java:271)
   at org.alfresco.repo.processor.TemplateServiceImpl.processTemplateString(TemplateServiceImpl.java:210)
   at org.alfresco.repo.processor.TemplateServiceImpl.processTemplateString(TemplateServiceImpl.java:229)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:256)
   at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:191)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
   at $Proxy61.processTemplateString(Unknown Source)
   at org.alfresco.repo.action.scheduled.SimpleTemplateActionDefinition.getAction(SimpleTemplateActionDefinition.java:187)
   at org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition.getAction(CronScheduledQueryBasedTemplateActionDefinition.java:268)
   at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1$2.doWork(AbstractScheduledAction.java:570)
   at org.alfresco.repo.transaction.TransactionUtil.executeInTransaction(TransactionUtil.java:189)
   at org.alfresco.repo.transaction.TransactionUtil.executeInUserTransaction(TransactionUtil.java:89)
   at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1.runTransactionalAction(AbstractScheduledAction.java:564)
   at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition$1.doWork(AbstractScheduledAction.java:432)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:260)
   at org.alfresco.repo.action.scheduled.AbstractScheduledAction$JobDefinition.execute(AbstractScheduledAction.java:398)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
Caused by: freemarker.core.ParseException: Unexpected end of file reached.

   at freemarker.core.FMParser.generateParseException(FMParser.java:4635)
   at freemarker.core.FMParser.jj_consume_token(FMParser.java:4506)
   at freemarker.core.FMParser.StringOutput(FMParser.java:1052)
   at freemarker.core.FMParser.Content(FMParser.java:2531)
   at freemarker.core.FMParser.OptionalBlock(FMParser.java:2742)
   at freemarker.core.FMParser.Root(FMParser.java:2914)
   at freemarker.template.Template.<init>(Template.java:149)
   at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:376)
   at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:347)
   at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:229)
   at freemarker.template.Configuration.getTemplate(Configuration.java:487)
   at freemarker.template.Configuration.getTemplate(Configuration.java:452)
   at org.alfresco.repo.template.FreeMarkerProcessor.processString(FreeMarkerProcessor.java:244)
   … 32 more

Please help me..

Thanks
Naveen

kevinr
Star Contributor
Star Contributor
There is no Alfresco FreeMarker API called 'selectSingleNode' - what are you trying to do?

naveenkumar
Champ in-the-making
Champ in-the-making
I want to move the content from one space to another inside web projects based on expiration date.. Suggest some idea to implement that…

Thanks
Naveen

derek
Star Contributor
Star Contributor
You could take a look at the Records Management module.  It does that kind of thing.

naveenkumar
Champ in-the-making
Champ in-the-making
Please give me the link…