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.service.directorysearch.DirectorySearchItem;
37  import fr.paris.lutece.plugins.directory.utils.DirectoryErrorException;
38  import fr.paris.lutece.plugins.directory.utils.DirectoryUtils;
39  import fr.paris.lutece.portal.service.plugin.Plugin;
40  import fr.paris.lutece.portal.service.template.AppTemplateService;
41  import fr.paris.lutece.portal.web.util.LocalizedPaginator;
42  import fr.paris.lutece.util.ReferenceList;
43  import fr.paris.lutece.util.html.HtmlTemplate;
44  import fr.paris.lutece.util.html.Paginator;
45  import fr.paris.lutece.util.xml.XmlUtil;
46  
47  import org.apache.commons.fileupload.FileItem;
48  
49  import java.util.ArrayList;
50  import java.util.Collections;
51  import java.util.HashMap;
52  import java.util.List;
53  import java.util.Locale;
54  import java.util.Map;
55  
56  import javax.servlet.http.HttpServletRequest;
57  
58  /**
59   *
60   * class Entry
61   *
62   */
63  public class Entry implements IEntry
64  {
65      public static final String TAG_ENTRY = "entry";
66      public static final String ATTRIBUTE_ENTRY_ID = "id";
67      public static final String TAG_TITLE = "title";
68      public static final String ATTRIBUTE_TITLE = "title";
69      public static final String ATTRIBUTE_ENTRY_ID_TYPE = "id-type";
70      public static final String TAG_LIST_ENTRY = "list-entry";
71      public static final String ATTRIBUTE_SHOWXY = "showxy";
72      public static final String ATTRIBUTE_IS_SORTABLE = "is-sortable";
73  
74      // parameters Entry
75      protected static final String PARAMETER_TITLE = "title";
76      protected static final String PARAMETER_HELP_MESSAGE = "help_message";
77      protected static final String PARAMETER_HELP_MESSAGE_SEARCH = "help_message_search";
78      protected static final String PARAMETER_COMMENT = "comment";
79      protected static final String PARAMETER_MANDATORY = "mandatory";
80      protected static final String PARAMETER_INDEXED = "indexed";
81      protected static final String PARAMETER_INDEXED_AS_TITLE = "indexed_as_title";
82      protected static final String PARAMETER_INDEXED_AS_SUMMARY = "indexed_as_summary";
83      protected static final String PARAMETER_MULTIPLE_SEARCH_FIELDS = "multiple_search_fields";
84      protected static final String PARAMETER_SHOWN_IN_ADVANCED_SEARCH = "shown_in_advanced_search";
85      protected static final String PARAMETER_SHOWN_IN_RESULT_LIST = "shown_in_result_list";
86      protected static final String PARAMETER_SHOWN_IN_RESULT_RECORD = "shown_in_result_record";
87      protected static final String PARAMETER_SHOWN_IN_HISTORY = "shown_in_history";
88      protected static final String PARAMETER_AUTOCOMPLETE = "autocomplete_entry";
89      protected static final String PARAMETER_FIELD_IN_LINE = "field_in_line";
90      protected static final String PARAMETER_HEIGHT = "height";
91      protected static final String PARAMETER_WIDTH = "width";
92      protected static final String PARAMETER_DISPLAY_HEIGHT = "display_height";
93      protected static final String PARAMETER_DISPLAY_WIDTH = "display_width";
94      protected static final String PARAMETER_VALUE = "value";
95      protected static final String PARAMETER_MAX_SIZE_ENTER = "max_size_enter";
96      protected static final String PARAMETER_ID_DIRECTORY_RECORD = "id_directory_record";
97      protected static final String PARAMETER_UPDATE_ENTRY = "update_entry";
98      protected static final String PARAMETER_WORKGROUP_ASSOCIATED = "workgroup_associated";
99      protected static final String PARAMETER_ROLE_ASSOCIATED = "role_associated";
100     protected static final String PARAMETER_SEARCH_ACTION = "search_action";
101     protected static final String PARAMETER_DATE_BEGIN = "date_begin";
102     protected static final String PARAMETER_DATE_END = "date_end";
103     protected static final String PARAMETER_DIRECTORY_ASSOCIATE = "id_directory_associate";
104     protected static final String PARAMETER_ENTRY_ASSOCIATE = "id_entry_associate";
105     protected static final String PARAMETER_REQUEST_SQL = "request_sql";
106     protected static final String PARAMETER_IS_ADD_VALUE_SEARCH_ALL = "is_all_search";
107     protected static final String PARAMETER_LABEL_VALUE_SEARCH_ALL = "label_all_search";
108     protected static final String PARAMETER_SHOWN_IN_EXPORT = "shown_in_export";
109     protected static final String PARAMETER_SHOWN_IN_COMPLETENESS = "shown_in_completeness";
110     protected static final String PARAMETER_SHOW_ALL_INFO = "show_all_info";
111     protected static final String PARAMETER_NUMBER_ROWS = "num_row";
112     protected static final String PARAMETER_NUMBER_COLUMNS = "num_column";
113 
114     // message
115     protected static final String MESSAGE_MANDATORY_FIELD = "directory.message.mandatory.field";
116     protected static final String MESSAGE_NUMERIC_FIELD = "directory.message.numeric.field";
117     protected static final String MESSAGE_BLOBSTORE_CLIENT_SERVICE_UNAVAILABLE = "directory.message.blobStoreClientService.unavailable";
118     protected static final String FIELD_TITLE = "directory.create_entry.label_title";
119     protected static final String FIELD_INSERT_GROUP = "directory.modify_directory.manage_entry.label_insert_group";
120     protected static final String FIELD_HELP_MESSAGE = "directory.create_entry.label_help_message";
121     protected static final String FIELD_HELP_MESSAGE_SEARCH = "directory.create_entry.label_help_message_search";
122     protected static final String FIELD_COMMENT = "directory.create_entry.label_comment";
123     protected static final String FIELD_VALUE = "directory.create_entry.label_value";
124     protected static final String FIELD_PRESENTATION = "directory.create_entry.label_presentation";
125     protected static final String FIELD_MANDATORY = "directory.create_entry.label_mandatory";
126     protected static final String FIELD_WIDTH = "directory.create_entry.label_width";
127     protected static final String FIELD_HEIGHT = "directory.create_entry.label_height";
128     protected static final String FIELD_WIDTH_DISPLAY = "directory.create_entry.label_width_display";
129     protected static final String FIELD_HEIGHT_DISPLAY = "directory.create_entry.label_height_display";
130     protected static final String FIELD_MAX_SIZE_ENTER = "directory.create_entry.label_max_size_enter";
131     protected static final String FIELD_ENTRY_ASSOCIATE = "directory.create_entry.label_entry";
132     protected static final String FIELD_REQUEST_SQL = "directory.create_entry.label_request_sql";
133     protected static final String FIELD_LABEL_ALL_SEARCH = "directory.create_entry.label_label_all_search";
134     protected static final String FIELD_NUMBER_ROWS = "directory.create_entry.labelNumberRows";
135     protected static final String FIELD_NUMBER_COLUMNS = "directory.create_entry.labelNumberColumns";
136 
137     // Jsp Definition
138     protected static final String JSP_DOWNLOAD_FILE = "jsp/site/plugins/directory/DoDownloadFile.jsp";
139 
140     // MARK
141     protected static final String MARK_ENTRY = "entry";
142     protected static final String MARK_LOCALE = "locale";
143     protected static final String MARK_RECORD_FIELD = "record_field";
144     protected static final String MARK_DEFAULT_VALUES = "default_values";
145     protected static final String MARK_SHOW_ALL_INFO = "show_all_info";
146     protected static final String MARK_MYLUTECE_USER_INFOS_LIST = "mylutece_user_infos_list";
147     protected static final String MARK_MYLUTECE_USER_LOGIN = "mylutece_user_login";
148 
149     // PROPERTIES
150     protected static final String PROPERTY_IMPORT_MULTIPLE_VALUE_DELIMITER = "directory.import.multiple_value.delimiter";
151 
152     // SQL
153     private static final String SQL_JOIN_DIRECTORY_RECORD_FIELD = " LEFT JOIN directory_record_field drf ON drf.id_record = dr.id_record AND drf.id_entry = ? ";
154     private static final String SQL_ORDER_BY_RECORD_FIELD_VALUE = " ORDER BY drf.record_field_value ";
155     private int _nIdEntry;
156     private Directory _directory;
157     private String _strTitle;
158     private String _strHelpMessage;
159     private String _strHelpMessageSearch;
160     private String _strComment;
161     private int _nDisplayHeight;
162     private int _nDisplayWidth;
163     private boolean _bMandatory;
164     private boolean _bFieldInLine;
165     private boolean _bShownInAdvancedSearch;
166     private boolean _bShownInResultList;
167     private boolean _bShownInResultRecord;
168     private boolean _bShownInHistory;
169     private boolean _bShownInExport;
170     private boolean _bShownInCompleteness;
171     private boolean _bWorkgroupAssociated;
172     private boolean _bRoleAssociated;
173     private boolean _bIndexed;
174     private boolean _bIndexedAsTitle;
175     private boolean _bIndexedAsSummary;
176     private int _nPosition;
177     private boolean _bMultipleSearchFields;
178     private EntryType _entryType;
179     private List<Field> _listFields;
180     private boolean _nFirstInTheList;
181     private boolean _nLastInTheList;
182     private IEntry _entryParent;
183     private List<IEntry> _listEntryChildren;
184     private int _nIdEntryAssociate; // For entry type directory
185     private String _strRequestSQL; // For entry type SQL
186     private boolean _bAddValueAllSearch; // For entries type directory and select
187     private String _strLabelValueAllSearch; // For entries type directory and select
188     private IMapProvider _mapProvider; // For entries type Geolocation
189     private boolean _bIsAutocompleEntry; // For autocomplete entries
190     private boolean _bAnonymize;
191     private int _nNumberRow;
192     private int _nNumberColumn;
193 
194     /**
195      * {@inheritDoc}
196      */
197     @Override
198     public int getIdEntry( )
199     {
200         return _nIdEntry;
201     }
202 
203     /**
204      * {@inheritDoc}
205      */
206     @Override
207     public void setIdEntry( int idEntry )
208     {
209         _nIdEntry = idEntry;
210     }
211 
212     /**
213      * {@inheritDoc}
214      */
215     @Override
216     public Directory getDirectory( )
217     {
218         return _directory;
219     }
220 
221     /**
222      * {@inheritDoc}
223      */
224     @Override
225     public void setDirectory( Directory directory )
226     {
227         this._directory = directory;
228     }
229 
230     /**
231      * {@inheritDoc}
232      */
233     @Override
234     public String getTitle( )
235     {
236         return _strTitle;
237     }
238 
239     /**
240      * {@inheritDoc}
241      */
242     @Override
243     public void setTitle( String title )
244     {
245         _strTitle = title;
246     }
247 
248     /**
249      * {@inheritDoc}
250      */
251     @Override
252     public String getHelpMessage( )
253     {
254         return _strHelpMessage;
255     }
256 
257     /**
258      * {@inheritDoc}
259      */
260     @Override
261     public void setHelpMessage( String helpMessage )
262     {
263         _strHelpMessage = helpMessage;
264     }
265 
266     /**
267      * {@inheritDoc}
268      */
269     @Override
270     public String getHelpMessageSearch( )
271     {
272         return _strHelpMessageSearch;
273     }
274 
275     /**
276      * {@inheritDoc}
277      */
278     @Override
279     public void setHelpMessageSearch( String helpMessage )
280     {
281         _strHelpMessageSearch = helpMessage;
282     }
283 
284     /**
285      * {@inheritDoc}
286      */
287     @Override
288     public String getComment( )
289     {
290         return _strComment;
291     }
292 
293     /**
294      * {@inheritDoc}
295      */
296     @Override
297     public void setComment( String comment )
298     {
299         _strComment = comment;
300     }
301 
302     /**
303      * {@inheritDoc}
304      */
305     @Override
306     public boolean isMandatory( )
307     {
308         return _bMandatory;
309     }
310 
311     /**
312      * {@inheritDoc}
313      */
314     @Override
315     public void setMandatory( boolean mandatory )
316     {
317         _bMandatory = mandatory;
318     }
319 
320     /**
321      * {@inheritDoc}
322      */
323     @Override
324     public boolean isFieldInLine( )
325     {
326         return _bFieldInLine;
327     }
328 
329     /**
330      * {@inheritDoc}
331      */
332     @Override
333     public void setFieldInLine( boolean fieldInLine )
334     {
335         _bFieldInLine = fieldInLine;
336     }
337 
338     /**
339      * {@inheritDoc}
340      */
341     @Override
342     public boolean isShownInAdvancedSearch( )
343     {
344         return _bShownInAdvancedSearch;
345     }
346 
347     /**
348      * {@inheritDoc}
349      */
350     @Override
351     public void setShownInAdvancedSearch( boolean shown )
352     {
353         _bShownInAdvancedSearch = shown;
354     }
355 
356     /**
357      * {@inheritDoc}
358      */
359     @Override
360     public boolean isShownInResultList( )
361     {
362         return _bShownInResultList;
363     }
364 
365     /**
366      * {@inheritDoc}
367      */
368     @Override
369     public void setShownInResultList( boolean shown )
370     {
371         _bShownInResultList = shown;
372     }
373 
374     /**
375      * {@inheritDoc}
376      */
377     @Override
378     public boolean isShownInResultRecord( )
379     {
380         return _bShownInResultRecord;
381     }
382 
383     /**
384      * {@inheritDoc}
385      */
386     @Override
387     public void setShownInResultRecord( boolean shown )
388     {
389         _bShownInResultRecord = shown;
390     }
391 
392     /**
393      * {@inheritDoc}
394      */
395     @Override
396     public boolean isShownInHistory( )
397     {
398         return _bShownInHistory;
399     }
400 
401     /**
402      * {@inheritDoc}
403      */
404     @Override
405     public void setShownInHistory( boolean shown )
406     {
407         _bShownInHistory = shown;
408     }
409 
410     /**
411      * {@inheritDoc}
412      */
413     @Override
414     public boolean isShownInExport( )
415     {
416         return _bShownInExport;
417     }
418 
419     /**
420      * {@inheritDoc}
421      */
422     @Override
423     public void setShownInExport( boolean shown )
424     {
425         _bShownInExport = shown;
426     }
427 
428     /**
429      * {@inheritDoc}
430      */
431     @Override
432     public boolean isShownInCompleteness( )
433     {
434         return _bShownInCompleteness;
435     }
436 
437     /**
438      * {@inheritDoc}
439      */
440     @Override
441     public void setShownInCompleteness( boolean shown )
442     {
443         _bShownInCompleteness = shown;
444     }
445 
446     /**
447      * {@inheritDoc}
448      */
449     @Override
450     public boolean isIndexed( )
451     {
452         return _bIndexed;
453     }
454 
455     /**
456      * {@inheritDoc}
457      */
458     @Override
459     public void setIndexed( boolean indexed )
460     {
461         _bIndexed = indexed;
462     }
463 
464     /**
465      * {@inheritDoc}
466      */
467     @Override
468     public int getPosition( )
469     {
470         return _nPosition;
471     }
472 
473     /**
474      * {@inheritDoc}
475      */
476     @Override
477     public void setPosition( int position )
478     {
479         _nPosition = position;
480     }
481 
482     /**
483      * {@inheritDoc}
484      */
485     @Override
486     public EntryType getEntryType( )
487     {
488         return _entryType;
489     }
490 
491     /**
492      * {@inheritDoc}
493      */
494     @Override
495     public void setEntryType( EntryType entryType )
496     {
497         _entryType = entryType;
498     }
499 
500     /**
501      * {@inheritDoc}
502      */
503     @Override
504     public List<Field> getFields( )
505     {
506         return _listFields;
507     }
508 
509     /**
510      * {@inheritDoc}
511      */
512     @Override
513     public void setFields( List<Field> fields )
514     {
515         _listFields = fields;
516     }
517 
518     /**
519      * {@inheritDoc}
520      */
521     @Override
522     public IEntry getParent( )
523     {
524         return _entryParent;
525     }
526 
527     /**
528      * {@inheritDoc}
529      */
530     @Override
531     public void setParent( IEntry parent )
532     {
533         _entryParent = parent;
534     }
535 
536     /**
537      * {@inheritDoc}
538      */
539     @Override
540     public List<IEntry> getChildren( )
541     {
542         return _listEntryChildren;
543     }
544 
545     /**
546      * {@inheritDoc}
547      */
548     @Override
549     public void setChildren( List<IEntry> children )
550     {
551         _listEntryChildren = children;
552     }
553 
554     /**
555      * {@inheritDoc}
556      */
557     @Override
558     public boolean isLastInTheList( )
559     {
560         return _nLastInTheList;
561     }
562 
563     /**
564      * {@inheritDoc}
565      */
566     @Override
567     public void setLastInTheList( boolean lastInTheList )
568     {
569         _nLastInTheList = lastInTheList;
570     }
571 
572     /**
573      * {@inheritDoc}
574      */
575     @Override
576     public boolean isFirstInTheList( )
577     {
578         return _nFirstInTheList;
579     }
580 
581     /**
582      * {@inheritDoc}
583      */
584     @Override
585     public void setFirstInTheList( boolean firstInTheList )
586     {
587         _nFirstInTheList = firstInTheList;
588     }
589 
590     /**
591      * {@inheritDoc}
592      */
593     @Override
594     public int getDisplayWidth( )
595     {
596         return _nDisplayWidth;
597     }
598 
599     /**
600      * {@inheritDoc}
601      */
602     @Override
603     public void setDisplayWidth( int width )
604     {
605         _nDisplayWidth = width;
606     }
607 
608     /**
609      * {@inheritDoc}
610      */
611     @Override
612     public int getDisplayHeight( )
613     {
614         return _nDisplayHeight;
615     }
616 
617     /**
618      * {@inheritDoc}
619      */
620     @Override
621     public void setDisplayHeight( int height )
622     {
623         _nDisplayHeight = height;
624     }
625 
626     /**
627      * {@inheritDoc}
628      */
629     @Override
630     public boolean isRoleAssociated( )
631     {
632         return _bRoleAssociated;
633     }
634 
635     /**
636      * {@inheritDoc}
637      */
638     @Override
639     public void setRoleAssociated( boolean bRoleAssociated )
640     {
641         _bRoleAssociated = bRoleAssociated;
642     }
643 
644     /**
645      * {@inheritDoc}
646      */
647     @Override
648     public boolean isWorkgroupAssociated( )
649     {
650         return _bWorkgroupAssociated;
651     }
652 
653     /**
654      * {@inheritDoc}
655      */
656     @Override
657     public void setWorkgroupAssociated( boolean bWorkGroupAssociated )
658     {
659         _bWorkgroupAssociated = bWorkGroupAssociated;
660     }
661 
662     /**
663      * {@inheritDoc}
664      */
665     @Override
666     public boolean isMultipleSearchFields( )
667     {
668         return _bMultipleSearchFields;
669     }
670 
671     /**
672      * {@inheritDoc}
673      */
674     @Override
675     public void setMultipleSearchFields( boolean multipleSearchFields )
676     {
677         _bMultipleSearchFields = multipleSearchFields;
678     }
679 
680     /**
681      * {@inheritDoc}
682      */
683     @Override
684     public int getEntryAssociate( )
685     {
686         return _nIdEntryAssociate;
687     }
688 
689     /**
690      * {@inheritDoc}
691      */
692     @Override
693     public void setEntryAssociate( int idEntryAssociate )
694     {
695         _nIdEntryAssociate = idEntryAssociate;
696     }
697 
698     /**
699      * {@inheritDoc}
700      */
701     @Override
702     public String getRequestSQL( )
703     {
704         return _strRequestSQL;
705     }
706 
707     /**
708      * {@inheritDoc}
709      */
710     @Override
711     public void setRequestSQL( String strRequestSQL )
712     {
713         _strRequestSQL = strRequestSQL;
714     }
715 
716     /**
717      * {@inheritDoc}
718      */
719     @Override
720     public boolean isAddValueAllSearch( )
721     {
722         return _bAddValueAllSearch;
723     }
724 
725     /**
726      * {@inheritDoc}
727      */
728     @Override
729     public void setAddValueAllSearch( boolean bAddValueAllSearch )
730     {
731         _bAddValueAllSearch = bAddValueAllSearch;
732     }
733 
734     /**
735      * {@inheritDoc}
736      */
737     @Override
738     public boolean isAutocompleteEntry( )
739     {
740         return _bIsAutocompleEntry;
741     }
742 
743     /**
744      * {@inheritDoc}
745      */
746     @Override
747     public void setAutocompleteEntry( boolean bIsAutocompleEntry )
748     {
749         _bIsAutocompleEntry = bIsAutocompleEntry;
750     }
751 
752     /**
753      * {@inheritDoc}
754      */
755     @Override
756     public String getLabelValueAllSearch( )
757     {
758         return _strLabelValueAllSearch;
759     }
760 
761     /**
762      * {@inheritDoc}
763      */
764     @Override
765     public void setLabelValueAllSearch( String strLabelValueAllSearch )
766     {
767         _strLabelValueAllSearch = strLabelValueAllSearch;
768     }
769 
770     /**
771      * Get the url of the template wich contains the Html code used in entry form
772      * 
773      * @param isDisplayFront
774      *            true if display for front office or false if display for back office
775      * @return the template url
776      *
777      *
778      */
779     public String getTemplateHtmlFormEntry( boolean isDisplayFront )
780     {
781         return null;
782     }
783 
784     /**
785      * Get the url of the template wich contains the Html code used in search form
786      * 
787      * @param isDisplayFront
788      *            true if display for front office or false if display for back office
789      * @return the template url
790      *
791      * */
792     public String getTemplateHtmlFormSearchEntry( boolean isDisplayFront )
793     {
794         return null;
795     }
796 
797     /**
798      * Get the url of the template wich contains the Html code used in display records
799      * 
800      * @param isDisplayFront
801      *            true if display for front office or false if display for back office
802      * @return the template url
803      *
804      * */
805     public String getTemplateHtmlRecordFieldValue( boolean isDisplayFront )
806     {
807         return null;
808     }
809 
810     /**
811      * {@inheritDoc}
812      */
813     @Override
814     public String getEntryData( HttpServletRequest request, Locale locale )
815     {
816         return null;
817     }
818 
819     /**
820      * {@inheritDoc}
821      */
822     @Override
823     public void getRecordFieldData( Record record, HttpServletRequest request, boolean bTestDirectoryError, boolean bAddNewValue,
824             List<RecordField> listRecordField, Locale locale ) throws DirectoryErrorException
825     {
826         List<String> lstValue = new ArrayList<String>( );
827         String strValueEntry = ( request.getParameter( DirectoryUtils.EMPTY_STRING + this.getIdEntry( ) ) != null ) ? request.getParameter(
828                 DirectoryUtils.EMPTY_STRING + this.getIdEntry( ) ).trim( ) : null;
829         lstValue.add( strValueEntry );
830         getRecordFieldData( record, lstValue, bTestDirectoryError, bAddNewValue, listRecordField, locale );
831     }
832 
833     /**
834      * {@inheritDoc}
835      */
836     @Override
837     public void getImportRecordFieldData( Record record, String strImportValue, boolean bTestDirectoryError, List<RecordField> listRecordField, Locale locale )
838             throws DirectoryErrorException
839     {
840         List<String> lstValue = new ArrayList<String>( );
841         lstValue.add( strImportValue );
842         getRecordFieldData( record, lstValue, bTestDirectoryError, false, listRecordField, locale );
843     }
844 
845     /**
846      * {@inheritDoc}
847      */
848     @Override
849     public void getRecordFieldData( Record record, List<String> lstValue, boolean bTestDirectoryError, boolean bAddNewValue, List<RecordField> listRecordField,
850             Locale locale ) throws DirectoryErrorException
851     {
852         // Not implemented
853     }
854 
855     /**
856      * {@inheritDoc}
857      */
858     @Override
859     public String getTemplateCreate( )
860     {
861         return null;
862     }
863 
864     /**
865      * {@inheritDoc}
866      */
867     @Override
868     public String getTemplateModify( )
869     {
870         return null;
871     }
872 
873     /**
874      * {@inheritDoc}
875      */
876     @Override
877     public Paginator getPaginator( int nItemPerPage, String strBaseUrl, String strPageIndexParameterName, String strPageIndex )
878     {
879         return null;
880     }
881 
882     /**
883      * {@inheritDoc}
884      */
885     @Override
886     public ReferenceList getReferenceListRegularExpression( IEntry entry, Plugin plugin )
887     {
888         return null;
889     }
890 
891     /**
892      * {@inheritDoc}
893      */
894     @Override
895     public String getHtmlFormEntry( Locale locale, boolean isDisplayFront )
896     {
897         if ( getTemplateHtmlFormEntry( isDisplayFront ) != null )
898         {
899             Map<String, Object> model = new HashMap<String, Object>( );
900             model.put( MARK_ENTRY, this );
901             model.put( MARK_LOCALE, locale );
902 
903             HtmlTemplate template = AppTemplateService.getTemplate( getTemplateHtmlFormEntry( isDisplayFront ), locale, model );
904 
905             return template.getHtml( );
906         }
907 
908         return null;
909     }
910 
911     /**
912      * {@inheritDoc}
913      */
914     @Override
915     public String getHtmlFormEntry( Locale locale, List<RecordField> defaultValues, boolean isDisplayFront )
916     {
917         if ( getTemplateHtmlFormEntry( isDisplayFront ) != null )
918         {
919             Map<String, Object> model = new HashMap<String, Object>( );
920             model.put( MARK_ENTRY, this );
921             model.put( MARK_LOCALE, locale );
922             model.put( MARK_DEFAULT_VALUES, defaultValues );
923 
924             HtmlTemplate template = AppTemplateService.getTemplate( getTemplateHtmlFormEntry( isDisplayFront ), locale, model );
925 
926             return template.getHtml( );
927         }
928 
929         return null;
930     }
931 
932     // popup display for task help filling
933     /**
934      * {@inheritDoc}
935      */
936     @Override
937     public String getHtmlFormEntryPopup( Locale locale, List<RecordField> defaultValues, boolean isDisplayFront )
938     {
939         if ( getTemplateHtmlFormEntry( isDisplayFront ) != null )
940         {
941             Map<String, Object> model = new HashMap<String, Object>( );
942             model.put( MARK_ENTRY, this );
943             model.put( MARK_LOCALE, locale );
944             if ( !defaultValues.isEmpty( ) )
945             {
946                 model.put( MARK_DEFAULT_VALUES, defaultValues );
947             }
948             String res = this.getTitle( ) + " : ";
949             for ( RecordField list : defaultValues )
950             {
951                 String value = list.getEntry( ).convertRecordFieldTitleToString( list, locale, false );
952                 if ( !"".equals( value ) )
953                 {
954                     res += value;
955                 }
956                 else
957                 {
958                     res = "";
959                 }
960             }
961 
962             return res;
963         }
964 
965         return null;
966     }
967 
968     /**
969      * {@inheritDoc}
970      */
971     @Override
972     public String getHtmlListEntry( Locale locale, List<RecordField> defaultValues, boolean isDisplayFront )
973     {
974         if ( getTemplateHtmlFormEntry( isDisplayFront ) != null )
975         {
976             Map<String, Object> model = new HashMap<String, Object>( );
977             model.put( MARK_ENTRY, this );
978             model.put( MARK_LOCALE, locale );
979             if ( !defaultValues.isEmpty( ) )
980             {
981                 model.put( MARK_DEFAULT_VALUES, defaultValues );
982             }
983 
984             return this.getTitle( );
985         }
986 
987         return null;
988     }
989 
990     /**
991      * {@inheritDoc}
992      */
993     @Override
994     public String getHtmlFormSearchEntry( Locale locale, boolean isDisplayFront )
995     {
996         if ( getTemplateHtmlFormSearchEntry( isDisplayFront ) != null )
997         {
998             Map<String, Object> model = new HashMap<String, Object>( );
999             model.put( MARK_ENTRY, this );
1000             model.put( MARK_LOCALE, locale );
1001 
1002             HtmlTemplate template = AppTemplateService.getTemplate( getTemplateHtmlFormSearchEntry( isDisplayFront ), locale, model );
1003 
1004             return template.getHtml( );
1005         }
1006 
1007         return null;
1008     }
1009 
1010     /**
1011      * {@inheritDoc}
1012      */
1013     @Override
1014     public String getHtmlFormSearchEntry( Locale locale, List<RecordField> defaultValues, boolean isDisplayFront )
1015     {
1016         if ( getTemplateHtmlFormSearchEntry( isDisplayFront ) != null )
1017         {
1018             Map<String, Object> model = new HashMap<String, Object>( );
1019             model.put( MARK_ENTRY, this );
1020             model.put( MARK_LOCALE, locale );
1021             model.put( MARK_DEFAULT_VALUES, defaultValues );
1022 
1023             HtmlTemplate template = AppTemplateService.getTemplate( getTemplateHtmlFormSearchEntry( isDisplayFront ), locale, model );
1024 
1025             return template.getHtml( );
1026         }
1027 
1028         return null;
1029     }
1030 
1031     /**
1032      * {@inheritDoc}
1033      */
1034     @Override
1035     public String getHtmlRecordFieldValue( Locale locale, RecordField recordField, boolean isDisplayFront )
1036     {
1037         if ( getTemplateHtmlRecordFieldValue( isDisplayFront ) != null )
1038         {
1039             Map<String, Object> model = new HashMap<String, Object>( );
1040             model.put( MARK_ENTRY, this );
1041             model.put( MARK_RECORD_FIELD, recordField );
1042             model.put( MARK_LOCALE, locale );
1043 
1044             HtmlTemplate template = AppTemplateService.getTemplate( getTemplateHtmlRecordFieldValue( isDisplayFront ), locale, model );
1045 
1046             return template.getHtml( );
1047         }
1048 
1049         return null;
1050     }
1051 
1052     /**
1053      * {@inheritDoc}
1054      */
1055     @Override
1056     public String convertRecordFieldValueToString( RecordField recordField, Locale locale, boolean bDisplayFront, boolean bExportDirectory )
1057     {
1058         if ( recordField.getValue( ) != null )
1059         {
1060             if ( recordField.getField( ) != null )
1061             {
1062                 if ( ( recordField.getField( ).getValue( ) != null ) && !recordField.getField( ).getValue( ).equals( DirectoryUtils.EMPTY_STRING ) )
1063                 {
1064                     return recordField.getField( ).getValue( );
1065                 }
1066 
1067                 return recordField.getValue( );
1068             }
1069 
1070             return recordField.getValue( );
1071         }
1072 
1073         return DirectoryUtils.EMPTY_STRING;
1074     }
1075 
1076     /**
1077      * {@inheritDoc}
1078      */
1079     @Override
1080     public String convertRecordFieldTitleToString( RecordField recordField, Locale locale, boolean bDisplayFront )
1081     {
1082         if ( recordField.getValue( ) != null )
1083         {
1084             if ( recordField.getField( ) != null )
1085             {
1086                 if ( ( recordField.getField( ).getTitle( ) != null ) && !recordField.getField( ).getTitle( ).equals( DirectoryUtils.EMPTY_STRING ) )
1087                 {
1088                     return recordField.getField( ).getTitle( );
1089                 }
1090 
1091                 return recordField.getValue( );
1092             }
1093 
1094             return recordField.getValue( );
1095         }
1096 
1097         return DirectoryUtils.EMPTY_STRING;
1098     }
1099 
1100     /**
1101      * {@inheritDoc}
1102      */
1103     @Override
1104     public void addSearchCriteria( HashMap<String, Object> mapSearchItem, RecordField recordField )
1105     {
1106         String strValue;
1107 
1108         if ( recordField.getValue( ) != null )
1109         {
1110             strValue = new String( recordField.getValue( ) );
1111 
1112             if ( !strValue.trim( ).equals( DirectoryUtils.EMPTY_STRING ) )
1113             {
1114                 mapSearchItem.put( DirectorySearchItem.FIELD_CONTENTS, strValue );
1115             }
1116         }
1117     }
1118 
1119     /**
1120      * {@inheritDoc}
1121      */
1122     @Override
1123     public void getXml( Plugin plugin, Locale locale, StringBuffer strXml )
1124     {
1125         if ( !this.getEntryType( ).getComment( ) )
1126         {
1127             Map<String, String> model = new HashMap<String, String>( );
1128             model.put( ATTRIBUTE_ENTRY_ID, String.valueOf( this.getIdEntry( ) ) );
1129             model.put( ATTRIBUTE_ENTRY_ID_TYPE, String.valueOf( this.getEntryType( ).getIdType( ) ) );
1130             model.put( Entry.ATTRIBUTE_IS_SORTABLE, Boolean.toString( this.isSortable( ) ) );
1131 
1132             XmlUtil.beginElement( strXml, TAG_ENTRY, model );
1133             XmlUtil.addElementHtml( strXml, TAG_TITLE, DirectoryUtils.substituteSpecialCaractersForExport( this.getTitle( ) ) );
1134 
1135             if ( this.getEntryType( ).getGroup( ) && ( this.getChildren( ) != null ) )
1136             {
1137                 XmlUtil.beginElement( strXml, TAG_LIST_ENTRY, model );
1138 
1139                 for ( IEntry entry : this.getChildren( ) )
1140                 {
1141                     entry.getXml( plugin, locale, strXml );
1142                 }
1143 
1144                 XmlUtil.endElement( strXml, TAG_LIST_ENTRY );
1145             }
1146 
1147             XmlUtil.endElement( strXml, TAG_ENTRY );
1148         }
1149     }
1150 
1151     /**
1152      * {@inheritDoc}
1153      */
1154     @Override
1155     public void getImportRecordFieldData( Record record, byte [ ] decodedBytes, String nomFile, boolean b, List<RecordField> listRecordField, Locale locale )
1156             throws DirectoryErrorException
1157     {
1158         // TODO Auto-generated method stub
1159     }
1160 
1161     /**
1162      * {@inheritDoc}
1163      */
1164     @Override
1165     public void setMapProvider( IMapProvider mapProvider )
1166     {
1167         _mapProvider = mapProvider;
1168     }
1169 
1170     /**
1171      * {@inheritDoc}
1172      */
1173     @Override
1174     public IMapProvider getMapProvider( )
1175     {
1176         return _mapProvider;
1177     }
1178 
1179     /**
1180      * {@inheritDoc}
1181      */
1182     @Override
1183     public boolean isSortable( )
1184     {
1185         return false;
1186     }
1187 
1188     /**
1189      * {@inheritDoc}
1190      */
1191     @Override
1192     public LocalizedPaginator getPaginator( int nItemPerPage, String strBaseUrl, String strPageIndexParameterName, String strPageIndex, Locale locale )
1193     {
1194         return null;
1195     }
1196 
1197     /**
1198      * {@inheritDoc}
1199      */
1200     @Override
1201     public String getSQLJoin( )
1202     {
1203         return SQL_JOIN_DIRECTORY_RECORD_FIELD;
1204     }
1205 
1206     /**
1207      * {@inheritDoc}
1208      */
1209     @Override
1210     public String getSQLOrderBy( )
1211     {
1212         return SQL_ORDER_BY_RECORD_FIELD_VALUE;
1213     }
1214 
1215     /**
1216      * {@inheritDoc}
1217      */
1218     @Override
1219     public List<Object> getSQLParametersValues( )
1220     {
1221         return Collections.<Object> singletonList( Integer.valueOf( getIdEntry( ) ) );
1222     }
1223 
1224     /**
1225      * {@inheritDoc}
1226      */
1227     @Override
1228     public boolean isIndexedAsTitle( )
1229     {
1230         return _bIndexedAsTitle;
1231     }
1232 
1233     /**
1234      * {@inheritDoc}
1235      */
1236     @Override
1237     public void setIndexedAsTitle( boolean indexedAsTitle )
1238     {
1239         _bIndexedAsTitle = indexedAsTitle;
1240     }
1241 
1242     /**
1243      * {@inheritDoc}
1244      */
1245     @Override
1246     public boolean isIndexedAsSummary( )
1247     {
1248         return _bIndexedAsSummary;
1249     }
1250 
1251     /**
1252      * {@inheritDoc}
1253      */
1254     @Override
1255     public void setIndexedAsSummary( boolean indexedAsSummary )
1256     {
1257         _bIndexedAsSummary = indexedAsSummary;
1258     }
1259 
1260     /**
1261      * {@inheritDoc}
1262      */
1263     @Override
1264     public void canUploadFiles( List<FileItem> listUploadedFileItems, List<FileItem> listFileItemsToUpload, Locale locale ) throws DirectoryErrorException
1265     {
1266         // Not implemented
1267     }
1268 
1269     /**
1270      * {@inheritDoc}
1271      */
1272     @Override
1273     public boolean isAnonymizable( )
1274     {
1275         return false;
1276     }
1277 
1278     /**
1279      * {@inheritDoc}
1280      */
1281     @Override
1282     public boolean getAnonymize( )
1283     {
1284         return _bAnonymize;
1285     }
1286 
1287     /**
1288      * {@inheritDoc}
1289      */
1290     @Override
1291     public void setAnonymize( boolean bAnonymize )
1292     {
1293         this._bAnonymize = bAnonymize;
1294     }
1295 
1296     /**
1297      * {@inheritDoc}
1298      */
1299     @Override
1300     public int getNumberRow( )
1301     {
1302         return _nNumberRow;
1303     }
1304 
1305     /**
1306      * {@inheritDoc}
1307      */
1308     @Override
1309     public void setNumberRow( int nNumberRow )
1310     {
1311         this._nNumberRow = nNumberRow;
1312     }
1313 
1314     /**
1315      * {@inheritDoc}
1316      */
1317     @Override
1318     public int getNumberColumn( )
1319     {
1320         return _nNumberColumn;
1321     }
1322 
1323     /**
1324      * {@inheritDoc}
1325      */
1326     @Override
1327     public void setNumberColumn( int nNumberColumn )
1328     {
1329         this._nNumberColumn = nNumberColumn;
1330     }
1331 
1332 }