LocalizedData.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.datastore;

  35. /**
  36.  * This is the business class for the object SiteProperty
  37.  */
  38. public class LocalizedData implements Comparable
  39. {

  40.     // Variables declarations
  41.     private String _strKey;
  42.     private String _strLabel;
  43.     private String _strValue;
  44.     private String _strHelp;
  45.     private String _strGroup;
  46.     private int _nOrder;

  47.     /**
  48.      * Returns the Key
  49.      *
  50.      * @return The Key
  51.      */
  52.     public String getKey( )
  53.     {
  54.         return _strKey;
  55.     }

  56.     /**
  57.      * Sets the Key
  58.      *
  59.      * @param strKey
  60.      *            The Key
  61.      */
  62.     public void setKey( String strKey )
  63.     {
  64.         _strKey = strKey;
  65.     }

  66.     /**
  67.      * Returns the Label
  68.      *
  69.      * @return The Label
  70.      */
  71.     public String getLabel( )
  72.     {
  73.         return _strLabel;
  74.     }

  75.     /**
  76.      * Sets the Label
  77.      *
  78.      * @param strLabel
  79.      *            The Label
  80.      */
  81.     public void setLabel( String strLabel )
  82.     {
  83.         _strLabel = strLabel;
  84.     }

  85.     /**
  86.      * Returns the Value
  87.      *
  88.      * @return The Value
  89.      */
  90.     public String getValue( )
  91.     {
  92.         return _strValue;
  93.     }

  94.     /**
  95.      * Sets the Value
  96.      *
  97.      * @param strValue
  98.      *            The Value
  99.      */
  100.     public void setValue( String strValue )
  101.     {
  102.         _strValue = strValue;
  103.     }

  104.     /**
  105.      * Returns the Help
  106.      *
  107.      * @return The Help
  108.      */
  109.     public String getHelp( )
  110.     {
  111.         return _strHelp;
  112.     }

  113.     /**
  114.      * Sets the Help
  115.      *
  116.      * @param strHelp
  117.      *            The Help
  118.      */
  119.     public void setHelp( String strHelp )
  120.     {
  121.         _strHelp = strHelp;
  122.     }

  123.     /**
  124.      * Returns the Group
  125.      *
  126.      * @return The Group
  127.      */
  128.     public String getGroup( )
  129.     {
  130.         return _strGroup;
  131.     }

  132.     /**
  133.      * Sets the Group
  134.      *
  135.      * @param strGroup
  136.      *            The Group
  137.      */
  138.     public void setGroup( String strGroup )
  139.     {
  140.         _strGroup = strGroup;
  141.     }

  142.     /**
  143.      * Returns the Order
  144.      *
  145.      * @return The Order
  146.      */
  147.     public int getOrder( )
  148.     {
  149.         return _nOrder;
  150.     }

  151.     /**
  152.      * Sets the Order
  153.      *
  154.      * @param nOrder
  155.      *            The Order
  156.      */
  157.     public void setOrder( int nOrder )
  158.     {
  159.         _nOrder = nOrder;
  160.     }

  161.     /**
  162.      * Sets the Order
  163.      *
  164.      * @param strOrder
  165.      *            The Order
  166.      */
  167.     public void setOrder( String strOrder )
  168.     {
  169.         try
  170.         {
  171.             _nOrder = Integer.parseInt( strOrder );
  172.         }
  173.         catch( NumberFormatException e )
  174.         {
  175.             _nOrder = 0;
  176.         }
  177.     }

  178.     /**
  179.      * {@inheritDoc }
  180.      */
  181.     @Override
  182.     public int compareTo( Object object )
  183.     {
  184.         int nCompare = _nOrder - ( (LocalizedData) object ).getOrder( );

  185.         if ( nCompare == 0 )
  186.         {
  187.             nCompare = _strKey.compareTo( ( (LocalizedData) object ).getKey( ) );
  188.         }
  189.         return nCompare;
  190.     }

  191. }