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.plugins.directory.web.action;
35
36 import fr.paris.lutece.plugins.directory.business.Directory;
37 import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupService;
38 import fr.paris.lutece.util.html.ItemNavigator;
39 import fr.paris.lutece.util.url.UrlItem;
40
41 import java.util.ArrayList;
42 import java.util.Enumeration;
43 import java.util.List;
44
45 import javax.servlet.http.HttpServletRequest;
46
47
48
49
50
51 public final class DirectoryAdminSearchFields extends DefaultDirectorySearchFields
52 {
53 private static final long serialVersionUID = 7256733494058540733L;
54
55
56 private String _strCurrentPageIndexDirectory;
57 private int _nItemsPerPageDirectory;
58 private String _strCurrentPageIndexEntry;
59 private int _nItemsPerPageEntry;
60 private String _strCurrentPageIndexPrintMass;
61
62
63 private int _nItemsPerPagePrintMass;
64 private String _strCurrentPageIndex;
65 private String _strCurrentPageIndexDirectoryRecord;
66 private int _nItemsPerPageDirectoryRecord;
67 private int _nIdActive = ALL_INT;
68 private String _strWorkGroup = AdminWorkgroupService.ALL_GROUPS;
69 private int _nCountLine;
70 private int _nCountLineFailure;
71 private int _nIdWorkflowSate = ALL_INT;
72 private StringBuffer _strError;
73 private List<String> _listSelectedRecords;
74 private List<Integer> _listIdsResultRecord;
75 private ItemNavigator _itemNavigatorViewRecords;
76 private ItemNavigator _itemNavigatorHistory;
77 private String _strRedirectUrl;
78
79
80
81
82
83
84 public List<String> getSelectedRecords( )
85 {
86 return _listSelectedRecords;
87 }
88
89
90
91
92
93
94
95 public void setSelectedRecords( List<String> listSelectedRecords )
96 {
97 _listSelectedRecords = listSelectedRecords;
98 }
99
100
101
102
103
104
105 public String getCurrentPageIndexDirectory( )
106 {
107 return _strCurrentPageIndexDirectory;
108 }
109
110
111
112
113
114
115
116 public void setCurrentPageIndexDirectory( String strCurrentPageIndexDirectory )
117 {
118 _strCurrentPageIndexDirectory = strCurrentPageIndexDirectory;
119 }
120
121
122
123
124
125
126 public int getItemsPerPageDirectory( )
127 {
128 return _nItemsPerPageDirectory;
129 }
130
131
132
133
134
135
136
137 public void setItemsPerPageDirectory( int nItemsPerPageDirectory )
138 {
139 _nItemsPerPageDirectory = nItemsPerPageDirectory;
140 }
141
142
143
144
145
146
147 public String getCurrentPageIndexEntry( )
148 {
149 return _strCurrentPageIndexEntry;
150 }
151
152
153
154
155
156
157
158 public void setCurrentPageIndexEntry( String strCurrentPageIndexEntry )
159 {
160 _strCurrentPageIndexEntry = strCurrentPageIndexEntry;
161 }
162
163
164
165
166
167
168 public int getItemsPerPageEntry( )
169 {
170 return _nItemsPerPageEntry;
171 }
172
173
174
175
176
177
178
179 public void setItemsPerPageEntry( int nItemsPerPageEntry )
180 {
181 _nItemsPerPageEntry = nItemsPerPageEntry;
182 }
183
184
185
186
187
188
189 public String getCurrentPageIndexPrintMass( )
190 {
191 return _strCurrentPageIndexPrintMass;
192 }
193
194
195
196
197
198
199
200 public void setCurrentPageIndexPrintMass( String strCurrentPageIndexPrintMass )
201 {
202 _strCurrentPageIndexPrintMass = strCurrentPageIndexPrintMass;
203 }
204
205
206
207
208
209
210 public int getItemsPerPagePrintMass( )
211 {
212 return _nItemsPerPagePrintMass;
213 }
214
215
216
217
218
219
220
221 public void setItemsPerPagePrintMass( int nItemsPerPagePrintMass )
222 {
223 _nItemsPerPagePrintMass = nItemsPerPagePrintMass;
224 }
225
226
227
228
229
230
231 public String getCurrentPageIndex( )
232 {
233 return _strCurrentPageIndex;
234 }
235
236
237
238
239
240
241
242 public void setCurrentPageIndex( String strCurrentPageIndex )
243 {
244 _strCurrentPageIndex = strCurrentPageIndex;
245 }
246
247
248
249
250
251
252 public String getCurrentPageIndexDirectoryRecord( )
253 {
254 return _strCurrentPageIndexDirectoryRecord;
255 }
256
257
258
259
260
261
262
263 public void setCurrentPageIndexDirectoryRecord( String strCurrentPageIndexDirectoryRecord )
264 {
265 _strCurrentPageIndexDirectoryRecord = strCurrentPageIndexDirectoryRecord;
266 }
267
268
269
270
271
272
273 public int getItemsPerPageDirectoryRecord( )
274 {
275 return _nItemsPerPageDirectoryRecord;
276 }
277
278
279
280
281
282
283
284 public void setItemsPerPageDirectoryRecord( int nItemsPerPageDirectoryRecord )
285 {
286 _nItemsPerPageDirectoryRecord = nItemsPerPageDirectoryRecord;
287 }
288
289
290
291
292
293
294 public int getIdActive( )
295 {
296 return _nIdActive;
297 }
298
299
300
301
302
303
304
305 public void setIdActive( int nIdActive )
306 {
307 _nIdActive = nIdActive;
308 }
309
310
311
312
313
314
315 public String getWorkGroup( )
316 {
317 return _strWorkGroup;
318 }
319
320
321
322
323
324
325
326 public void setWorkGroup( String strWorkGroup )
327 {
328 _strWorkGroup = strWorkGroup;
329 }
330
331
332
333
334
335
336 public int getCountLine( )
337 {
338 return _nCountLine;
339 }
340
341
342
343
344
345
346
347 public void setCountLine( int nCountLine )
348 {
349 _nCountLine = nCountLine;
350 }
351
352
353
354
355
356
357 public int getCountLineFailure( )
358 {
359 return _nCountLineFailure;
360 }
361
362
363
364
365
366
367
368 public void setCountLineFailure( int nCountLineFailure )
369 {
370 _nCountLineFailure = nCountLineFailure;
371 }
372
373
374
375
376
377
378 public int get_nIdWorkflowSate( )
379 {
380 return _nIdWorkflowSate;
381 }
382
383
384
385
386
387
388
389 public void setIdWorkflowSate( int nIdWorkflowSate )
390 {
391 _nIdWorkflowSate = nIdWorkflowSate;
392 }
393
394
395
396
397
398
399 public StringBuffer getError( )
400 {
401 return _strError;
402 }
403
404
405
406
407
408
409
410 public void setError( StringBuffer strError )
411 {
412 _strError = strError;
413 }
414
415
416
417
418
419
420
421 public void setListIdsResultRecord( List<Integer> listIdsResultRecord )
422 {
423 _listIdsResultRecord = listIdsResultRecord;
424 }
425
426
427
428
429
430
431 public List<Integer> getListIdsResultRecord( )
432 {
433 return _listIdsResultRecord;
434 }
435
436
437
438
439
440
441
442
443
444
445
446 public void setItemNavigatorViewRecords( int nCurrentIdRecord, String strUrl, String strParameterName )
447 {
448 if ( _itemNavigatorViewRecords == null )
449 {
450 if ( ( _listIdsResultRecord != null ) && !_listIdsResultRecord.isEmpty( ) )
451 {
452 List<String> listIds = new ArrayList<String>( _listIdsResultRecord.size( ) );
453 int nCurrentItemId = 0;
454 int nIndex = 0;
455
456 for ( int nIdRecord : _listIdsResultRecord )
457 {
458 listIds.add( Integer.toString( nIdRecord ) );
459
460 if ( nIdRecord == nCurrentIdRecord )
461 {
462 nCurrentItemId = nIndex;
463 }
464
465 nIndex++;
466 }
467
468 _itemNavigatorViewRecords = new ItemNavigator( listIds, nCurrentItemId, strUrl, strParameterName );
469 }
470 }
471 else
472 {
473 _itemNavigatorViewRecords.setCurrentItemId( Integer.toString( nCurrentIdRecord ) );
474 }
475 }
476
477
478
479
480
481
482
483 public void setItemNavigatorViewRecords( ItemNavigator itemNavigator )
484 {
485 _itemNavigatorViewRecords = itemNavigator;
486 }
487
488
489
490
491
492
493 public ItemNavigator getItemNavigatorViewRecords( )
494 {
495 return _itemNavigatorViewRecords;
496 }
497
498
499
500
501
502
503
504
505
506
507
508 public void setItemNavigatorHistory( int nCurrentIdRecord, String strUrl, String strParameterName )
509 {
510 if ( _itemNavigatorHistory == null )
511 {
512 if ( ( _listIdsResultRecord != null ) && !_listIdsResultRecord.isEmpty( ) )
513 {
514 List<String> listIds = new ArrayList<String>( _listIdsResultRecord.size( ) );
515 int nCurrentItemId = 0;
516 int nIndex = 0;
517
518 for ( int nIdRecord : _listIdsResultRecord )
519 {
520 listIds.add( Integer.toString( nIdRecord ) );
521
522 if ( nIdRecord == nCurrentIdRecord )
523 {
524 nCurrentItemId = nIndex;
525 }
526
527 nIndex++;
528 }
529
530 _itemNavigatorHistory = new ItemNavigator( listIds, nCurrentItemId, strUrl, strParameterName );
531 }
532 }
533 else
534 {
535 _itemNavigatorHistory.setCurrentItemId( Integer.toString( nCurrentIdRecord ) );
536 }
537 }
538
539
540
541
542
543
544
545 public void setItemNavigatorHistory( ItemNavigator itemNavigator )
546 {
547 _itemNavigatorHistory = itemNavigator;
548 }
549
550
551
552
553
554
555 public ItemNavigator getItemNavigatorHistory( )
556 {
557 return _itemNavigatorHistory;
558 }
559
560
561
562
563
564
565
566 public void setRedirectUrl( HttpServletRequest request )
567 {
568 String strNextUrl = request.getRequestURI( );
569 UrlItem url = new UrlItem( strNextUrl );
570 Enumeration enumParams = request.getParameterNames( );
571
572 while ( enumParams.hasMoreElements( ) )
573 {
574 String strParamName = (String) enumParams.nextElement( );
575 url.addParameter( strParamName, request.getParameter( strParamName ) );
576 }
577
578 _strRedirectUrl = url.getUrl( );
579 }
580
581
582
583
584
585
586 public String getRedirectUrl( )
587 {
588 return _strRedirectUrl;
589 }
590
591
592
593
594 @Override
595 public String getDefaultIdSortEntry( Directory directory )
596 {
597 return directory.getIdSortEntry( );
598 }
599
600
601
602
603 @Override
604 public boolean isDefaultAscendingSort( Directory directory )
605 {
606 return directory.isAscendingSort( );
607 }
608 }