View Javadoc
1   /*
2    * Copyright (c) 2002-2022, City of 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.portal.service.content;
35  
36  import java.sql.Timestamp;
37  
38  /**
39   * This class provides a structure to build portal pages.
40   */
41  public class PageData
42  {
43      // //////////////////////////////////////////////////////////////////////////
44      // Constants
45      private static final String EMPTY_STRING = "";
46      private String _strName;
47      private String _strFavourite;
48      private String _strCssUrl;
49      private String _strCustomizeCssUrl;
50      private String _strPluginsCssUrl;
51      private String _strMetaAuthor;
52      private String _strMetaCopyright;
53      private String _strMetaKeywords;
54      private String _strMetaDescription;
55      private String _strHeader;
56      private String _strMenu;
57      private String _strPagePath;
58      private String _strContent;
59      private String _strFavicon;
60      private String _strTreeMenu;
61      private String _strTheme;
62      private boolean _bIsHomePage;
63      private Timestamp _tsDateUpdate;
64      private boolean _bDisplayDateUpdate;
65  
66      /**
67       * Returns the name of the page
68       *
69       * @return The name of the page as a string.
70       */
71      public String getName( )
72      {
73          return _strName;
74      }
75  
76      /**
77       * Sets the name of the page to the specified string.
78       *
79       * @param strName
80       *            The new name of the page.
81       */
82      public void setName( String strName )
83      {
84          _strName = strName;
85      }
86  
87      /**
88       * Returns the favourite of the page
89       *
90       * @return The favourite of the page as a string.
91       */
92      public String getFavourite( )
93      {
94          return _strFavourite;
95      }
96  
97      /**
98       * Sets the favourite of the page to the specified string.
99       *
100      * @param strFavourite
101      *            The new favourite of the page.
102      */
103     public void setFavourite( String strFavourite )
104     {
105         _strFavourite = strFavourite;
106     }
107 
108     /**
109      * Returns the URL of the Cascading Style Sheet associated to this page
110      *
111      * @return the URL of the Cascading Style Sheet associated to this page as a String.
112      */
113     public String getCssUrl( )
114     {
115         return _strCssUrl;
116     }
117 
118     /**
119      * Sets the URL of the Cascading Style Sheet associated to this page
120      *
121      * @param strCssUrl
122      *            Sets the URL of the Cascading Style Sheet associated to this page to the specified string.
123      */
124     public void setCssUrl( String strCssUrl )
125     {
126         _strCssUrl = strCssUrl;
127     }
128 
129     /**
130      * Returns the URL of the Customize Cascading Style Sheet associated to this page
131      *
132      * @return the URL of the Customize Cascading Style Sheet associated to this page as a String.
133      */
134     public String getCustomizeCssUrl( )
135     {
136         return _strCustomizeCssUrl;
137     }
138 
139     /**
140      * Sets the URL of the Customize Cascading Style Sheet associated to this page
141      *
142      * @param strCustomizeCssUrl
143      *            Sets the URL of the Customize Cascading Style Sheet associated to this page to the specified string.
144      */
145     public void setCustomizeCssUrl( String strCustomizeCssUrl )
146     {
147         _strCustomizeCssUrl = strCustomizeCssUrl;
148     }
149 
150     /**
151      * Returns the URL of the Plugins Cascading Style Sheet associated to this page
152      *
153      * @return the URL of the Plugins Cascading Style Sheet associated to this page as a String.
154      */
155     public String getPluginsCssUrl( )
156     {
157         return _strPluginsCssUrl;
158     }
159 
160     /**
161      * Sets the URL of the Plugins Cascading Style Sheet associated to this page
162      *
163      * @param strPluginsCssUrl
164      *            Sets the URL of the Plugins Cascading Style Sheet associated to this page to the specified string.
165      */
166     public void setPluginsCssUrl( String strPluginsCssUrl )
167     {
168         _strPluginsCssUrl = strPluginsCssUrl;
169     }
170 
171     /**
172      * Returns Author to mention in the META tags of the page.
173      *
174      * @return Author to mention in the META tags of the page as a String.
175      */
176     public String getMetaAuthor( )
177     {
178         return _strMetaAuthor;
179     }
180 
181     /**
182      * Sets Author to mention in the META tags of the page.
183      *
184      * @param strMetaAuthor
185      *            The Author to mention in the META tags of the page
186      */
187     public void setMetaAuthor( String strMetaAuthor )
188     {
189         _strMetaAuthor = strMetaAuthor;
190     }
191 
192     /**
193      * Returns Copyright to mention in the META tags of the page.
194      *
195      * @return Copyright to mention in the META tags of the page as a String.
196      */
197     public String getMetaCopyright( )
198     {
199         return _strMetaCopyright;
200     }
201 
202     /**
203      * Sets Copyright to mention in the META tags of the page.
204      *
205      * @param strMetaCopyright
206      *            The Copyright to mention in the META tags of the page
207      */
208     public void setMetaCopyright( String strMetaCopyright )
209     {
210         _strMetaCopyright = strMetaCopyright;
211     }
212 
213     /**
214      * Returns Keywords to mention in the META tags of the page.
215      *
216      * @return Keywords to mention in the META tags of the page as a String.
217      */
218     public String getMetaKeywords( )
219     {
220         return _strMetaKeywords;
221     }
222 
223     /**
224      * Sets Keywords to mention in the META tags of the page.
225      *
226      * @param strMetaKeywords
227      *            The Keywords to mention in the META tags of the page.
228      */
229     public void setMetaKeywords( String strMetaKeywords )
230     {
231         _strMetaKeywords = strMetaKeywords;
232     }
233 
234     /**
235      * Returns Description to mention in the META tags of the page.
236      *
237      * @return Description to mention in the META tags of the page as a String.
238      */
239     public String getMetaDescription( )
240     {
241         return _strMetaDescription;
242     }
243 
244     /**
245      * Sets Description to mention in the META tags of the page.
246      *
247      * @param strMetaDescription
248      *            The Description to mention in the META tags of the page.
249      */
250     public void setMetaDescription( String strMetaDescription )
251     {
252         _strMetaDescription = strMetaDescription;
253     }
254 
255     /**
256      * Returns the header to display at the top of the page.
257      *
258      * @return The header HTML code as a String.
259      */
260     public String getHeader( )
261     {
262         return _strHeader;
263     }
264 
265     /**
266      * Sets the header to display at the top of the page.
267      *
268      * @param strHeader
269      *            Sets the header to display at the top of the page.
270      */
271     public void setHeader( String strHeader )
272     {
273         _strHeader = strHeader;
274     }
275 
276     /**
277      * Returns the menu associated to the page
278      *
279      * @return The HTML code of the menu associated to the page as a String
280      */
281     public String getMenu( )
282     {
283         return _strMenu;
284     }
285 
286     /**
287      * Sets the menu associated to the page
288      *
289      * @param strMenu
290      *            The HTML code of the menu to associate to the page as a String
291      */
292     public void setMenu( String strMenu )
293     {
294         _strMenu = strMenu;
295     }
296 
297     /**
298      * Returns the page path.
299      *
300      * @return the page path.
301      */
302     public String getPagePath( )
303     {
304         return _strPagePath;
305     }
306 
307     /**
308      * Set the page path.
309      *
310      * @param strPagePath
311      *            the page path
312      */
313     public void setPagePath( String strPagePath )
314     {
315         _strPagePath = strPagePath;
316     }
317 
318     /**
319      * Returns the page path.
320      *
321      * @return the page path.
322      */
323     public String getTreeMenu( )
324     {
325         return _strTreeMenu;
326     }
327 
328     /**
329      * Set the page path.
330      *
331      * @param strTreeMenu
332      *            the page path
333      */
334     public void setTreeMenu( String strTreeMenu )
335     {
336         _strTreeMenu = ( strTreeMenu == null ) ? EMPTY_STRING : strTreeMenu;
337     }
338 
339     /**
340      * Returns the page content.
341      *
342      * @return The HTML code of the page content as a String.
343      */
344     public String getContent( )
345     {
346         return _strContent;
347     }
348 
349     /**
350      * Sets the page content.
351      *
352      * @param strContent
353      *            The HTML code of the page content as a String.
354      */
355     public void setContent( String strContent )
356     {
357         _strContent = strContent;
358     }
359 
360     /**
361      * Returns the favicon of the page
362      *
363      * @return The favicon of the page as a string.
364      */
365     public String getFavicon( )
366     {
367         return _strFavicon;
368     }
369 
370     /**
371      * Sets the Favicon of the page to the specified string.
372      *
373      * @param strFavicon
374      *            The new Favicon of the page.
375      */
376     public void setFavicon( String strFavicon )
377     {
378         _strFavicon = strFavicon;
379     }
380 
381     /**
382      * Returns the theme of the page
383      *
384      * @return The theme of the page as a string.
385      */
386     public String getTheme( )
387     {
388         return _strTheme;
389     }
390 
391     /**
392      * Sets the Theme of the page to the specified string.
393      *
394      * @param strTheme
395      *            The new Theme of the page.
396      */
397     public void setTheme( String strTheme )
398     {
399         _strTheme = strTheme;
400     }
401 
402     /**
403      * Returns weither the current page is an homepage or not.
404      *
405      * @return true if the page is an homepage, otherwise false.
406      */
407     public boolean isHomePage( )
408     {
409         return _bIsHomePage;
410     }
411 
412     /**
413      * Sets the homepage indicator.
414      *
415      * @param bHomePage
416      *            Should be true if the page is an homepage, otherwise false.
417      */
418     public void setHomePage( boolean bHomePage )
419     {
420         _bIsHomePage = bHomePage;
421     }
422 
423     /**
424      * Returns the update date of the page
425      *
426      * @return The favicon of the page as a string.
427      */
428     public Timestamp getDateUpdate( )
429     {
430         return _tsDateUpdate;
431     }
432 
433     /**
434      * Sets the update date of the page.
435      *
436      * @param strFavicon
437      *            The new Favicon of the page.
438      */
439     public void setDateUpdate( Timestamp tsDateUpdate )
440     {
441         _tsDateUpdate = tsDateUpdate;
442     }
443 
444     /**
445      * Returns the display update date boolean
446      *
447      * @return The display update date as a boolean.
448      */
449     public boolean getDisplayDateUpdate( )
450     {
451 
452         return _bDisplayDateUpdate;
453     }
454 
455     /**
456      * Sets the display update date boolean.
457      *
458      * @param bDisplayDateUpdate
459      *            The display update date boolean.
460      */
461     public void setDisplayDateUpdate( boolean bDisplayDateUpdate )
462     {
463         _bDisplayDateUpdate = bDisplayDateUpdate;
464     }
465 }