View Javadoc

1   /*
2    * Copyright (c) 2002-2014, 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.digglike.business;
35  
36  import fr.paris.lutece.plugins.digglike.business.attribute.DiggAttribute;
37  import fr.paris.lutece.plugins.digglike.utils.DiggUtils;
38  import fr.paris.lutece.portal.service.editor.EditorBbcodeService;
39  import fr.paris.lutece.portal.service.image.ImageResource;
40  import fr.paris.lutece.portal.service.rbac.RBACResource;
41  import fr.paris.lutece.portal.service.regularexpression.RegularExpressionRemovalListenerService;
42  import fr.paris.lutece.portal.service.resource.IExtendableResource;
43  import fr.paris.lutece.portal.service.role.RoleRemovalListenerService;
44  import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource;
45  import fr.paris.lutece.portal.service.workgroup.WorkgroupRemovalListenerService;
46  import fr.paris.lutece.util.xml.XmlUtil;
47  
48  import java.sql.Timestamp;
49  import java.util.List;
50  import java.util.Locale;
51  
52  import javax.servlet.http.HttpServletRequest;
53  
54  
55  /**
56   *
57   * Class Digg
58   *
59   */
60  public class Digg implements IExtendableResource, AdminWorkgroupResource, RBACResource
61  {
62      public static final String RESOURCE_TYPE = "DIGGLIKE_DIGG_TYPE";
63      public static final String ROLE_NONE = "none";
64      public static final String TAG_LIST_ENTRY = "digg-entries";
65      public static final int STATE_ENABLE = 1;
66      public static final int STATE_DISABLE = 0;
67  
68      private static final String TAG_DIGG = "digg";
69      private static final String TAG_DIGG_TITLE = "digg-title";
70      private static final String TAG_DIGG_SUBMITS = "digg-submits";
71  
72      private static DiggWorkgroupRemovalListener _listenerWorkgroup;
73      private static DiggRegularExpressionRemovalListener _listenerRegularExpression;
74      private static DiggRoleRemovalListener _listenerRole;
75      private int _nIdDigg;
76      private String _strTitle;
77      private String _strUnavailabilityMessage;
78      private String _strWorkgroup;
79      private int _nIdMailingListDiggSubmit;
80      private int _nNumberVoteRequired = -1;
81      private int _nNumberDayRequired = -1;
82      private int _nNumberDiggSubmitInTopScore = -1;
83      private int _nNumberDiggSubmitInTopComment = -1;
84      private int _nNumberDiggSubmitCaractersShown = -1;
85      private int _nNumberDiggSubmitPerPage = -1;
86      private boolean _bActiveCaptcha;
87      private boolean _bActiveDiggSubmitAuthentification;
88      private boolean _bActiveVoteAuthentification;
89      private boolean _bActiveCommentAuthentification;
90      private boolean _bActiveDiggPropositionState;
91      private boolean _bActiveDiggSubmitPaginator;
92      private boolean _bAuthorizedComment;
93      private boolean _bDisableNewDiggSubmit;
94      private boolean _bEnableMailNewDiggSubmit;
95      private boolean _bDisableNewComment;
96      private boolean _nLimitNumberVote;
97      private boolean _bShowCategoryBlock;
98      private boolean _bShowTopScoreBlock;
99      private boolean _bShowTopCommentBlock;
100     private String _strLibelleValidateButton;
101     private String _strLibelleContribution;
102     private Timestamp _tDateCreation;
103     private boolean _bActive;
104     private List<DiggAction> _listActions;
105     private VoteType _voteType;
106     private List<IEntry> _listEntries;
107     private List<Category> _listCategories;
108     private List<DiggSubmit> _listDiggsSubmit;
109     private List<DiggSubmitType> _listDiggSubmitTypes;
110     private String _strRole;
111     private String _strHeader;
112     private int _nSortField;
113     private String _strCodeTheme;
114     private String _strConfirmationMessage;
115     private boolean _bActiveEditorBbcode;
116     private int _nIdDefaultSort = DiggUtils.CONSTANT_ID_NULL;
117     private boolean _bDefaultDigg;
118     @DiggAttribute( "disableVote" )
119     private boolean _bDisableVote;
120     @DiggAttribute( "displayCommentInDiggSubmitList" )
121     private boolean _bDisplayCommentInDiggSubmitList;
122     @DiggAttribute( "numberCommentDisplayInDiggSubmitList" )
123     private Integer _nNumberCommentDisplayInDiggSubmitList;
124     @DiggAttribute( "numberCharCommentDisplayInDiggSubmitList" )
125     private Integer _nNumberCharCommentDisplayInDiggSubmitList;
126     @DiggAttribute( "enableMailNewCommentSubmit" )
127     private boolean _bEnableMailNewCommentSubmit;
128     @DiggAttribute( "enableMailNewReportedSubmit" )
129     private boolean _bEnableMailNewReportedSubmit;
130     @DiggAttribute( "enableTermsOfUse" )
131     private boolean _bEnableTermsOfUse;
132     @DiggAttribute( "termsOfUse" )
133     private String _strTermsOfUse;
134     @DiggAttribute( "enableReports" )
135     private boolean _bEnableReports;
136     @DiggAttribute( "idImageResource" )
137     private Integer _nIdImageResource = DiggUtils.CONSTANT_ID_NULL;
138     private ImageResource _image;
139     @DiggAttribute( "description" )
140     private String _strDescription;
141     @DiggAttribute( "notificationNewCommentSenderName" )
142     private String _strNotificationNewCommentSenderName;
143     @DiggAttribute( "notificationNewCommentTitle" )
144     private String _strNotificationNewCommentTitle;
145     @DiggAttribute( "notificationNewCommentBody" )
146     private String _strNotificationNewCommentBody;
147     @DiggAttribute( "notificationNewDiggSubmitSenderName" )
148     private String _strNotificationNewDiggSubmitSenderName;
149     @DiggAttribute( "notificationNewDiggSubmitTitle" )
150     private String _strNotificationNewDiggSubmitTitle;
151     @DiggAttribute( "notificationNewDiggSubmitBody" )
152     private String _strNotificationNewDiggSubmitBody;
153     
154 
155     /**
156     * Initialize the Digg
157     */
158     public static void init(  )
159     {
160         // Create removal listeners and register them
161         if ( _listenerWorkgroup == null )
162         {
163             _listenerWorkgroup = new DiggWorkgroupRemovalListener(  );
164             WorkgroupRemovalListenerService.getService(  ).registerListener( _listenerWorkgroup );
165         }
166 
167         if ( _listenerRegularExpression == null )
168         {
169             _listenerRegularExpression = new DiggRegularExpressionRemovalListener(  );
170             RegularExpressionRemovalListenerService.getService(  ).registerListener( _listenerRegularExpression );
171         }
172 
173         if ( _listenerRole == null )
174         {
175             _listenerRole = new DiggRoleRemovalListener(  );
176             RoleRemovalListenerService.getService(  ).registerListener( _listenerRole );
177         }
178     }
179 
180     /**
181      *
182      * @return the id of the mailing list associate to the digg submit
183      */
184     public int getIdMailingListDiggSubmit(  )
185     {
186         return _nIdMailingListDiggSubmit;
187     }
188 
189     /**
190      * set the id of the mailing list associate to the digg submit
191      * @param mailingListId the id of the mailing list associate to the digg submit
192      */
193     public void setIdMailingListDiggSubmit( int mailingListId )
194     {
195         _nIdMailingListDiggSubmit = mailingListId;
196     }
197 
198     /**
199      *
200      * @return true if the digg for creating digg contain a captcha
201      */
202     public boolean isActiveCaptcha(  )
203     {
204         return _bActiveCaptcha;
205     }
206 
207     /**
208      * set true if the digg for creating digg contain a captcha
209      * @param activeCaptcha true if the digg for creating digg  contain a captcha
210      */
211     public void setActiveCaptcha( boolean activeCaptcha )
212     {
213         _bActiveCaptcha = activeCaptcha;
214     }
215 
216     /**
217         *
218         * @return the libelle of the validate button
219         */
220     public String getLibelleValidateButton(  )
221     {
222         return _strLibelleValidateButton;
223     }
224 
225     /**
226      * set the libelle of the validate button
227      * @param libelleValidateButton the libelle of the validate button
228      */
229     public void setLibelleValidateButton( String libelleValidateButton )
230     {
231         _strLibelleValidateButton = libelleValidateButton;
232     }
233 
234     /**
235     *
236     * @return the libelle of the digg contribution
237     */
238     public String getLibelleContribution(  )
239     {
240         return _strLibelleContribution;
241     }
242 
243     /**
244      * set the libelle of the digg name
245      * @param libelleDiggName the libelle of the digg contribution
246      */
247     public void setLibelleContribution( String libelleDiggName )
248     {
249         _strLibelleContribution = libelleDiggName;
250     }
251 
252     /**
253      *
254      * @return the title of the digg
255      */
256     public String getTitle(  )
257     {
258         return _strTitle;
259     }
260 
261     /**
262      * set the title of the digg
263      * @param strTitle the title of the digg
264      */
265     public void setTitle( String strTitle )
266     {
267         this._strTitle = strTitle;
268     }
269 
270     /**
271      *
272      * @return the unavailability message of the digg
273      */
274     public String getUnavailabilityMessage(  )
275     {
276         return _strUnavailabilityMessage;
277     }
278 
279     /**
280      * set the unavailability message of the digg
281      * @param unavailabilityMessage the unavailability message of the digg
282      */
283     public void setUnavailabilityMessage( String unavailabilityMessage )
284     {
285         _strUnavailabilityMessage = unavailabilityMessage;
286     }
287 
288     /**
289      *
290      * @return the work group associate to the digg
291      */
292     public String getWorkgroup(  )
293     {
294         return _strWorkgroup;
295     }
296 
297     /**
298      * set  the work group associate to the digg
299      * @param workGroup  the work group associate to the digg
300      */
301     public void setWorkgroup( String workGroup )
302     {
303         _strWorkgroup = workGroup;
304     }
305 
306     /**
307      *
308      * @return the id of the digg
309      */
310     public int getIdDigg(  )
311     {
312         return _nIdDigg;
313     }
314 
315     /**
316      * set the id of the digg
317      * @param idDigg the id of the digg
318      */
319     public void setIdDigg( int idDigg )
320     {
321         _nIdDigg = idDigg;
322     }
323 
324     /**
325      *
326      * @return true if the digg is active
327      */
328     public boolean isActive(  )
329     {
330         return _bActive;
331     }
332 
333     /**
334      * set true if the digg is active
335      * @param active true if the digg is active
336      */
337     public void setActive( boolean active )
338     {
339         _bActive = active;
340     }
341 
342     /**
343      *
344      * @return the creation date
345      */
346     public Timestamp getDateCreation(  )
347     {
348         return _tDateCreation;
349     }
350 
351     /**
352      * set the creation date
353      * @param dateCreation the creation date
354      */
355     public void setDateCreation( Timestamp dateCreation )
356     {
357         _tDateCreation = dateCreation;
358     }
359 
360     /**
361     * RBAC resource implmentation
362     * @return The resource type code
363     */
364     public String getResourceTypeCode(  )
365     {
366         return RESOURCE_TYPE;
367     }
368 
369     /**
370      * RBAC resource implmentation
371      * @return The resourceId
372      */
373     public String getResourceId(  )
374     {
375         return "" + _nIdDigg;
376     }
377 
378     /**
379      *
380      * @return a list of action can be use for the digg
381      */
382     public List<DiggAction> getActions(  )
383     {
384         return _listActions;
385     }
386 
387     /**
388      * set a list of action can be use for the digg
389      * @param diggActions a list of action must be use for the digg
390      */
391     public void setActions( List<DiggAction> diggActions )
392     {
393         _listActions = diggActions;
394     }
395 
396     /**
397      * return the number of vote required for publishing a digg submit
398      * @return the number of vote required for publishing a digg submit
399      */
400     public int getNumberVoteRequired(  )
401     {
402         return _nNumberVoteRequired;
403     }
404 
405     /**
406      * Set the number of vote required for publishing a digg submit
407      * @param numberVoteRequired the number of vote required for publishing a digg submit
408       */
409     public void setNumberVoteRequired( int numberVoteRequired )
410     {
411         _nNumberVoteRequired = numberVoteRequired;
412     }
413 
414     /**
415      * return the number of day required for disable a digg submit
416      * @return  the number of day required for disable a digg submit
417      */
418     public int getNumberDayRequired(  )
419     {
420         return _nNumberDayRequired;
421     }
422 
423     /**
424      * set the number of day required for disable a digg submit
425      * @param numberDayRequired the number of day required for disable a digg submit
426      */
427     public void setNumberDayRequired( int numberDayRequired )
428     {
429         _nNumberDayRequired = numberDayRequired;
430     }
431 
432     /**
433      * return true if the form of digg submit creation required a captcha
434      * @return true if the form of digg submit creation required a captcha
435      */
436     public boolean isActiveDiggSubmitAuthentification(  )
437     {
438         return _bActiveDiggSubmitAuthentification;
439     }
440 
441     /**
442     *  set true if the form of digg submit creation required a captcha
443     * @param activeDiggSubmitAuthentification true if the form of digg submit creation required a captcha
444     */
445     public void setActiveDiggSubmitAuthentification( boolean activeDiggSubmitAuthentification )
446     {
447         _bActiveDiggSubmitAuthentification = activeDiggSubmitAuthentification;
448     }
449 
450     /**
451      *
452      * @return true if the vote on  digg submit required an authentification
453      */
454     public boolean isActiveVoteAuthentification(  )
455     {
456         return _bActiveVoteAuthentification;
457     }
458 
459     /**
460      * set true if the vote on  digg submit required an authentification
461      * @param activeVoteAuthentification true if the vote on  digg submit required an authentification
462      */
463     public void setActiveVoteAuthentification( boolean activeVoteAuthentification )
464     {
465         _bActiveVoteAuthentification = activeVoteAuthentification;
466     }
467 
468     /**
469      *
470      * @return true if the comment on  digg submit required an authentification
471      */
472     public boolean isActiveCommentAuthentification(  )
473     {
474         return _bActiveCommentAuthentification;
475     }
476 
477     /**
478      * set true if the comment on  digg submit required an authentification
479      * @param activeCommentAuthentification true if the comment on  digg submit required an authentification
480      */
481     public void setActiveCommentAuthentification( boolean activeCommentAuthentification )
482     {
483         _bActiveCommentAuthentification = activeCommentAuthentification;
484     }
485 
486     /**
487      *
488      * @return true if the new digg submit must be disable
489      */
490     public boolean isDisableNewDiggSubmit(  )
491     {
492         return _bDisableNewDiggSubmit;
493     }
494 
495     /**
496      * set true if the new digg submit must be disable
497      * @param disableNewDiggSubmit true if the new digg submit must be disable
498      */
499     public void setDisableNewDiggSubmit( boolean disableNewDiggSubmit )
500     {
501         _bDisableNewDiggSubmit = disableNewDiggSubmit;
502     }
503 
504     /**
505          *
506          * @return true if a mail must be sent when the new digg is submitted
507          */
508     public boolean isEnableMailNewDiggSubmit(  )
509     {
510         return _bEnableMailNewDiggSubmit;
511     }
512 
513     /**
514      * set true if a mail must be sent when the new digg is submitted
515      * @param enableMailNewDiggSubmit true if a mail must be sent when the new digg is submitted
516      */
517     public void setEnableMailNewDiggSubmit( boolean enableMailNewDiggSubmit )
518     {
519         _bEnableMailNewDiggSubmit = enableMailNewDiggSubmit;
520     }
521 
522     /**
523      *
524      * @return true if the new comment must be disable
525      */
526     public boolean isDisableNewComment(  )
527     {
528         return _bDisableNewComment;
529     }
530 
531     /**
532      * true if the new comment  must be disable
533      * @param disableNewComment true if the new comment must be disable
534      */
535     public void setDisableNewComment( boolean disableNewComment )
536     {
537         _bDisableNewComment = disableNewComment;
538     }
539 
540     /**
541     *
542     * @return the list of entries associate to the digg
543     */
544     public List<IEntry> getEntries(  )
545     {
546         return _listEntries;
547     }
548 
549     /**
550      * set the list of entries associate to the digg
551      * @param listEntries the list of entries associate to the digg
552      */
553     public void setEntries( List<IEntry> listEntries )
554     {
555         _listEntries = listEntries;
556     }
557 
558     /**
559     *
560     * @return the list of categories associate to the digg
561     */
562     public List<Category> getCategories(  )
563     {
564         return _listCategories;
565     }
566 
567     /**
568      * set the list of categories associate to the digg
569      * @param listCategories the list of categories associate to the digg
570      */
571     public void setCategories( List<Category> listCategories )
572     {
573         _listCategories = listCategories;
574     }
575 
576     /**
577      *
578      * @return the vote type associate to the digg
579      */
580     public VoteType getVoteType(  )
581     {
582         return _voteType;
583     }
584 
585     /**
586      * set the vote type associate to the digg
587      * @param type  the vote type associate to the digg
588      */
589     public void setVoteType( VoteType type )
590     {
591         _voteType = type;
592     }
593 
594     /**
595      * return true if the comment are authorized
596      * @return true if the comment are authorized
597       */
598     public boolean isAuthorizedComment(  )
599     {
600         return _bAuthorizedComment;
601     }
602 
603     /**
604      * set true if the comment are authorized
605      * @param authorizedComment true if the comment are authorized
606      */
607     public void setAuthorizedComment( boolean authorizedComment )
608     {
609         _bAuthorizedComment = authorizedComment;
610     }
611 
612     /**
613      * return true if the digg proposition state exist
614      * @return true if the digg proposition state exist
615      */
616     public boolean isActiveDiggPropositionState(  )
617     {
618         return _bActiveDiggPropositionState;
619     }
620 
621     /**
622      * set true if the digg proposition state exist
623      * @param activeDiggPropositionState true if the digg proposition state exist
624      */
625     public void setActiveDiggPropositionState( boolean activeDiggPropositionState )
626     {
627         _bActiveDiggPropositionState = activeDiggPropositionState;
628     }
629 
630     /**
631     * return the number of digg submit display in the list of top comment
632     * @return the number of digg submit display in the list of top comment
633     */
634     public int getNumberDiggSubmitInTopComment(  )
635     {
636         return _nNumberDiggSubmitInTopComment;
637     }
638 
639     /**
640      * Set the number of digg submit display in the list of top comment
641      * @param numberTopComment the number of  digg submit in the list of top comment
642       */
643     public void setNumberDiggSubmitInTopComment( int numberTopComment )
644     {
645         _nNumberDiggSubmitInTopComment = numberTopComment;
646     }
647 
648     /**
649     * return the number of  digg submit display in the list of top score
650     * @return the number of digg submit  display in the list of top score
651     */
652     public int getNumberDiggSubmitInTopScore(  )
653     {
654         return _nNumberDiggSubmitInTopScore;
655     }
656 
657     /**
658      * Set the number of comment display in the list of top score
659      * @param numberTopScore the top score
660       */
661     public void setNumberDiggSubmitInTopScore( int numberTopScore )
662     {
663         _nNumberDiggSubmitInTopScore = numberTopScore;
664     }
665 
666     /**
667     *
668     * @return true if the user can submit just one  vote
669     */
670     public boolean isLimitNumberVote(  )
671     {
672         return _nLimitNumberVote;
673     }
674 
675     /**
676      * set true if the user can submit just one  vote
677      * @param numberVote true if the user can submit just one  vote
678      */
679     public void setLimitNumberVote( boolean numberVote )
680     {
681         _nLimitNumberVote = numberVote;
682     }
683 
684     /**
685      * return the nunber of caracters shown in the list of digg submit
686      * @return the nunber of caracters shown in the list of digg submit
687      */
688     public int getNumberDiggSubmitCaractersShown(  )
689     {
690         return _nNumberDiggSubmitCaractersShown;
691     }
692 
693     /**
694      * set the nunber of caracters shown in the list of digg submit
695      * @param numberCaractersShown the nunber of caracters shown in the list of digg submit
696      */
697     public void setNumberDiggSubmitCaractersShown( int numberCaractersShown )
698     {
699         _nNumberDiggSubmitCaractersShown = numberCaractersShown;
700     }
701 
702     /**
703      *
704      * @return true if the category bloc must be show
705      */
706     public boolean isShowCategoryBlock(  )
707     {
708         return _bShowCategoryBlock;
709     }
710 
711     /**
712      * set true if the category bloc must be show
713      * @param activeCategoryBloc true if the category bloc must be show
714      */
715     public void setShowCategoryBlock( boolean activeCategoryBloc )
716     {
717         _bShowCategoryBlock = activeCategoryBloc;
718     }
719 
720     /**
721      *
722      * @return true if the top score bloc must be show
723      */
724     public boolean isShowTopScoreBlock(  )
725     {
726         return _bShowTopScoreBlock;
727     }
728 
729     /**
730      * set true if the top score bloc must be show
731      * @param activeTopScoreBloc true if the top score bloc must be show
732      */
733     public void setShowTopScoreBlock( boolean activeTopScoreBloc )
734     {
735         _bShowTopScoreBlock = activeTopScoreBloc;
736     }
737 
738     /**
739      *
740      * @return true if the top comment bloc must be show
741      */
742     public boolean isShowTopCommentBlock(  )
743     {
744         return _bShowTopCommentBlock;
745     }
746 
747     /**
748      * set true if the top comment bloc must be show
749      * @param activeTopCommentBloc true if the top comment bloc must be show
750      */
751     public void setShowTopCommentBlock( boolean activeTopCommentBloc )
752     {
753         _bShowTopCommentBlock = activeTopCommentBloc;
754     }
755 
756     /**
757      *
758      * @return the digg submit List associate to the digg
759      */
760     public List<DiggSubmit> getDiggsSubmit(  )
761     {
762         return _listDiggsSubmit;
763     }
764 
765     /**
766      * set the digg submit List associate to the digg
767      * @param diggsSubmit the digg submit List associate to the digg
768      */
769     public void setDiggsSubmit( List<DiggSubmit> diggsSubmit )
770     {
771         _listDiggsSubmit = diggsSubmit;
772     }
773 
774     /**
775      * Returns the xml of this digg
776      * 
777      * @param request The HTTP Servlet request
778      * @param sbListDiggSubmit The string buffer
779      * @param locale la locale
780      * @return the xml of this digg
781      */
782     public String getXml( HttpServletRequest request, StringBuffer sbListDiggSubmit, Locale locale )
783     {
784         StringBuffer strXml = new StringBuffer(  );
785         XmlUtil.beginElement( strXml, TAG_DIGG );
786         XmlUtil.addElementHtml( strXml, TAG_DIGG_TITLE, getTitle(  ) );
787         XmlUtil.beginElement( strXml, TAG_LIST_ENTRY );
788 
789         if ( ( this.getEntries(  ) != null ) && !this.getEntries(  ).isEmpty(  ) )
790         {
791             for ( IEntry entry : this.getEntries(  ) )
792             {
793                 entry.getXml( locale, strXml );
794             }
795         }
796 
797         XmlUtil.endElement( strXml, TAG_LIST_ENTRY );
798         XmlUtil.beginElement( strXml, TAG_DIGG_SUBMITS );
799         strXml.append( sbListDiggSubmit );
800         XmlUtil.endElement( strXml, TAG_DIGG_SUBMITS );
801         XmlUtil.endElement( strXml, TAG_DIGG );
802 
803         return strXml.toString(  );
804     }
805 
806     /**
807      *
808      * @return the number of digg submit per page
809      */
810     public int getNumberDiggSubmitPerPage(  )
811     {
812         return _nNumberDiggSubmitPerPage;
813     }
814 
815     /**
816      * set the number of digg submit per page
817      * @param numberDiggSubmitPerPage the number of digg submit per page
818      */
819     public void setNumberDiggSubmitPerPage( int numberDiggSubmitPerPage )
820     {
821         _nNumberDiggSubmitPerPage = numberDiggSubmitPerPage;
822     }
823 
824     /**
825      *
826      * @return true if the paginator is enable
827      */
828     public boolean isActiveDiggSubmitPaginator(  )
829     {
830         return _bActiveDiggSubmitPaginator;
831     }
832 
833     /**
834      * set true if the paginator is enable
835      * @param activeDiggSubmitPaginator true if the paginator is enable
836      */
837     public void setActiveDiggSubmitPaginator( boolean activeDiggSubmitPaginator )
838     {
839         _bActiveDiggSubmitPaginator = activeDiggSubmitPaginator;
840     }
841 
842     /**
843      * Gets the digg role
844      * @return digg's role as a String
845      *
846      */
847     public String getRole(  )
848     {
849         return _strRole;
850     }
851 
852     /**
853      * Sets the digg's role
854      * @param strRole The role
855      *
856      */
857     public void setRole( String strRole )
858     {
859         _strRole = strRole;
860     }
861 
862     /**Sets the digg's header
863      * @param strHeader the strHeader to set
864      */
865     public void setHeader( String strHeader )
866     {
867         this._strHeader = strHeader;
868     }
869 
870     /**
871      * @return the strHeader
872      */
873     public String getHeader(  )
874     {
875         return _strHeader;
876     }
877 
878     /**
879      * @param nSortField the _nSortField to set
880      */
881     public void setSortField( int nSortField )
882     {
883         this._nSortField = nSortField;
884     }
885 
886     /**
887      * @return the _nSortField
888      */
889     public int getSortField(  )
890     {
891         return _nSortField;
892     }
893 
894     /**
895     *
896     * @return the theme code
897     */
898     public String getCodeTheme(  )
899     {
900         return _strCodeTheme;
901     }
902 
903     /**
904      * set the theme code
905      * @param strCodeTheme the theme code
906      */
907     public void setCodeTheme( String strCodeTheme )
908     {
909         _strCodeTheme = strCodeTheme;
910     }
911 
912     /**
913      * @return the strMessage
914      */
915     public String getConfirmationMessage(  )
916     {
917         return _strConfirmationMessage;
918     }
919 
920     /**
921      * @param strConfirmationMessage the message of the validation to set
922      */
923     public void setConfirmationMessage( String strConfirmationMessage )
924     {
925         _strConfirmationMessage = strConfirmationMessage;
926     }
927 
928     /**
929      * set true if the editor BBcode must be display
930      * @param nActiveEditorBbCode true if the editor BBcode must be display
931      */
932     public void setActiveEditorBbcode( boolean nActiveEditorBbCode )
933     {
934         this._bActiveEditorBbcode = nActiveEditorBbCode;
935     }
936 
937     /**
938      *
939      * @return true if the editor BBcode must be display
940      */
941     public boolean isActiveEditorBbcode(  )
942     {
943         return _bActiveEditorBbcode;
944     }
945 
946     /**
947      * parseBbcodeValue
948      * @param strValue the value to parse
949      * @return the result of the parsing
950      */
951     public String parseBbcodeValue( String strValue )
952     {
953         if ( isActiveEditorBbcode(  ) )
954         {
955             return EditorBbcodeService.getInstance(  ).parse( strValue );
956         }
957 
958         return strValue;
959     }
960 
961     /**
962      *
963      * @return the default sort id
964      */
965     public int getIdDefaultSort(  )
966     {
967         return _nIdDefaultSort;
968     }
969 
970     /**
971      * set id Default Sort
972      * @param nIdDefaultSort  the default sort id
973      */
974     public void setIdDefaultSort( int nIdDefaultSort )
975     {
976         _nIdDefaultSort = nIdDefaultSort;
977     }
978 
979     /**
980      *
981      * @return true if the digg is a Default digg
982      */
983     public boolean isDefaultDigg(  )
984     {
985         return _bDefaultDigg;
986     }
987 
988     /**
989      * set true if the digg is a Default digg
990      * @param bDefaultDigg true if the digg is a Default digg
991      */
992     public void setDefaultDigg( boolean bDefaultDigg )
993     {
994         _bDefaultDigg = bDefaultDigg;
995     }
996 
997     /**
998      *
999      * @return true if the vote is disable
1000      */
1001     public boolean isDisableVote(  )
1002     {
1003         return _bDisableVote;
1004     }
1005 
1006     /**
1007      * set true if the vote is disable
1008      * @param bDisable true if the vote is disable
1009      */
1010     public void setDisableVote( boolean bDisable )
1011     {
1012         _bDisableVote = bDisable;
1013     }
1014 
1015     /**
1016      *
1017      * @return true if the list of comment must be display in digg submit list
1018      */
1019     public boolean isDisplayCommentInDiggSubmitList(  )
1020     {
1021         return _bDisplayCommentInDiggSubmitList;
1022     }
1023 
1024     /**
1025      *
1026      * @param bDisplayCommentInDiggSubmitList true if the list of comment must be display in digg submit list
1027      */
1028     public void setDisplayCommentInDiggSubmitList( boolean bDisplayCommentInDiggSubmitList )
1029     {
1030         this._bDisplayCommentInDiggSubmitList = bDisplayCommentInDiggSubmitList;
1031     }
1032 
1033     /**
1034      *
1035      * @return the number of comment submit display by digg submit in the list of digg submit
1036      */
1037     public Integer getNumberCommentDisplayInDiggSubmitList(  )
1038     {
1039         return _nNumberCommentDisplayInDiggSubmitList;
1040     }
1041 
1042     /**
1043      *
1044      * @param nNumberCommentDisplayInDiggSubmitList the number of comment submit display by digg submit in the list of digg submit
1045      */
1046     public void setNumberCommentDisplayInDiggSubmitList( Integer nNumberCommentDisplayInDiggSubmitList )
1047     {
1048         this._nNumberCommentDisplayInDiggSubmitList = nNumberCommentDisplayInDiggSubmitList;
1049     }
1050 
1051     /**
1052      *
1053      * @return the number of  char comment  display by digg submit in the list of digg submit
1054      */
1055     public Integer getNumberCharCommentDisplayInDiggSubmitList(  )
1056     {
1057         return _nNumberCharCommentDisplayInDiggSubmitList;
1058     }
1059 
1060     /**
1061      *
1062      * @param nNumberCommentDisplayInDiggSubmitList the number of  char comment  display by digg submit in the list of digg submit
1063      */
1064     public void setNumberCharCommentDisplayInDiggSubmitList( Integer nNumberCommentDisplayInDiggSubmitList )
1065     {
1066         this._nNumberCharCommentDisplayInDiggSubmitList = nNumberCommentDisplayInDiggSubmitList;
1067     }
1068 
1069     /**
1070     *
1071     * @return true if a mail must be sent when the new comment is submitted
1072     */
1073     public boolean isEnableMailNewCommentSubmit(  )
1074     {
1075         return _bEnableMailNewCommentSubmit;
1076     }
1077 
1078     /**
1079     * set true if a mail must be sent when the new comment is submitted
1080     * @param bEnableMailNewCommentSubmit true if a mail must be sent when the new comment is submitted
1081     */
1082     public void setEnableMailNewCommentSubmit( boolean bEnableMailNewCommentSubmit )
1083     {
1084         _bEnableMailNewCommentSubmit = bEnableMailNewCommentSubmit;
1085     }
1086 
1087     /**
1088     *
1089     * @return true if a mail must be sent when the new comment is submitted
1090     */
1091     public boolean isEnableMailNewReportedSubmit(  )
1092     {
1093         return _bEnableMailNewReportedSubmit;
1094     }
1095 
1096     /**
1097     * set true if a mail must be sent when the new reported is submitted
1098     * @param bEnableMailNewReportedSubmit true if a mail must be sent when the new comment is submitted
1099     */
1100     public void setEnableMailNewReportedSubmit( boolean bEnableMailNewReportedSubmit )
1101     {
1102         _bEnableMailNewReportedSubmit = bEnableMailNewReportedSubmit;
1103     }
1104 
1105     /**
1106     *
1107     * @return the digg submit type List associate to the digg
1108     */
1109     public List<DiggSubmitType> getDiggSubmitTypes(  )
1110     {
1111         return _listDiggSubmitTypes;
1112     }
1113 
1114     /**
1115      * set the digg submit type List associate to the digg
1116      * @param diggSubmitTypes the digg submit type List associate to the digg
1117      */
1118     public void setDiggSubmiTypes( List<DiggSubmitType> diggSubmitTypes )
1119     {
1120         _listDiggSubmitTypes = diggSubmitTypes;
1121     }
1122 
1123     /**
1124      *
1125      * @return true if Terms of use must be enable
1126      */
1127     public boolean isEnableTermsOfUse(  )
1128     {
1129         return _bEnableTermsOfUse;
1130     }
1131 
1132     /**
1133      *
1134      * @param bEnableTermsOfUse  true if Terms of use must be enable
1135      */
1136     public void setEnableTermsOfUse( boolean bEnableTermsOfUse )
1137     {
1138         _bEnableTermsOfUse = bEnableTermsOfUse;
1139     }
1140 
1141     /**
1142      * the terms of use
1143      * @return the terms of use
1144      */
1145     public String getTermsOfUse(  )
1146     {
1147         return _strTermsOfUse;
1148     }
1149 
1150     /**
1151      * set Terms of use
1152      * @param strTermsOfUse the terms of use
1153      */
1154     public void setTermsOfUse( String strTermsOfUse )
1155     {
1156         this._strTermsOfUse = strTermsOfUse;
1157     }
1158 
1159     /**
1160      *
1161      * @return the digg description
1162      */
1163     public String getDescription(  )
1164     {
1165         return _strDescription;
1166     }
1167 
1168     /**
1169      * 
1170      * @param strDescription set the digg description
1171      */
1172     public void setDescription( String strDescription )
1173     {
1174         this._strDescription = strDescription;
1175     }
1176 
1177     /**
1178      *
1179      * @return true if reports are enable
1180      */
1181     public boolean isEnableReports(  )
1182     {
1183         return _bEnableReports;
1184     }
1185 
1186     /**
1187      * 
1188      * @param bEnableReports true if reports are enable
1189      */
1190     public void setEnableReports( boolean bEnableReports )
1191     {
1192         this._bEnableReports = bEnableReports;
1193     }
1194 
1195     /**
1196      * the image resource id associate to the digg
1197      * @return Resource Image
1198      */
1199     public Integer getIdImageResource(  )
1200     {
1201         return _nIdImageResource;
1202     }
1203 
1204     /**
1205      * image resource id associate to the digg
1206      * @param nIdImageResource image resource id associate to the digg
1207      */
1208     public void setIdImageResource( Integer nIdImageResource )
1209     {
1210         _nIdImageResource = nIdImageResource;
1211     }
1212 
1213     /**
1214      * get Image
1215      * @return Image Resource
1216      */
1217     public ImageResource getImage(  )
1218     {
1219         return _image;
1220     }
1221 
1222     /**
1223      * set Image Resource
1224      * @param image  Image Resource
1225      */
1226     public void setImage( ImageResource image )
1227     {
1228         this._image = image;
1229     }
1230 
1231     /**
1232      * {@inheritDoc}
1233      */
1234     @Override
1235     public String getIdExtendableResource(  )
1236     {
1237         return Integer.toString( _nIdDigg );
1238     }
1239 
1240     /**
1241      * {@inheritDoc}
1242      */
1243     @Override
1244     public String getExtendableResourceType(  )
1245     {
1246         return RESOURCE_TYPE;
1247     }
1248 
1249     /**
1250      * {@inheritDoc}
1251      */
1252     @Override
1253     public String getExtendableResourceName(  )
1254     {
1255         return _strTitle;
1256     }
1257 
1258     /**
1259      * {@inheritDoc}
1260      */
1261     @Override
1262     public String getExtendableResourceDescription(  )
1263     {
1264         return _strDescription;
1265     }
1266 
1267     /**
1268      * {@inheritDoc}
1269      */
1270     @Override
1271     public String getExtendableResourceImageUrl(  )
1272     {
1273         if ( _nIdImageResource != null )
1274         {
1275             StringBuilder sbUrl = new StringBuilder( DiggUtils.SERVLET_IMAGE_PATH );
1276             sbUrl.append( _nIdImageResource );
1277 
1278             return sbUrl.toString(  );
1279         }
1280 
1281         return null;
1282     }
1283     
1284     /**
1285      * 
1286      * @return getNotificationNewCommentSenderName
1287      */
1288     public String getNotificationNewCommentSenderName() {
1289 		return _strNotificationNewCommentSenderName;
1290 	}
1291 
1292     /**
1293      * 
1294      * @param _strNotificationNewCommentSenderName
1295      */
1296 	public void setNotificationNewCommentSenderName(
1297 			String _strNotificationNewCommentSenderName) {
1298 		this._strNotificationNewCommentSenderName = _strNotificationNewCommentSenderName;
1299 	}
1300 	
1301 	/**
1302 	 * 
1303 	 * @return
1304 	 */
1305 	public String getNotificationNewCommentTitle() {
1306 		return _strNotificationNewCommentTitle;
1307 	}
1308 	/**
1309 	 * 
1310 	 * @param _strNotificationNewCommentTitle
1311 	 */
1312 	public void setNotificationNewCommentTitle(
1313 			String _strNotificationNewCommentTitle) {
1314 		this._strNotificationNewCommentTitle = _strNotificationNewCommentTitle;
1315 	}
1316 	/**
1317 	 * 
1318 	 * @return
1319 	 */
1320 	public String getNotificationNewCommentBody() {
1321 		return _strNotificationNewCommentBody;
1322 	}
1323 	/**
1324 	 * 
1325 	 * @param _strNotificationNewCommentBody
1326 	 */
1327 	public void setNotificationNewCommentBody(
1328 			String _strNotificationNewCommentBody) {
1329 		this._strNotificationNewCommentBody = _strNotificationNewCommentBody;
1330 	}
1331 	/**
1332 	 * 
1333 	 * @return
1334 	 */
1335 	public String getNotificationNewDiggSubmitSenderName() {
1336 		return _strNotificationNewDiggSubmitSenderName;
1337 	}
1338 	/**
1339 	 * 
1340 	 * @param _strNotificationNewDiggSubmitSenderName
1341 	 */
1342 	public void setNotificationNewDiggSubmitSenderName(
1343 			String _strNotificationNewDiggSubmitSenderName) {
1344 		this._strNotificationNewDiggSubmitSenderName = _strNotificationNewDiggSubmitSenderName;
1345 	}
1346 	/**
1347 	 * 
1348 	 * @return
1349 	 */
1350 	public String getNotificationNewDiggSubmitTitle() {
1351 		return _strNotificationNewDiggSubmitTitle;
1352 	}
1353 	/**
1354 	 * 
1355 	 * @param _strNotificationNewDiggSubmitTitle
1356 	 */
1357 	public void setNotificationNewDiggSubmitTitle(
1358 			String _strNotificationNewDiggSubmitTitle) {
1359 		this._strNotificationNewDiggSubmitTitle = _strNotificationNewDiggSubmitTitle;
1360 	}
1361 	/**
1362 	 * 
1363 	 * @return
1364 	 */
1365 	public String getNotificationNewDiggSubmitBody() {
1366 		return _strNotificationNewDiggSubmitBody;
1367 	}
1368 	/**
1369 	 * 
1370 	 * @param _strNotificationDiggSubmitBody
1371 	 */
1372 	public void setNotificationNewDiggSubmitBody(
1373 			String _strNotificationDiggSubmitBody) {
1374 		this._strNotificationNewDiggSubmitBody = _strNotificationDiggSubmitBody;
1375 	}
1376 }