View Javadoc
1   package fr.paris.lutece.plugins.helpdesk.utils;
2   
3   import fr.paris.lutece.portal.business.event.ResourceEvent;
4   import fr.paris.lutece.portal.business.indexeraction.IndexerAction;
5   import fr.paris.lutece.portal.service.event.ResourceEventManager;
6   
7   /**
8    * 
9    * HelpdeskIndexerUtils
10   *
11   */
12  public class HelpdeskIndexerUtils
13  {
14  	// Indexed resource type name
15  	public static final String CONSTANT_SUBJECT_TYPE_RESOURCE = "HELPDESK_SUBJECT";
16  	public static final String CONSTANT_QUESTION_ANSWER_TYPE_RESOURCE = "HELPDESK_QUESTION_ANSWER";
17  	
18  	/**
19       * Warn that a action has been done.
20       * @param strIdDocument the document id
21       * @param nIdTask the key of the action to do
22       * @param strResourceType the ttpe of the resource
23       */
24      public static void addIndexerAction( String strIdDocument, int nIdTask, String strResourceType )
25      {
26          ResourceEvent event = new ResourceEvent();
27          event.setIdResource( strIdDocument );
28          event.setTypeResource( strResourceType );
29          switch (nIdTask)
30          {
31          case IndexerAction.TASK_CREATE:
32          	ResourceEventManager.fireAddedResource( event );
33          	break;
34          case IndexerAction.TASK_MODIFY:
35          	ResourceEventManager.fireUpdatedResource( event );
36          	break;
37          case IndexerAction.TASK_DELETE:
38          	ResourceEventManager.fireDeletedResource( event );
39          	break;
40          default:
41          	break;
42          }
43      }
44  }