AnsweredAssumed Answered

Scheduled action in alfresco

Question asked by ranj on Dec 14, 2012
Hello All,

I am working on the creation of a scheduled action for sending an email to the owner when the document reaches the expiry date. I have created the action and scheduled it. But it is not working.

can anyone please help me in fixing the issue?

My xml file.

sample-action-context.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
   
    <bean id="expiryNotification" class="com.sample.expirynotification.ExpiryNotificationAction" parent="action-executer">      
        <property name="actionService">
            <ref bean="ActionService"/>
        </property>
        <property name="fileFolderService">
            <ref bean="FileFolderService" />
        </property>
        <property name="searchService">
            <ref bean="SearchService" />
        </property>
        <property name="dictionaryService">
            <ref bean="DictionaryService"/>
        </property>
        <property name="templateService">
            <ref bean="TemplateService"/>
        </property>
   </bean>
      
        <!–
        Define the model factory used to generate object models suitable for use with freemarker templates.
        –>
        <bean id="templateActionModelFactory" class="org.alfresco.repo.action.scheduled.FreeMarkerWithLuceneExtensionsModelFactory">
            <property name="serviceRegistry">
                <ref bean="ServiceRegistry"/>
            </property>
        </bean>
      
        <!–
        An action template that scans files for virus.  
        –>
        <bean id="expiryNotificationaction" class="org.alfresco.repo.action.scheduled.SimpleTemplateActionDefinition">
            <property name="actionName">
                <value>expiryNotification</value>
            </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>
      
        <!–
        Define a job for scanning the files for virus.
        –>
        <bean id="docExpiryNitifcationEveryWeek" class="org.alfresco.repo.action.scheduled.CronScheduledQueryBasedTemplateActionDefinition">
            <property name="transactionMode">
                <value>ISOLATED_TRANSACTIONS</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>
            <!– Find all nodes under 'Company Home' –>
            <property name="queryTemplate">
                <value>+PATH:"/app:company_home/*//*" +EXACTTYPE:"cm:content"</value>
            </property>
            <!– Execute every one minute –>
            <property name="cronExpression">
                 <value>0 0/1 * * * ?</value>
            </property>
            <property name="jobName">
                <value>jobA</value>
            </property>
            <property name="jobGroup">
                <value>jobGroup</value>
            </property>
            <property name="triggerName">
                <value>triggerA</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="expiryNotificationaction"/>
            </property>
            <property name="transactionService">
                <ref bean="TransactionService"/>
            </property>
            <property name="runAsUser">
                <value>admin</value>
            </property>
        </bean>
     
</beans>

Outcomes