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 /** 37 * This is the business class for the object SiteProperty 38 */ 39 public class LocalizedData implements Comparable 40 { 41 42 // Variables declarations 43 private String _strKey; 44 private String _strLabel; 45 private String _strValue; 46 private String _strHelp; 47 private String _strGroup; 48 private int _nOrder; 49 50 /** 51 * Returns the Key 52 * 53 * @return The Key 54 */ 55 public String getKey( ) 56 { 57 return _strKey; 58 } 59 60 /** 61 * Sets the Key 62 * 63 * @param strKey 64 * The Key 65 */ 66 public void setKey( String strKey ) 67 { 68 _strKey = strKey; 69 } 70 71 /** 72 * Returns the Label 73 * 74 * @return The Label 75 */ 76 public String getLabel( ) 77 { 78 return _strLabel; 79 } 80 81 /** 82 * Sets the Label 83 * 84 * @param strLabel 85 * The Label 86 */ 87 public void setLabel( String strLabel ) 88 { 89 _strLabel = strLabel; 90 } 91 92 /** 93 * Returns the Value 94 * 95 * @return The Value 96 */ 97 public String getValue( ) 98 { 99 return _strValue; 100 } 101 102 /** 103 * Sets the Value 104 * 105 * @param strValue 106 * The Value 107 */ 108 public void setValue( String strValue ) 109 { 110 _strValue = strValue; 111 } 112 113 /** 114 * Returns the Help 115 * 116 * @return The Help 117 */ 118 public String getHelp( ) 119 { 120 return _strHelp; 121 } 122 123 /** 124 * Sets the Help 125 * 126 * @param strHelp 127 * The Help 128 */ 129 public void setHelp( String strHelp ) 130 { 131 _strHelp = strHelp; 132 } 133 134 /** 135 * Returns the Group 136 * 137 * @return The Group 138 */ 139 public String getGroup( ) 140 { 141 return _strGroup; 142 } 143 144 /** 145 * Sets the Group 146 * 147 * @param strGroup 148 * The Group 149 */ 150 public void setGroup( String strGroup ) 151 { 152 _strGroup = strGroup; 153 } 154 155 /** 156 * Returns the Order 157 * 158 * @return The Order 159 */ 160 public int getOrder( ) 161 { 162 return _nOrder; 163 } 164 165 /** 166 * Sets the Order 167 * 168 * @param nOrder 169 * The Order 170 */ 171 public void setOrder( int nOrder ) 172 { 173 _nOrder = nOrder; 174 } 175 176 /** 177 * Sets the Order 178 * 179 * @param strOrder 180 * The Order 181 */ 182 public void setOrder( String strOrder ) 183 { 184 try 185 { 186 _nOrder = Integer.parseInt( strOrder ); 187 } 188 catch( NumberFormatException e ) 189 { 190 _nOrder = 0; 191 } 192 } 193 194 /** 195 * {@inheritDoc } 196 */ 197 @Override 198 public int compareTo( Object object ) 199 { 200 int nCompare = _nOrder - ( (LocalizedData) object ).getOrder( ); 201 202 if ( nCompare == 0 ) 203 { 204 nCompare = _strKey.compareTo( ( (LocalizedData) object ).getKey( ) ); 205 } 206 return nCompare; 207 } 208 209 }