<?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.xsd">
    <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean" id="exportScheduler">
        <property name="jobDetails">
            <list>
                <ref bean="IDM_Prune_History_Job"/>
                <ref bean="pruneShadowAccountsJob"/>
            </list>
        </property>
        <property name="triggers">
            <list>
                <ref bean="IDM_Prune_History_Job_Trigger"/>
                <ref bean="pruneShadowAccountsJobTrigger"/>
            </list>
        </property>
        <property name="dataSource">
            <ref bean="dataSource"/>
        </property>
        <property name="quartzProperties">
            <props>
                <prop key="org.quartz.scheduler.instanceId">AUTO</prop>
                <prop key="org.quartz.scheduler.instanceName">exportScheduler</prop>
                <prop key="org.quartz.scheduler.makeSchedulerThreadDaemon">true</prop>
                <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
                <prop key="org.quartz.threadPool.makeThreadsDaemons">true</prop>
                <prop key="org.quartz.threadPool.threadCount">1</prop>
                <prop key="org.quartz.jobStore.tablePrefix">TIDMQ_</prop>
                <prop key="org.quartz.jobStore.class">org.springframework.scheduling.quartz.LocalDataSourceJobStore</prop>
                <prop key="org.quartz.jobStore.driverDelegateClass">#{databaseConfigurationService.getDatabaseType() == T(ch.adnovum.nevisidm.service.properties.DatabaseType).POSTGRESQL ? 'org.quartz.impl.jdbcjobstore.PostgreSQLDelegate' : 'org.quartz.impl.jdbcjobstore.StdJDBCDelegate' }</prop>
                <prop key="org.quartz.jobStore.isClustered">true</prop>
                <prop key="org.quartz.jobStore.useProperties">false</prop>
            </props>
        </property>
        <property name="applicationContextSchedulerContextKey" value="applicationContext"/>
    </bean>
    <bean class="org.springframework.scheduling.quartz.JobDetailFactoryBean" id="IDM_Prune_History_Job">
        <property name="name" value="IDM_Prune_History_Job"/>
        <property name="description" value="Batch Job IDM Prune History Job"/>
        <property name="group" value="BatchGroup"/>
        <property name="jobClass" value="ch.nevis.idm.batch.jobs.PruneHistoryJob"/>
        <property name="durability" value="true"/>
        <property name="jobDataMap">
            <bean class="org.quartz.JobDataMap">
                <constructor-arg>
                    <map>
                        <entry key="days" value="365"/>
                    </map>
                </constructor-arg>
            </bean>
        </property>
    </bean>
    <bean class="org.springframework.scheduling.quartz.JobDetailFactoryBean" id="pruneShadowAccountsJob">
        <property name="description" value="Archive and delete obsolete shadow accounts"/>
        <property name="jobClass" value="ch.nevis.idm.batch.jobs.UpdateUserStateJob"/>
        <property name="durability" value="true"/>
        <property name="jobDataMap">
            <bean class="org.quartz.JobDataMap">
                <constructor-arg>
                    <map>
                        <entry key="daysNoActivity" value="-1"/>
                        <entry key="considerUsersNeverLoggedIn" value="true"/>
                        <entry key="sendWarning" value="false"/>
                        <entry key="daysGracePeriod" value="1"/>
                        <entry key="daysStatusDisabled" value="15"/>
                        <entry key="daysStatusArchived" value="85"/>
                        <entry key="disableOutdatedUsers" value="true"/>
                        <entry key="disableNotYetActiveUsers" value="true"/>
                        <entry key="excludeTechnicalUsers" value="true"/>
                        <entry key="restrictToClients" value="9f30aa08-4c53-458c-b144-90c16dc5ed6e"/>
                    </map>
                </constructor-arg>
            </bean>
        </property>
    </bean>
    <bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean" id="IDM_Prune_History_Job_Trigger">
        <property name="name" value="IDM_Prune_History_Job_Trigger"/>
        <property name="description" value="Generated by nevisAdmin 4 pattern 0957497767812057fbf138cf"/>
        <property name="group" value="BatchGroup"/>
        <property name="jobDetail" ref="IDM_Prune_History_Job"/>
        <property name="cronExpression" value="0 0 0 * * ?"/>
    </bean>
    <bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean" id="pruneShadowAccountsJobTrigger">
        <property name="description" value="Archive and delete obsolete shadow accounts"/>
        <property name="jobDetail" ref="pruneShadowAccountsJob"/>
        <property name="cronExpression" value="30 0 0 * * ?"/>
    </bean>
</beans>
