View Javadoc
1   package fr.paris.lutece.plugins.grustoragedb.service;
2   
3   
4   import fr.paris.lutece.plugins.grustoragedb.business.NotificationEventHome;
5   import fr.paris.lutece.portal.service.daemon.Daemon;
6   import fr.paris.lutece.portal.service.util.AppPropertiesService;
7   
8   /**
9    * My Daemon
10   */
11  public class NotificationEventDaemon extends Daemon
12  {
13  	private static final String PROPERTY_EVENT_NB_DAYS_BEFORE_PURGE = "grustoragedb.daemon.NotificationEventDaemon.purge.nbDaysBefore";
14  
15  	/**
16  	 * {@inheritDoc}
17  	 */  
18  	@Override
19  	public void run(  )
20  	{
21  		setLastRunLogs( purgeEvents( ) );
22  	}
23  
24  	/**
25  	 * purge events
26  	 * 
27  	 * @return the success of the purge
28  	 */
29  	private String purgeEvents( ) {
30  
31  		int nbDaysBeforePurge = AppPropertiesService.getPropertyInt( PROPERTY_EVENT_NB_DAYS_BEFORE_PURGE, 60 );
32  		
33  		NotificationEventHome.purge( nbDaysBeforePurge ) ;
34  
35  		return "Success (purge frequency : " + nbDaysBeforePurge + " days)";
36  	}
37  }