1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.portal.web.search;
35
36 import fr.paris.lutece.portal.service.search.IndexationService;
37 import fr.paris.lutece.portal.service.search.SearchIndexer;
38 import fr.paris.lutece.portal.service.template.AppTemplateService;
39 import fr.paris.lutece.portal.web.admin.AdminFeaturesPageJspBean;
40 import fr.paris.lutece.util.html.HtmlTemplate;
41
42 import java.util.Collection;
43 import java.util.HashMap;
44
45 import javax.servlet.http.HttpServletRequest;
46
47
48
49
50
51 public class SearchIndexationJspBean extends AdminFeaturesPageJspBean
52 {
53
54
55
56
57
58 public static final String RIGHT_INDEXER = "CORE_SEARCH_INDEXATION";
59 private static final long serialVersionUID = 2585709013740037568L;
60 private static final String TEMPLATE_MANAGE_INDEXER = "admin/search/manage_search_indexation.html";
61 private static final String TEMPLATE_INDEXER_LOGS = "admin/search/search_indexation_logs.html";
62 private static final String MARK_LOGS = "logs";
63 private static final String MARK_INDEXERS_LIST = "indexers_list";
64
65
66
67
68
69
70
71 public String getIndexingProperties( HttpServletRequest request )
72 {
73 HashMap<String, Collection<SearchIndexer>> model = new HashMap<String, Collection<SearchIndexer>>( );
74 Collection<SearchIndexer> listIndexers = IndexationService.getIndexers( );
75 model.put( MARK_INDEXERS_LIST, listIndexers );
76
77 HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_MANAGE_INDEXER, getLocale( ), model );
78
79 return getAdminPage( template.getHtml( ) );
80 }
81
82
83
84
85
86
87
88 public String doIndexing( HttpServletRequest request )
89 {
90 HashMap<String, Object> model = new HashMap<String, Object>( );
91 String strLogs;
92
93 if ( request.getParameter( "incremental" ) != null )
94 {
95 strLogs = IndexationService.processIndexing( false );
96 }
97 else
98 {
99 strLogs = IndexationService.processIndexing( true );
100 }
101
102 model.put( MARK_LOGS, strLogs );
103
104 HtmlTemplate template = AppTemplateService.getTemplate( TEMPLATE_INDEXER_LOGS, null, model );
105
106 return getAdminPage( template.getHtml( ) );
107 }
108 }