PageData.java

  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. import java.sql.Timestamp;

  36. /**
  37.  * This class provides a structure to build portal pages.
  38.  */
  39. public class PageData
  40. {
  41.     // //////////////////////////////////////////////////////////////////////////
  42.     // Constants
  43.     private static final String EMPTY_STRING = "";
  44.     private String _strName;
  45.     private String _strFavourite;
  46.     private String _strCssUrl;
  47.     private String _strCustomizeCssUrl;
  48.     private String _strPluginsCssUrl;
  49.     private String _strMetaAuthor;
  50.     private String _strMetaCopyright;
  51.     private String _strMetaKeywords;
  52.     private String _strMetaDescription;
  53.     private String _strHeader;
  54.     private String _strMenu;
  55.     private String _strPagePath;
  56.     private String _strContent;
  57.     private String _strFavicon;
  58.     private String _strTreeMenu;
  59.     private String _strTheme;
  60.     private boolean _bIsHomePage;
  61.     private Timestamp _tsDateUpdate;
  62.     private boolean _bDisplayDateUpdate;

  63.     /**
  64.      * Returns the name of the page
  65.      *
  66.      * @return The name of the page as a string.
  67.      */
  68.     public String getName( )
  69.     {
  70.         return _strName;
  71.     }

  72.     /**
  73.      * Sets the name of the page to the specified string.
  74.      *
  75.      * @param strName
  76.      *            The new name of the page.
  77.      */
  78.     public void setName( String strName )
  79.     {
  80.         _strName = strName;
  81.     }

  82.     /**
  83.      * Returns the favourite of the page
  84.      *
  85.      * @return The favourite of the page as a string.
  86.      */
  87.     public String getFavourite( )
  88.     {
  89.         return _strFavourite;
  90.     }

  91.     /**
  92.      * Sets the favourite of the page to the specified string.
  93.      *
  94.      * @param strFavourite
  95.      *            The new favourite of the page.
  96.      */
  97.     public void setFavourite( String strFavourite )
  98.     {
  99.         _strFavourite = strFavourite;
  100.     }

  101.     /**
  102.      * Returns the URL of the Cascading Style Sheet associated to this page
  103.      *
  104.      * @return the URL of the Cascading Style Sheet associated to this page as a String.
  105.      */
  106.     public String getCssUrl( )
  107.     {
  108.         return _strCssUrl;
  109.     }

  110.     /**
  111.      * Sets the URL of the Cascading Style Sheet associated to this page
  112.      *
  113.      * @param strCssUrl
  114.      *            Sets the URL of the Cascading Style Sheet associated to this page to the specified string.
  115.      */
  116.     public void setCssUrl( String strCssUrl )
  117.     {
  118.         _strCssUrl = strCssUrl;
  119.     }

  120.     /**
  121.      * Returns the URL of the Customize Cascading Style Sheet associated to this page
  122.      *
  123.      * @return the URL of the Customize Cascading Style Sheet associated to this page as a String.
  124.      */
  125.     public String getCustomizeCssUrl( )
  126.     {
  127.         return _strCustomizeCssUrl;
  128.     }

  129.     /**
  130.      * Sets the URL of the Customize Cascading Style Sheet associated to this page
  131.      *
  132.      * @param strCustomizeCssUrl
  133.      *            Sets the URL of the Customize Cascading Style Sheet associated to this page to the specified string.
  134.      */
  135.     public void setCustomizeCssUrl( String strCustomizeCssUrl )
  136.     {
  137.         _strCustomizeCssUrl = strCustomizeCssUrl;
  138.     }

  139.     /**
  140.      * Returns the URL of the Plugins Cascading Style Sheet associated to this page
  141.      *
  142.      * @return the URL of the Plugins Cascading Style Sheet associated to this page as a String.
  143.      */
  144.     public String getPluginsCssUrl( )
  145.     {
  146.         return _strPluginsCssUrl;
  147.     }

  148.     /**
  149.      * Sets the URL of the Plugins Cascading Style Sheet associated to this page
  150.      *
  151.      * @param strPluginsCssUrl
  152.      *            Sets the URL of the Plugins Cascading Style Sheet associated to this page to the specified string.
  153.      */
  154.     public void setPluginsCssUrl( String strPluginsCssUrl )
  155.     {
  156.         _strPluginsCssUrl = strPluginsCssUrl;
  157.     }

  158.     /**
  159.      * Returns Author to mention in the META tags of the page.
  160.      *
  161.      * @return Author to mention in the META tags of the page as a String.
  162.      */
  163.     public String getMetaAuthor( )
  164.     {
  165.         return _strMetaAuthor;
  166.     }

  167.     /**
  168.      * Sets Author to mention in the META tags of the page.
  169.      *
  170.      * @param strMetaAuthor
  171.      *            The Author to mention in the META tags of the page
  172.      */
  173.     public void setMetaAuthor( String strMetaAuthor )
  174.     {
  175.         _strMetaAuthor = strMetaAuthor;
  176.     }

  177.     /**
  178.      * Returns Copyright to mention in the META tags of the page.
  179.      *
  180.      * @return Copyright to mention in the META tags of the page as a String.
  181.      */
  182.     public String getMetaCopyright( )
  183.     {
  184.         return _strMetaCopyright;
  185.     }

  186.     /**
  187.      * Sets Copyright to mention in the META tags of the page.
  188.      *
  189.      * @param strMetaCopyright
  190.      *            The Copyright to mention in the META tags of the page
  191.      */
  192.     public void setMetaCopyright( String strMetaCopyright )
  193.     {
  194.         _strMetaCopyright = strMetaCopyright;
  195.     }

  196.     /**
  197.      * Returns Keywords to mention in the META tags of the page.
  198.      *
  199.      * @return Keywords to mention in the META tags of the page as a String.
  200.      */
  201.     public String getMetaKeywords( )
  202.     {
  203.         return _strMetaKeywords;
  204.     }

  205.     /**
  206.      * Sets Keywords to mention in the META tags of the page.
  207.      *
  208.      * @param strMetaKeywords
  209.      *            The Keywords to mention in the META tags of the page.
  210.      */
  211.     public void setMetaKeywords( String strMetaKeywords )
  212.     {
  213.         _strMetaKeywords = strMetaKeywords;
  214.     }

  215.     /**
  216.      * Returns Description to mention in the META tags of the page.
  217.      *
  218.      * @return Description to mention in the META tags of the page as a String.
  219.      */
  220.     public String getMetaDescription( )
  221.     {
  222.         return _strMetaDescription;
  223.     }

  224.     /**
  225.      * Sets Description to mention in the META tags of the page.
  226.      *
  227.      * @param strMetaDescription
  228.      *            The Description to mention in the META tags of the page.
  229.      */
  230.     public void setMetaDescription( String strMetaDescription )
  231.     {
  232.         _strMetaDescription = strMetaDescription;
  233.     }

  234.     /**
  235.      * Returns the header to display at the top of the page.
  236.      *
  237.      * @return The header HTML code as a String.
  238.      */
  239.     public String getHeader( )
  240.     {
  241.         return _strHeader;
  242.     }

  243.     /**
  244.      * Sets the header to display at the top of the page.
  245.      *
  246.      * @param strHeader
  247.      *            Sets the header to display at the top of the page.
  248.      */
  249.     public void setHeader( String strHeader )
  250.     {
  251.         _strHeader = strHeader;
  252.     }

  253.     /**
  254.      * Returns the menu associated to the page
  255.      *
  256.      * @return The HTML code of the menu associated to the page as a String
  257.      */
  258.     public String getMenu( )
  259.     {
  260.         return _strMenu;
  261.     }

  262.     /**
  263.      * Sets the menu associated to the page
  264.      *
  265.      * @param strMenu
  266.      *            The HTML code of the menu to associate to the page as a String
  267.      */
  268.     public void setMenu( String strMenu )
  269.     {
  270.         _strMenu = strMenu;
  271.     }

  272.     /**
  273.      * Returns the page path.
  274.      *
  275.      * @return the page path.
  276.      */
  277.     public String getPagePath( )
  278.     {
  279.         return _strPagePath;
  280.     }

  281.     /**
  282.      * Set the page path.
  283.      *
  284.      * @param strPagePath
  285.      *            the page path
  286.      */
  287.     public void setPagePath( String strPagePath )
  288.     {
  289.         _strPagePath = strPagePath;
  290.     }

  291.     /**
  292.      * Returns the page path.
  293.      *
  294.      * @return the page path.
  295.      */
  296.     public String getTreeMenu( )
  297.     {
  298.         return _strTreeMenu;
  299.     }

  300.     /**
  301.      * Set the page path.
  302.      *
  303.      * @param strTreeMenu
  304.      *            the page path
  305.      */
  306.     public void setTreeMenu( String strTreeMenu )
  307.     {
  308.         _strTreeMenu = ( strTreeMenu == null ) ? EMPTY_STRING : strTreeMenu;
  309.     }

  310.     /**
  311.      * Returns the page content.
  312.      *
  313.      * @return The HTML code of the page content as a String.
  314.      */
  315.     public String getContent( )
  316.     {
  317.         return _strContent;
  318.     }

  319.     /**
  320.      * Sets the page content.
  321.      *
  322.      * @param strContent
  323.      *            The HTML code of the page content as a String.
  324.      */
  325.     public void setContent( String strContent )
  326.     {
  327.         _strContent = strContent;
  328.     }

  329.     /**
  330.      * Returns the favicon of the page
  331.      *
  332.      * @return The favicon of the page as a string.
  333.      */
  334.     public String getFavicon( )
  335.     {
  336.         return _strFavicon;
  337.     }

  338.     /**
  339.      * Sets the Favicon of the page to the specified string.
  340.      *
  341.      * @param strFavicon
  342.      *            The new Favicon of the page.
  343.      */
  344.     public void setFavicon( String strFavicon )
  345.     {
  346.         _strFavicon = strFavicon;
  347.     }

  348.     /**
  349.      * Returns the theme of the page
  350.      *
  351.      * @return The theme of the page as a string.
  352.      */
  353.     public String getTheme( )
  354.     {
  355.         return _strTheme;
  356.     }

  357.     /**
  358.      * Sets the Theme of the page to the specified string.
  359.      *
  360.      * @param strTheme
  361.      *            The new Theme of the page.
  362.      */
  363.     public void setTheme( String strTheme )
  364.     {
  365.         _strTheme = strTheme;
  366.     }

  367.     /**
  368.      * Returns weither the current page is an homepage or not.
  369.      *
  370.      * @return true if the page is an homepage, otherwise false.
  371.      */
  372.     public boolean isHomePage( )
  373.     {
  374.         return _bIsHomePage;
  375.     }

  376.     /**
  377.      * Sets the homepage indicator.
  378.      *
  379.      * @param bHomePage
  380.      *            Should be true if the page is an homepage, otherwise false.
  381.      */
  382.     public void setHomePage( boolean bHomePage )
  383.     {
  384.         _bIsHomePage = bHomePage;
  385.     }

  386.     /**
  387.      * Returns the update date of the page
  388.      *
  389.      * @return The favicon of the page as a string.
  390.      */
  391.     public Timestamp getDateUpdate( )
  392.     {
  393.         return _tsDateUpdate;
  394.     }

  395.     /**
  396.      * Sets the update date of the page.
  397.      *
  398.      * @param strFavicon
  399.      *            The new Favicon of the page.
  400.      */
  401.     public void setDateUpdate( Timestamp tsDateUpdate )
  402.     {
  403.         _tsDateUpdate = tsDateUpdate;
  404.     }

  405.     /**
  406.      * Returns the display update date boolean
  407.      *
  408.      * @return The display update date as a boolean.
  409.      */
  410.     public boolean getDisplayDateUpdate( )
  411.     {

  412.         return _bDisplayDateUpdate;
  413.     }

  414.     /**
  415.      * Sets the display update date boolean.
  416.      *
  417.      * @param bDisplayDateUpdate
  418.      *            The display update date boolean.
  419.      */
  420.     public void setDisplayDateUpdate( boolean bDisplayDateUpdate )
  421.     {
  422.         _bDisplayDateUpdate = bDisplayDateUpdate;
  423.     }
  424. }