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.business.user.attribute; 35 36 import fr.paris.lutece.portal.business.user.AdminUser; 37 import fr.paris.lutece.portal.service.plugin.Plugin; 38 39 import java.util.List; 40 import java.util.Locale; 41 42 import javax.servlet.http.HttpServletRequest; 43 44 /** 45 * IAttribute 46 */ 47 public interface IAttribute 48 { 49 /** 50 * Get ID Attribute 51 * 52 * @return ID attribute 53 */ 54 int getIdAttribute( ); 55 56 /** 57 * Set ID Attribute 58 * 59 * @param nIdAttribute 60 * ID Attribute 61 */ 62 void setIdAttribute( int nIdAttribute ); 63 64 /** 65 * Get Mandatory 66 * 67 * @return true if it's mandatory, false otherwise 68 */ 69 boolean isMandatory( ); 70 71 /** 72 * Set mandatory 73 * 74 * @param bMandatory 75 * true if it's mandatory, false otherwise 76 */ 77 void setMandatory( boolean bMandatory ); 78 79 /** 80 * Get list fields 81 * 82 * @return list fields 83 */ 84 List<AttributeField> getListAttributeFields( ); 85 86 /** 87 * Set list fields 88 * 89 * @param listAttributeFields 90 * list fields 91 */ 92 void setListAttributeFields( List<AttributeField> listAttributeFields ); 93 94 /** 95 * Get title 96 * 97 * @return title 98 */ 99 String getTitle( ); 100 101 /** 102 * Set title 103 * 104 * @param strTitle 105 * title 106 */ 107 void setTitle( String strTitle ); 108 109 /** 110 * Get help Message 111 * 112 * @return help message 113 */ 114 String getHelpMessage( ); 115 116 /** 117 * Set help message 118 * 119 * @param strHelpMessage 120 * help message 121 */ 122 void setHelpMessage( String strHelpMessage ); 123 124 /** 125 * Get position 126 * 127 * @return position 128 */ 129 int getPosition( ); 130 131 /** 132 * Set position 133 * 134 * @param nPosition 135 * position 136 */ 137 void setPosition( int nPosition ); 138 139 /** 140 * Get attribute type 141 * 142 * @return attribute type 143 */ 144 AttributeType getAttributeType( ); 145 146 /** 147 * Set attribute Type 148 * 149 * @param attributeType 150 * attribute type 151 */ 152 void setAttributeType( AttributeType attributeType ); 153 154 /** 155 * Get plugin 156 * 157 * @return plugin 158 */ 159 Plugin getPlugin( ); 160 161 /** 162 * Set plugin 163 * 164 * @param plugin 165 * plugin 166 */ 167 void setPlugin( Plugin plugin ); 168 169 /** 170 * Check if the attribute is shown in search 171 * 172 * @return true if it is, false otherwise 173 */ 174 boolean isShownInSearch( ); 175 176 /** 177 * Set isShownInSearch 178 * 179 * @param bIsShownInSearch 180 * shown in search 181 */ 182 void setShownInSearch( boolean bIsShownInSearch ); 183 184 /** 185 * Check if the attribute is shown in result list 186 * 187 * @return true if it is, false otherwise 188 */ 189 boolean isShownInResultList( ); 190 191 /** 192 * Set isShownInResultList 193 * 194 * @param bIsShownInResultList 195 * shown in result list 196 */ 197 void setShownInResultList( boolean bIsShownInResultList ); 198 199 /** 200 * Check if the attribute is to be shown in line 201 * 202 * @return true if it is shown in line, false otherwise 203 */ 204 boolean isFieldInLine( ); 205 206 /** 207 * Set isFieldInLine 208 * 209 * @param bIsFieldInLine 210 * shown in line 211 */ 212 void setFieldInLine( boolean bIsFieldInLine ); 213 214 /** 215 * Get the anonymize status of the attribute 216 * 217 * @return True if the attribute should be anonymize, false otherwise. 218 */ 219 boolean getAnonymize( ); 220 221 /** 222 * Set the anonymize status of the attribute 223 * 224 * @param bAnonymize 225 * New anonymize status. True if the attribute should be anonymize, false otherwise. 226 */ 227 void setAnonymize( boolean bAnonymize ); 228 229 /** 230 * Get the data of the user fields 231 * 232 * @param request 233 * HttpServletRequest 234 * @param user 235 * user 236 * @return user field data 237 */ 238 List<AdminUserField> getUserFieldsData( HttpServletRequest request, AdminUser user ); 239 240 /** 241 * Set attribute type 242 * 243 * @param locale 244 * locale 245 */ 246 void setAttributeType( Locale locale ); 247 248 /** 249 * Get page title for create page 250 * 251 * @return page title 252 */ 253 String getPropertyCreatePageTitle( ); 254 255 /** 256 * Get page title for modify page 257 * 258 * @return page title 259 */ 260 String getPropertyModifyPageTitle( ); 261 262 /** 263 * Get the template create an attribute 264 * 265 * @return The URL of the template 266 */ 267 String getTemplateCreateAttribute( ); 268 269 /** 270 * Get the template modify an attribute 271 * 272 * @return The URL of the template 273 */ 274 String getTemplateModifyAttribute( ); 275 276 /** 277 * Get the template html form attribute 278 * 279 * @return the template 280 */ 281 String getTemplateHtmlFormAttribute( ); 282 283 /** 284 * Get the template html form search attribute 285 * 286 * @return the template 287 */ 288 String getTemplateHtmlFormSearchAttribute( ); 289 290 /** 291 * Get the template html for the value of the attribute 292 * 293 * @return the template 294 */ 295 String getTemplateHtmlValue( ); 296 297 /** 298 * Set the data of the attribute 299 * 300 * @param request 301 * HttpServletRequest 302 * @return null if there are no errors 303 */ 304 String setAttributeData( HttpServletRequest request ); 305 306 /** 307 * Check if it is an attribute image 308 * 309 * @return true if it is, false otherwise 310 */ 311 boolean isAttributeImage( ); 312 313 /** 314 * Set the attribute as an attribute image 315 * 316 * @param bIsAttributeImage 317 * true if it is an image, false otherwise 318 */ 319 void setAttributeImage( boolean bIsAttributeImage ); 320 321 /** 322 * Get whether the attribute is anonymizable. 323 * 324 * @return True if the attribute can be anonymized, false otherwise. 325 */ 326 boolean isAnonymizable( ); 327 }