<?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_Default_Prune_History_Job"/>
                <ref bean="pruneShadowAccountsJob"/>
                <ref bean="pruneOperationsAccountsJob"/>
                <ref bean="IDM_Login_Event_Prune_History_Job"/>
                <ref bean="deleteExpiredUrlTicketsJob"/>
            </list>
        </property>
        <property name="triggers">
            <list>
                <ref bean="IDM_Default_Prune_History_Job_Trigger"/>
                <ref bean="pruneShadowAccountsJobTrigger"/>
                <ref bean="pruneOperationsAccountsJobTrigger"/>
                <ref bean="IDM_Login_Event_Prune_History_Job_Trigger"/>
                <ref bean="deleteExpiredUrlTicketsJobTrigger"/>
            </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_Default_Prune_History_Job">
        <property name="name" value="IDM_Default_Prune_History_Job"/>
        <property name="description" value="Batch Job IDM Default 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"/>
                        <entry key="skipList" value="tidma_user_login_info_v,tidma_cred_login_info_v,tidma_credential_v,tidma_fido2_v,tidma_fido_uaf_v"/>
                    </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.JobDetailFactoryBean" id="pruneOperationsAccountsJob">
        <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="30"/>
                        <entry key="daysStatusArchived" value="335"/>
                        <entry key="disableOutdatedUsers" value="true"/>
                        <entry key="disableNotYetActiveUsers" value="false"/>
                        <entry key="excludeTechnicalUsers" value="true"/>
                        <entry key="restrictToClients" value="d9a334a6-b6f5-4982-a24e-13ae095a60fa"/>
                    </map>
                </constructor-arg>
            </bean>
        </property>
    </bean>
    <bean class="org.springframework.scheduling.quartz.JobDetailFactoryBean" id="IDM_Login_Event_Prune_History_Job">
        <property name="name" value="IDM_Login_Event_Prune_History_Job"/>
        <property name="description" value="Batch Job IDM Login Event 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="31"/>
                        <entry key="skipList" value="tidma_application_v,tidma_authorization_appl_v,tidma_authorization_client_v,tidma_authorization_erole_v,tidma_authorization_unit_v,tidma_authorization_v,tidma_cert_info_v,tidma_client_application_v,tidma_client_v,tidma_consent_v,tidma_dict_entry_v,tidma_dict_entry_value_v,tidma_enterprise_auth_v,tidma_enterprise_role_v,tidma_erole_member_v,tidma_mobile_signature_v,tidma_oath_v,tidma_personal_answer_v,tidma_personal_question_v,tidma_policy_configuration_v,tidma_policy_parameter_v,tidma_profile_v,tidma_property_allowed_val_v,tidma_property_v,tidma_property_value_v,tidma_role_v,tidma_saml_federation_v,tidma_template_collection_v,tidma_template_text_v,tidma_template_v,tidma_terms_application_v,tidma_terms_url_v,tidma_terms_v,tidma_unit_cred_policy_v,tidma_unit_v,tidma_user_v"/>
                    </map>
                </constructor-arg>
            </bean>
        </property>
    </bean>
    <bean class="org.springframework.scheduling.quartz.JobDetailFactoryBean" id="deleteExpiredUrlTicketsJob">
        <property name="description" value="Delete expired url ticket credentials"/>
        <property name="jobClass" value="ch.nevis.idm.batch.jobs.UpdateCredentialStateJob"/>
        <property name="durability" value="true"/>
        <property name="jobDataMap">
            <bean class="org.quartz.JobDataMap">
                <constructor-arg>
                    <map>
                        <entry key="credentialTypes" value="URLTICKET"/>
                        <entry key="expireAction" value="delete"/>
                        <entry key="sendingMethod" value="None"/>
                        <entry key="restrictToClients" value="d9a334a6-b6f5-4982-a24e-13ae095a60fa, cfa9c9b9-119f-4dff-9bb8-86d7c0cf2720"/>
                    </map>
                </constructor-arg>
            </bean>
        </property>
    </bean>
    <bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean" id="IDM_Default_Prune_History_Job_Trigger">
        <property name="name" value="IDM_Default_Prune_History_Job_Trigger"/>
        <property name="description" value="Generated by nevisAdmin 4 pattern 0957497767812057fbf138cf"/>
        <property name="group" value="BatchGroup"/>
        <property name="jobDetail" ref="IDM_Default_Prune_History_Job"/>
        <property name="cronExpression" value="10 0 0 18 * ?"/>
    </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>
    <bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean" id="pruneOperationsAccountsJobTrigger">
        <property name="description" value="Archive and delete obsolete operations accounts"/>
        <property name="jobDetail" ref="pruneOperationsAccountsJob"/>
        <property name="cronExpression" value="30 1 0 * * ?"/>
    </bean>
    <bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean" id="IDM_Login_Event_Prune_History_Job_Trigger">
        <property name="name" value="IDM_Login_Event_Prune_History_Job_Trigger"/>
        <property name="description" value="Generated by nevisAdmin 4 pattern d4c123d7dd5d7126ff7a03b0"/>
        <property name="group" value="BatchGroup"/>
        <property name="jobDetail" ref="IDM_Login_Event_Prune_History_Job"/>
        <property name="cronExpression" value="05 0 0 18 * ?"/>
    </bean>
    <bean class="org.springframework.scheduling.quartz.CronTriggerFactoryBean" id="deleteExpiredUrlTicketsJobTrigger">
        <property name="description" value="Delete expired url ticket credentials"/>
        <property name="jobDetail" ref="deleteExpiredUrlTicketsJob"/>
        <property name="cronExpression" value="45 0 0 * * ?"/>
    </bean>
</beans>
