View Javadoc
1   /*
2    * Copyright (c) 2002-2017, Mairie de Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.plugins.directory.business;
35  
36  import fr.paris.lutece.plugins.directory.business.attribute.DirectoryAttribute;
37  import fr.paris.lutece.plugins.directory.business.rss.DirectoryResourceRssConfigRemovalListener;
38  import fr.paris.lutece.plugins.directory.service.DirectoryXslRemovalListenerService;
39  import fr.paris.lutece.plugins.directory.service.FileImgService;
40  import fr.paris.lutece.plugins.directory.utils.DirectoryUtils;
41  import fr.paris.lutece.portal.service.plugin.Plugin;
42  import fr.paris.lutece.portal.service.rbac.RBACResource;
43  import fr.paris.lutece.portal.service.regularexpression.RegularExpressionRemovalListenerService;
44  import fr.paris.lutece.portal.service.workflow.WorkflowRemovalListenerService;
45  import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource;
46  import fr.paris.lutece.portal.service.workgroup.WorkgroupRemovalListenerService;
47  import fr.paris.lutece.util.date.DateUtil;
48  import fr.paris.lutece.util.xml.XmlUtil;
49  
50  import java.sql.Timestamp;
51  
52  import java.util.HashMap;
53  import java.util.List;
54  import java.util.Locale;
55  
56  /**
57   *
58   * Class Directory
59   *
60   */
61  public class Directory implements AdminWorkgroupResource, RBACResource
62  {
63      public static final String ROLE_NONE = "none";
64      public static final String RESOURCE_TYPE = "DIRECTORY_DIRECTORY_TYPE";
65      public static final int STATE_ENABLE = 1;
66      public static final int STATE_DISABLE = 0;
67      private static final String TAG_LIST_ENTRY = "list-entry";
68      private static final String TAG_DIRECTORY = "directory";
69      private static final String TAG_TITLE = "title";
70      private static final String TAG_LIST_RECORD = "list-record";
71      private static final String TAG_CREATION_DATE = "creation-date";
72      private static final String ATTRIBUTE_ID = "id";
73      private static DirectoryWorkgroupRemovalListener _listenerWorkgroup;
74      private static DirectoryRegularExpressionRemovalListener _listenerRegularExpression;
75      private static DirectoryXslRemovalListener _listenerXslRemovalListener;
76      private static DirectoryWorkflowRemovalListener _listenerWorkflowRemovalListener;
77      private static EntryTypeDirectoryRemovalListener _listenerEntryDirectoryRemovalListener;
78      private static DirectoryResourceRssConfigRemovalListener _listenerDirectoryResourceRssConfigRemovalListener;
79      private int _nIdDirectory;
80      private String _strTitle;
81      private String _strFrontOfficeTitle;
82      private String _strDescription;
83      private String _strUnavailabilityMessage;
84      private String _strWorkgroupKey;
85      private String _strRoleKey;
86      private Timestamp _tDateCreation;
87      private boolean _bIsEnabled;
88      private int _nIdResultListTemplate = DirectoryUtils.CONSTANT_ID_NULL;
89      private int _nIdResultRecordTemplate = DirectoryUtils.CONSTANT_ID_NULL;
90      private int _nIdFormSearchTemplate = DirectoryUtils.CONSTANT_ID_NULL;
91      private int _nNumberRecordPerPage;
92      private List<DirectoryAction> _listActions;
93      private int _nIdWorkflow = DirectoryUtils.CONSTANT_ID_NULL;
94      private int _nIdWorkflowStateToRemove = DirectoryUtils.CONSTANT_ID_NULL;
95      private boolean _bDisplaySearchState;
96      private boolean _bDisplaySearchComplementaryState;
97      private String _strSortEntryId;
98      private boolean _bAscSort;
99      private String _strSortEntryIdFront;
100     private boolean _bAscSortFront;
101     private boolean _bRecordActivated;
102     private boolean _bIsIndexed;
103     @DirectoryAttribute( "searchOperatorOr" )
104     private boolean _bSearchOperatorOr;
105 
106     // Creation date field
107     @DirectoryAttribute( "dateShownInResultList" )
108     private boolean _bDateShownInResultList;
109     @DirectoryAttribute( "dateShownInResultRecord" )
110     private boolean _bDateShownInResultRecord;
111     @DirectoryAttribute( "dateShownInHistory" )
112     private boolean _bDateShownInHistory;
113     @DirectoryAttribute( "dateShownInSearch" )
114     private boolean _bDateShownInSearch;
115     @DirectoryAttribute( "dateShownInAdvancedSearch" )
116     private boolean _bDateShownInAdvancedSearch;
117     @DirectoryAttribute( "dateShownInMultiSearch" )
118     private boolean _bDateShownInMultiSearch;
119     @DirectoryAttribute( "dateShownInExport" )
120     private boolean _bDateShownInExport;
121 
122     // Modification date field
123     @DirectoryAttribute( "dateModificationShownInResultList" )
124     private boolean _bDateModificationShownInResultList;
125     @DirectoryAttribute( "dateModificationShownInResultRecord" )
126     private boolean _bDateModificationShownInResultRecord;
127     @DirectoryAttribute( "dateModificationShownInHistory" )
128     private boolean _bDateModificationShownInHistory;
129     @DirectoryAttribute( "dateModificationShownInSearch" )
130     private boolean _bDateModificationShownInSearch;
131     @DirectoryAttribute( "dateModificationShownInAdvancedSearch" )
132     private boolean _bDateModificationShownInAdvancedSearch;
133     @DirectoryAttribute( "dateModificationShownInMultiSearch" )
134     private boolean _bDateModificationShownInMultiSearch;
135     @DirectoryAttribute( "dateModificationShownInExport" )
136     private boolean _bDateModificationShownInExport;
137 
138     /**
139      * Initialize the Directory
140      */
141     public static void init( )
142     {
143         // Create removal listeners and register them
144         if ( _listenerWorkgroup == null )
145         {
146             _listenerWorkgroup = new DirectoryWorkgroupRemovalListener( );
147             WorkgroupRemovalListenerService.getService( ).registerListener( _listenerWorkgroup );
148         }
149 
150         if ( _listenerRegularExpression == null )
151         {
152             _listenerRegularExpression = new DirectoryRegularExpressionRemovalListener( );
153             RegularExpressionRemovalListenerService.getService( ).registerListener( _listenerRegularExpression );
154         }
155 
156         if ( _listenerXslRemovalListener == null )
157         {
158             _listenerXslRemovalListener = new DirectoryXslRemovalListener( );
159             DirectoryXslRemovalListenerService.getService( ).registerListener( _listenerXslRemovalListener );
160         }
161 
162         if ( _listenerWorkflowRemovalListener == null )
163         {
164             _listenerWorkflowRemovalListener = new DirectoryWorkflowRemovalListener( );
165             WorkflowRemovalListenerService.getService( ).registerListener( _listenerWorkflowRemovalListener );
166         }
167 
168         if ( _listenerEntryDirectoryRemovalListener == null )
169         {
170             _listenerEntryDirectoryRemovalListener = new EntryTypeDirectoryRemovalListener( );
171             EntryRemovalListenerService.getService( ).registerListener( _listenerEntryDirectoryRemovalListener );
172         }
173 
174         if ( _listenerDirectoryResourceRssConfigRemovalListener == null )
175         {
176             _listenerDirectoryResourceRssConfigRemovalListener = new DirectoryResourceRssConfigRemovalListener( );
177             EntryRemovalListenerService.getService( ).registerListener( _listenerDirectoryResourceRssConfigRemovalListener );
178         }
179 
180         // ImageResourceManager
181         FileImgService.getInstance( ).register( );
182     }
183 
184     /**
185      *
186      * @return the title of the directory
187      */
188     public String getTitle( )
189     {
190         return _strTitle;
191     }
192 
193     /**
194      * set the title of the directory
195      * 
196      * @param strTitle
197      *            the title of the directory
198      */
199     public void setTitle( String strTitle )
200     {
201         _strTitle = strTitle;
202     }
203 
204     /**
205      *
206      * @return the front office title of the directory
207      */
208     public String getFrontOfficeTitle( )
209     {
210         return _strFrontOfficeTitle;
211     }
212 
213     /**
214      * set the front office title of the directory
215      * 
216      * @param strFrontOfficeTitle
217      *            the front office title of the directory
218      */
219     public void setFrontOfficeTitle( String strFrontOfficeTitle )
220     {
221         _strFrontOfficeTitle = strFrontOfficeTitle;
222     }
223 
224     /**
225      *
226      * @return the description of the directory
227      */
228     public String getDescription( )
229     {
230         return _strDescription;
231     }
232 
233     /**
234      * @return the _bDisplaySearchState
235      */
236     public boolean isDisplaySearchState( )
237     {
238         return _bDisplaySearchState;
239     }
240 
241     /**
242      * @param displayState
243      *            the _bDisplaySearchState to set
244      */
245     public void setDisplaySearchState( boolean displayState )
246     {
247         _bDisplaySearchState = displayState;
248     }
249 
250     /**
251      * @return the _bDisplayComplementarySearchState
252      */
253     public boolean isDisplayComplementarySearchState( )
254     {
255         return _bDisplaySearchComplementaryState;
256     }
257 
258     /**
259      * @param displayState
260      *            the _bDisplayComplementarySearchState to set
261      */
262     public void setDisplayComplementarySearchState( boolean displayState )
263     {
264         _bDisplaySearchComplementaryState = displayState;
265     }
266 
267     /**
268      * set the description of the directory
269      * 
270      * @param description
271      *            the description of the directory
272      */
273     public void setDescription( String description )
274     {
275         this._strDescription = description;
276     }
277 
278     /**
279      *
280      * @return the unavailability message of the directory
281      */
282     public String getUnavailabilityMessage( )
283     {
284         return _strUnavailabilityMessage;
285     }
286 
287     /**
288      * set the unavailability message of the directory
289      * 
290      * @param unavailabilityMessage
291      *            the unavailability message of the directory
292      */
293     public void setUnavailabilityMessage( String unavailabilityMessage )
294     {
295         _strUnavailabilityMessage = unavailabilityMessage;
296     }
297 
298     /**
299      * Get the workgroup key of the directory
300      * 
301      * @return the work group associate to the directory
302      */
303     @Override
304     public String getWorkgroup( )
305     {
306         return _strWorkgroupKey;
307     }
308 
309     /**
310      * set the work group associate to the directory
311      * 
312      * @param workGroup
313      *            the work group associate to the directory
314      */
315     public void setWorkgroup( String workGroup )
316     {
317         _strWorkgroupKey = workGroup;
318     }
319 
320     /**
321      *
322      * @return the id of the directory
323      */
324     public int getIdDirectory( )
325     {
326         return _nIdDirectory;
327     }
328 
329     /**
330      * set the id of the directory
331      * 
332      * @param idDirectory
333      *            the id of the directory
334      */
335     public void setIdDirectory( int idDirectory )
336     {
337         _nIdDirectory = idDirectory;
338     }
339 
340     /**
341      *
342      * @return true if the directory is enabled
343      */
344     public boolean isEnabled( )
345     {
346         return _bIsEnabled;
347     }
348 
349     /**
350      * set true if the directory is enabled
351      * 
352      * @param enable
353      *            true if the directory is enabled
354      */
355     public void setEnabled( boolean enable )
356     {
357         _bIsEnabled = enable;
358     }
359 
360     /**
361      *
362      * @return the creation date
363      */
364     public Timestamp getDateCreation( )
365     {
366         return _tDateCreation;
367     }
368 
369     /**
370      * set the creation date
371      * 
372      * @param dateCreation
373      *            the creation date
374      */
375     public void setDateCreation( Timestamp dateCreation )
376     {
377         _tDateCreation = dateCreation;
378     }
379 
380     /**
381      * RBAC resource implementation
382      * 
383      * @return The resource type code
384      */
385     @Override
386     public String getResourceTypeCode( )
387     {
388         return RESOURCE_TYPE;
389     }
390 
391     /**
392      * RBAC resource implementation
393      * 
394      * @return The resourceId
395      */
396     @Override
397     public String getResourceId( )
398     {
399         return "" + _nIdDirectory;
400     }
401 
402     /**
403      *
404      * @return a list of action can be use for the directory
405      */
406     public List<DirectoryAction> getActions( )
407     {
408         return _listActions;
409     }
410 
411     /**
412      * set a list of action can be use for the directory
413      * 
414      * @param directoryActions
415      *            a list of action must be use for the directory
416      */
417     public void setActions( List<DirectoryAction> directoryActions )
418     {
419         _listActions = directoryActions;
420     }
421 
422     /**
423      * Gets the directory role
424      * 
425      * @return directory's role as a String
426      *
427      */
428     public String getRoleKey( )
429     {
430         return _strRoleKey;
431     }
432 
433     /**
434      * Sets the directory's role
435      * 
436      * @param strRole
437      *            The role
438      *
439      */
440     public void setRoleKey( String strRole )
441     {
442         _strRoleKey = strRole;
443     }
444 
445     /**
446      * return the id of the result list template
447      * 
448      * @return the id of the result list template
449      */
450     public int getIdResultListTemplate( )
451     {
452         return _nIdResultListTemplate;
453     }
454 
455     /**
456      * set the id of the result list template
457      * 
458      * @param idResultListTemplate
459      *            the id of the result list template
460      */
461     public void setIdResultListTemplate( int idResultListTemplate )
462     {
463         _nIdResultListTemplate = idResultListTemplate;
464     }
465 
466     /**
467      * return the id of the record template
468      * 
469      * @return he id of the record template
470      */
471     public int getIdResultRecordTemplate( )
472     {
473         return _nIdResultRecordTemplate;
474     }
475 
476     /**
477      * set the id of the record template
478      * 
479      * @param idResultRecordTemplate
480      *            the id of the record template
481      */
482     public void setIdResultRecordTemplate( int idResultRecordTemplate )
483     {
484         _nIdResultRecordTemplate = idResultRecordTemplate;
485     }
486 
487     /**
488      * return the id of the form search template
489      * 
490      * @return the id of the form search template
491      */
492     public int getIdFormSearchTemplate( )
493     {
494         return _nIdFormSearchTemplate;
495     }
496 
497     /**
498      *
499      * @return the number of record display per page
500      */
501     public int getNumberRecordPerPage( )
502     {
503         return _nNumberRecordPerPage;
504     }
505 
506     /**
507      * the number of record display per page
508      * 
509      * @param numberRecordPerPage
510      *            the number of record display per page
511      */
512     public void setNumberRecordPerPage( int numberRecordPerPage )
513     {
514         _nNumberRecordPerPage = numberRecordPerPage;
515     }
516 
517     /**
518      * set the id of the form search template
519      * 
520      * @param idFormSearchTemplate
521      *            the id of the form search template
522      */
523     public void setIdFormSearchTemplate( int idFormSearchTemplate )
524     {
525         _nIdFormSearchTemplate = idFormSearchTemplate;
526     }
527 
528     /**
529      *
530      * @return the id of the directory workflow
531      */
532     public int getIdWorkflow( )
533     {
534         return _nIdWorkflow;
535     }
536 
537     /**
538      * set the id of the directory worflow
539      * 
540      * @param nIdWorkflow
541      *            the id of the directory worflow
542      */
543     public void setIdWorkflow( int nIdWorkflow )
544     {
545         _nIdWorkflow = nIdWorkflow;
546     }
547 
548     /**
549      * Get the id of the workflow state of records that must be permanently removed
550      * 
551      * @return The id of the workflow state of records that must be permanently removed
552      */
553     public int getIdWorkflowStateToRemove( )
554     {
555         return _nIdWorkflowStateToRemove;
556     }
557 
558     /**
559      * Set the id of the workflow state of records that must be permanently removed
560      * 
561      * @param nIdWorkflowStateToRemove
562      *            The id of the workflow state of records that must be permanently removed
563      */
564     public void setIdWorkflowStateToRemove( int nIdWorkflowStateToRemove )
565     {
566         this._nIdWorkflowStateToRemove = nIdWorkflowStateToRemove;
567     }
568 
569     /**
570      * Check if the creation date should be shown in the result list
571      * 
572      * @return True if the creation date should be shown in the result list, false otherwise
573      */
574     public boolean isDateShownInResultList( )
575     {
576         return _bDateShownInResultList;
577     }
578 
579     /**
580      * Set whether the creation date should be shown in the result list
581      * 
582      * @param bDateShownInResultList
583      *            True if the creation date should be shown in the result list, false otherwise
584      */
585     public void setDateShownInResultList( boolean bDateShownInResultList )
586     {
587         _bDateShownInResultList = bDateShownInResultList;
588     }
589 
590     /**
591      * Check if the creation date should be shown in the result record
592      * 
593      * @return True if the creation date should be shown in the result record, false otherwise
594      */
595     public boolean isDateShownInResultRecord( )
596     {
597         return _bDateShownInResultRecord;
598     }
599 
600     /**
601      * Set whether the creation date should be shown in the result record
602      * 
603      * @param bDateShownInResultRecord
604      *            True if the creation date should be shown in the result record, false otherwise
605      */
606     public void setDateShownInResultRecord( boolean bDateShownInResultRecord )
607     {
608         _bDateShownInResultRecord = bDateShownInResultRecord;
609     }
610 
611     /**
612      * Check if the creation date should be shown in history
613      * 
614      * @return True if the creation date should be shown in history, false otherwise
615      */
616     public boolean isDateShownInHistory( )
617     {
618         return _bDateShownInHistory;
619     }
620 
621     /**
622      * Set whether the creation date should be shown in the history
623      * 
624      * @param bDateShownInHistory
625      *            True if the creation date should be shown in the history, false otherwise
626      */
627     public void setDateShownInHistory( boolean bDateShownInHistory )
628     {
629         _bDateShownInHistory = bDateShownInHistory;
630     }
631 
632     /**
633      * Check if the creation date should be shown in search
634      * 
635      * @return True if the creation date should be shown in search, false otherwise
636      */
637     public boolean isDateShownInSearch( )
638     {
639         return _bDateShownInSearch;
640     }
641 
642     /**
643      * Set whether the creation date should be shown in the search
644      * 
645      * @param bDateShownInSearch
646      *            True if the creation date should be shown in the search, false otherwise
647      */
648     public void setDateShownInSearch( boolean bDateShownInSearch )
649     {
650         _bDateShownInSearch = bDateShownInSearch;
651     }
652 
653     /**
654      * Check if the creation date should be shown in advanced search
655      * 
656      * @return True if the creation date should be shown in advanced search, false otherwise
657      */
658     public boolean isDateShownInAdvancedSearch( )
659     {
660         return _bDateShownInAdvancedSearch;
661     }
662 
663     /**
664      * Set whether the creation date should be shown in the advanced search
665      * 
666      * @param bDateShownInAdvancedSearch
667      *            True if the creation date should be shown in the advanced search, false otherwise
668      */
669     public void setDateShownInAdvancedSearch( boolean bDateShownInAdvancedSearch )
670     {
671         _bDateShownInAdvancedSearch = bDateShownInAdvancedSearch;
672     }
673 
674     /**
675      * Check if the creation date should be shown in multi search
676      * 
677      * @return True if the creation date should be shown in multi search, false otherwise
678      */
679     public boolean isDateShownInMultiSearch( )
680     {
681         return _bDateShownInMultiSearch;
682     }
683 
684     /**
685      * Set whether the creation date should be shown in the multi search
686      * 
687      * @param bDateShownInMultiSearch
688      *            True if the creation date should be shown in the multi search, false otherwise
689      */
690     public void setDateShownInMultiSearch( boolean bDateShownInMultiSearch )
691     {
692         _bDateShownInMultiSearch = bDateShownInMultiSearch;
693     }
694 
695     /**
696      * Check if the creation date should be exported
697      * 
698      * @return True if the creation date should be exported, false otherwise
699      */
700     public boolean isDateShownInExport( )
701     {
702         return _bDateShownInExport;
703     }
704 
705     /**
706      * Set whether the creation date should be exported
707      * 
708      * @param bDateShownInExport
709      *            True if the creation date should be exported, false otherwise
710      */
711     public void setDateShownInExport( boolean bDateShownInExport )
712     {
713         _bDateShownInExport = bDateShownInExport;
714     }
715 
716     /**
717      * Check if the modification date should be shown in the result list
718      * 
719      * @return True if the modification date should be shown in the result list, false otherwise
720      */
721     public boolean isDateModificationShownInResultList( )
722     {
723         return _bDateModificationShownInResultList;
724     }
725 
726     /**
727      * Set whether the modification date should be shown in the result list
728      * 
729      * @param bDateModificationShownInResultList
730      *            True if the modification date should be shown in the result list, false otherwise
731      */
732     public void setDateModificationShownInResultList( boolean bDateModificationShownInResultList )
733     {
734         _bDateModificationShownInResultList = bDateModificationShownInResultList;
735     }
736 
737     /**
738      * Check if the modification date should be shown in the result record
739      * 
740      * @return True if the modification date should be shown in the result record, false otherwise
741      */
742     public boolean isDateModificationShownInResultRecord( )
743     {
744         return _bDateModificationShownInResultRecord;
745     }
746 
747     /**
748      * Set whether the modification date should be shown in the result record
749      * 
750      * @param bDateModificationShownInResultRecord
751      *            True if the modification date should be shown in the result record, false otherwise
752      */
753     public void setDateModificationShownInResultRecord( boolean bDateModificationShownInResultRecord )
754     {
755         _bDateModificationShownInResultRecord = bDateModificationShownInResultRecord;
756     }
757 
758     /**
759      * Check if the modification date should be shown in history
760      * 
761      * @return True if the modification date should be shown in history, false otherwise
762      */
763     public boolean isDateModificationShownInHistory( )
764     {
765         return _bDateModificationShownInHistory;
766     }
767 
768     /**
769      * Set whether the modification date should be shown in history
770      * 
771      * @param bDateModificationShownInHistory
772      *            True if the modification date should be shown in history, false otherwise
773      */
774     public void setDateModificationShownInHistory( boolean bDateModificationShownInHistory )
775     {
776         _bDateModificationShownInHistory = bDateModificationShownInHistory;
777     }
778 
779     /**
780      * Check if the modification date should be shown in search
781      * 
782      * @return True if the modification date should be shown in search, false otherwise
783      */
784     public boolean isDateModificationShownInSearch( )
785     {
786         return _bDateModificationShownInSearch;
787     }
788 
789     /**
790      * Set whether the modification date should be shown in search
791      * 
792      * @param bDateModificationShownInSearch
793      *            True if the modification date should be shown in search, false otherwise
794      */
795     public void setDateModificationShownInSearch( boolean bDateModificationShownInSearch )
796     {
797         _bDateModificationShownInSearch = bDateModificationShownInSearch;
798     }
799 
800     /**
801      * Check if the modification date should be shown in advanced search
802      * 
803      * @return True if the modification date should be shown in advanced search, false otherwise
804      */
805     public boolean isDateModificationShownInAdvancedSearch( )
806     {
807         return _bDateModificationShownInAdvancedSearch;
808     }
809 
810     /**
811      * Set whether the modification date should be shown in advanced search
812      * 
813      * @param bDateModificationShownInAdvancedSearch
814      *            True if the modification date should be shown in advanced search, false otherwise
815      */
816     public void setDateModificationShownInAdvancedSearch( boolean bDateModificationShownInAdvancedSearch )
817     {
818         _bDateModificationShownInAdvancedSearch = bDateModificationShownInAdvancedSearch;
819     }
820 
821     /**
822      * Check if the modification date should be shown in multi search
823      * 
824      * @return True if the modification date should be shown in multi search, false otherwise
825      */
826     public boolean isDateModificationShownInMultiSearch( )
827     {
828         return _bDateModificationShownInMultiSearch;
829     }
830 
831     /**
832      * Set whether the modification date should be shown in multi search
833      * 
834      * @param bDateModificationShownInMultiSearch
835      *            True if the modification date should be shown in multi search, false otherwise
836      */
837     public void setDateModificationShownInMultiSearch( boolean bDateModificationShownInMultiSearch )
838     {
839         _bDateModificationShownInMultiSearch = bDateModificationShownInMultiSearch;
840     }
841 
842     /**
843      * Check if the modification date should be exported
844      * 
845      * @return True if the modification date should be exported, false otherwise
846      */
847     public boolean isDateModificationShownInExport( )
848     {
849         return _bDateModificationShownInExport;
850     }
851 
852     /**
853      * Set whether the modification date should be exported
854      * 
855      * @param bDateModificationShownInExport
856      *            True if the modification date should be exported, false otherwise
857      */
858     public void setDateModificationShownInExport( boolean bDateModificationShownInExport )
859     {
860         _bDateModificationShownInExport = bDateModificationShownInExport;
861     }
862 
863     /**
864      * Check if the sort is ascendent
865      * 
866      * @return True if the sort is ascendent, false otherwise
867      */
868     public boolean isAscendingSort( )
869     {
870         return _bAscSort;
871     }
872 
873     /**
874      * Set whether the sort is ascendent
875      * 
876      * @param bAscendingSort
877      *            True if the sort is ascendent, false otherwise
878      */
879     public void setAscendingSort( boolean bAscendingSort )
880     {
881         _bAscSort = bAscendingSort;
882     }
883 
884     /**
885      * Get the id of the entry to sort
886      * 
887      * @return the id of the entry to sort
888      */
889     public String getIdSortEntry( )
890     {
891         return _strSortEntryId;
892     }
893 
894     /**
895      * Set the id of the entry to sort
896      * 
897      * @param strIdSortEntry
898      *            the id of the entry to sort
899      */
900     public void setIdSortEntry( String strIdSortEntry )
901     {
902         _strSortEntryId = strIdSortEntry;
903     }
904 
905     /**
906      * return true if the record must be sorted by ascending sort
907      * 
908      * @return true if the record must be sorted by ascending sort
909      */
910     public boolean isAscendingSortFront( )
911     {
912         return _bAscSortFront;
913     }
914 
915     /**
916      * set true if the record must be sorted by ascending sort in front office
917      * 
918      * @param bAscendingSort
919      *            return true if the record must be sorted by ascending sort
920      */
921     public void setAscendingSortFront( boolean bAscendingSort )
922     {
923         _bAscSortFront = bAscendingSort;
924     }
925 
926     /**
927      * return the id of the entry used for sorted
928      * 
929      * @return the id of the entry used for sorted
930      */
931     public String getIdSortEntryFront( )
932     {
933         return _strSortEntryIdFront;
934     }
935 
936     /**
937      * set the id of the entry used for sorted
938      * 
939      * @param strIdSortEntry
940      *            the id of the entry used for sorted
941      */
942     public void setIdSortEntryFront( String strIdSortEntry )
943     {
944         _strSortEntryIdFront = strIdSortEntry;
945     }
946 
947     /**
948      * Check whether record is activated
949      * 
950      * @return True if record is activated, false otherwise
951      */
952     public boolean isRecordActivated( )
953     {
954         return _bRecordActivated;
955     }
956 
957     /**
958      * Set record activated or deactivated
959      * 
960      * @param bRecordActivated
961      *            True if record is activated, false otherwise
962      */
963     public void setRecordActivated( boolean bRecordActivated )
964     {
965         _bRecordActivated = bRecordActivated;
966     }
967 
968     /**
969      * return the xml of the directory
970      * 
971      * @param plugin
972      *            the plugin
973      * @param locale
974      *            the locale
975      * @param strListRecord
976      *            the string list of record associate to the directory
977      * @param strListEntry
978      *            the string list of entry associate to the directory
979      * @return xml
980      */
981     public StringBuffer getXml( Plugin plugin, Locale locale, StringBuffer strListRecord, StringBuffer strListEntry )
982     {
983         StringBuffer strXml = new StringBuffer( );
984         HashMap<String, Object> model = new HashMap<String, Object>( );
985         model.put( ATTRIBUTE_ID, String.valueOf( getIdDirectory( ) ) );
986         XmlUtil.beginElement( strXml, TAG_DIRECTORY, model );
987         XmlUtil.addElementHtml( strXml, TAG_TITLE, DirectoryUtils.substituteSpecialCaractersForExport( getTitle( ) ) );
988         XmlUtil.addElement( strXml, TAG_CREATION_DATE, DateUtil.getDateString( getDateCreation( ), locale ) );
989         XmlUtil.beginElement( strXml, TAG_LIST_ENTRY );
990         strXml.append( strListEntry );
991         XmlUtil.endElement( strXml, TAG_LIST_ENTRY );
992         XmlUtil.beginElement( strXml, TAG_LIST_RECORD );
993         strXml.append( strListRecord );
994         XmlUtil.endElement( strXml, TAG_LIST_RECORD );
995         XmlUtil.endElement( strXml, TAG_DIRECTORY );
996 
997         return strXml;
998     }
999 
1000     /**
1001      * Set indexed
1002      * 
1003      * @param bIsIndexed
1004      *            true if the directory is indexed, false otherwise
1005      */
1006     public void setIndexed( boolean bIsIndexed )
1007     {
1008         _bIsIndexed = bIsIndexed;
1009     }
1010 
1011     /**
1012      * Check if the directory is indexed
1013      * 
1014      * @return true if the directory is indexed, false otherwise
1015      */
1016     public boolean isIndexed( )
1017     {
1018         return _bIsIndexed;
1019     }
1020 
1021     /**
1022      *
1023      * @return true if the search operator using is OR
1024      */
1025     public boolean isSearchOperatorOr( )
1026     {
1027         return _bSearchOperatorOr;
1028     }
1029 
1030     /**
1031      *
1032      * @param bSearchOperatorOr
1033      *            true if the search operator using is OR
1034      */
1035     public void setSearchOperatorOr( boolean bSearchOperatorOr )
1036     {
1037         _bSearchOperatorOr = bSearchOperatorOr;
1038     }
1039 }