AnsweredAssumed Answered

How to get Alfresco context and audit ScheduledJob in java?

Question asked by jrautner on Oct 11, 2017
Latest reply on Oct 17, 2017 by afaust

Hi eveybody,

 

i need to audit my scheduled job, which is defined in xml beans and java class, but i m not able to get context from java class or call auditComponent.recordValues() method. Is there some guide for this in java or did i miss something

 

this is my scheduledjob definition xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">


<bean id="sk.jobs.ScheduledJobExecuter" class="sk.jobs.ScheduledJobExecuter">
<property name="serviceRegistry">
<ref bean="ServiceRegistry" />
</property>
</bean>

<bean id="sk.jobs.jobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>sk.iway.makro.jobs.ScheduledJob</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="jobExecuter">
<ref bean="sk.iway.makro.jobs.ScheduledJobExecuter" />
</entry>
<entry key="jobLockService">
<ref bean="jobLockService" />
</entry>
</map>
</property>
</bean>

<bean id="sk.jobs.trigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="sk.iway.makro.jobs.jobDetail" />
</property>
<property name="cronExpression">
<value>${dms3.scheduledjob_invoice.cronexpression}</value>
</property>
<property name="startDelay">
<value>${dms3.scheduledjob_invoice.cronstartdelay}</value>
</property>
</bean>

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean" scope="singleton">
<property name="triggers">
<list>
<ref bean="sk.jobs.trigger"/>
</list>
</property>
</bean>

</beans>

 

this is my audit def/

<bean id="auditService" class="org.alfresco.repo.audit.AuditServiceImpl">
<property name="auditComponent">
<ref bean="auditComponent"/>
</property>
</bean>

<!-- Audit component -->

<bean id="auditComponent" class="org.alfresco.repo.audit.AuditComponentImpl">
<property name="transactionService" ref="transactionService"/>
<property name="auditDAO" ref="auditDAO"/>
<property name="auditModelRegistry" ref="Audit"/>
<property name="propertyValueDAO" ref="propertyValueDAO"/>
<property name="userAuditFilter" ref="userAuditFilter"/>
<property name="auditFilter">
<bean class="org.alfresco.repo.audit.PropertyAuditFilter">
<property name="properties" ref="global-properties" />
</bean>
</property>
</bean

 

 

Thank you for any help

sincerally

Jakub

Outcomes