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