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.portlet; 35 36 import fr.paris.lutece.portal.service.i18n.I18nService; 37 import fr.paris.lutece.portal.service.i18n.Localizable; 38 import fr.paris.lutece.portal.service.rbac.RBACResource; 39 40 import java.util.Locale; 41 42 43 /** 44 * This class represents business objects PortletType 45 */ 46 public class PortletType implements RBACResource, Localizable 47 { 48 ///////////////////////////////////////////////////////////////////////////////// 49 // Constants 50 public static final String RESOURCE_TYPE = "PORTLET_TYPE"; 51 private static final String EMPTY_STRING = ""; 52 private String _strId; 53 private String _strNameKey; 54 private String _strUrlCreation; 55 private String _strUrlUpdate; 56 private String _strHomeClass; 57 private String _strPluginName; 58 private String _strDoCreateUrl; 59 private String _strCreateScriptTemplate; 60 private String _strCreateSpecificTemplate; 61 private String _strCreateSpecificFormTemplate; 62 private String _strDoModifyUrl; 63 private String _strModifyScriptTemplate; 64 private String _strModifySpecificTemplate; 65 private String _strModifySpecificFormTemplate; 66 private Locale _locale; 67 68 /** 69 * Returns the identifier of the Portlet type 70 * 71 * @return the Portlet Type identifier 72 */ 73 public String getId( ) 74 { 75 return _strId; 76 } 77 78 /** 79 * Sets the identifier of the portlet type 80 * 81 * @param strId the Portlet Type identifier 82 */ 83 public void setId( String strId ) 84 { 85 _strId = ( strId == null ) ? EMPTY_STRING : strId; 86 } 87 88 /** 89 * Sets the name key of the Portlet Type 90 * 91 * @param strNameKey the Portlet type Name key 92 */ 93 public void setNameKey( String strNameKey ) 94 { 95 _strNameKey = strNameKey; 96 } 97 98 /** 99 * Returns the name key of the Portlet Type 100 * 101 * @return the Portlet type name key 102 */ 103 public String getNameKey( ) 104 { 105 return _strNameKey; 106 } 107 108 /** 109 * Returns the name of the Portlet Type 110 * 111 * @return the Portlet type name 112 */ 113 public String getName( ) 114 { 115 return I18nService.getLocalizedString( _strNameKey, _locale ); 116 } 117 118 /** 119 * Sets the url of the program which manages the creation of this portlet type 120 * 121 * @param strUrlCreation the url to create the current portlet type 122 */ 123 public void setUrlCreation( String strUrlCreation ) 124 { 125 _strUrlCreation = strUrlCreation; 126 } 127 128 /** 129 * Returns the url of the program which manages the creation of this portlet type 130 * 131 * @return the url of creation 132 */ 133 public String getUrlCreation( ) 134 { 135 return _strUrlCreation; 136 } 137 138 /** 139 * Sets the url of the program which manages the update of this portlet type 140 * 141 * @param strUrlUpdate the url to update the current portlet type 142 */ 143 public void setUrlUpdate( String strUrlUpdate ) 144 { 145 _strUrlUpdate = strUrlUpdate; 146 } 147 148 /** 149 * Returns the url of the program which manages the update of this portlet type 150 * 151 * @return the url of update 152 */ 153 public String getUrlUpdate( ) 154 { 155 return _strUrlUpdate; 156 } 157 158 /** 159 * Sets the home class path of the program which manages the update of this portlet type 160 * 161 * @param strHomeClass the path to update the current portlet type 162 */ 163 public void setHomeClass( String strHomeClass ) 164 { 165 _strHomeClass = strHomeClass; 166 } 167 168 /** 169 * Returns the path of the home class which manages the update of this portlet type 170 * 171 * @return the home class path of update 172 */ 173 public String getHomeClass( ) 174 { 175 return _strHomeClass; 176 } 177 178 /** 179 * Sets the plugin name of the Portlet Type 180 * 181 * @param strPluginName the Portlet type Plugin Name 182 */ 183 public void setPluginName( String strPluginName ) 184 { 185 _strPluginName = strPluginName; 186 } 187 188 /** 189 * Returns the plugin name of the Portlet Type 190 * 191 * @return the Portlet type plugin name 192 */ 193 public String getPluginName( ) 194 { 195 return _strPluginName; 196 } 197 198 //////////////////////////////////////////////////////////////////////////// 199 // RBAC Resource implementation 200 201 /** 202 * Returns the Resource Type Code that identify the resource type 203 * @return The Resource Type Code 204 */ 205 public String getResourceTypeCode( ) 206 { 207 return RESOURCE_TYPE; 208 } 209 210 /** 211 * Returns the resource Id of the current object 212 * @return The resource Id of the current object 213 */ 214 public String getResourceId( ) 215 { 216 return "" + getId( ); 217 } 218 219 /** 220 * Return the DoCreate Url 221 * @return The DoCreate Url 222 */ 223 public String getDoCreateUrl( ) 224 { 225 return _strDoCreateUrl; 226 } 227 228 /** 229 * Sets the DoCreate Url 230 * @param strDoCreateUrl The DoCreate Url 231 */ 232 public void setDoCreateUrl( String strDoCreateUrl ) 233 { 234 _strDoCreateUrl = strDoCreateUrl; 235 } 236 237 /** 238 * Sets the CreateScript 239 * @param strCreateScript The CreateScript 240 */ 241 public void setCreateScriptTemplate( String strCreateScript ) 242 { 243 _strCreateScriptTemplate = strCreateScript; 244 } 245 246 /** 247 * Sets the CreateSpecific 248 * @param strCreateSpecific The CreateSpecific 249 */ 250 public void setCreateSpecificTemplate( String strCreateSpecific ) 251 { 252 _strCreateSpecificTemplate = strCreateSpecific; 253 } 254 255 /** 256 * Sets the CreateSpecificForm 257 * @param strCreateSpecificForm The CreateSpecificForm 258 */ 259 public void setCreateSpecificFormTemplate( String strCreateSpecificForm ) 260 { 261 _strCreateSpecificFormTemplate = strCreateSpecificForm; 262 } 263 264 /** 265 * Return a script to include in the create form 266 * @return the script to include in the create form 267 */ 268 public String getCreateScriptTemplate( ) 269 { 270 return _strCreateScriptTemplate; 271 } 272 273 /** 274 * Return html code to include in the create form 275 * @return html code to include in the create form 276 */ 277 public String getCreateSpecificTemplate( ) 278 { 279 return _strCreateSpecificTemplate; 280 } 281 282 /** 283 * Return html code to add another form to the create page 284 * @return html code to add another form to the create page 285 */ 286 public String getCreateSpecificFormTemplate( ) 287 { 288 return _strCreateSpecificFormTemplate; 289 } 290 291 /** 292 * Return the Modify Url 293 * @return The Modify Url 294 */ 295 public String getDoModifyUrl( ) 296 { 297 return _strDoModifyUrl; 298 } 299 300 /** 301 * Return a script to include in the modify form 302 * @return the script to include in the modify form 303 */ 304 public String getModifyScriptTemplate( ) 305 { 306 return _strModifyScriptTemplate; 307 } 308 309 /** 310 * Return html code to include in the modify form 311 * @return html code to include in the modify form 312 */ 313 public String getModifySpecificTemplate( ) 314 { 315 return _strModifySpecificTemplate; 316 } 317 318 /** 319 * Return html code to add another form to the modify page 320 * @return html code to add another form to the modify page 321 */ 322 public String getModifySpecificFormTemplate( ) 323 { 324 return _strModifySpecificFormTemplate; 325 } 326 327 /** 328 * Sets the DoModify Url 329 * @param strDoModifyUrl The DoModify Url 330 */ 331 public void setDoModifyUrl( String strDoModifyUrl ) 332 { 333 _strDoModifyUrl = strDoModifyUrl; 334 } 335 336 /** 337 * Sets the ModifyScript 338 * @param strModifyScript The ModifyScript 339 */ 340 public void setModifyScriptTemplate( String strModifyScript ) 341 { 342 _strModifyScriptTemplate = strModifyScript; 343 } 344 345 /** 346 * Sets the ModifySpecific 347 * @param strModifySpecific The ModifySpecific 348 */ 349 public void setModifySpecificTemplate( String strModifySpecific ) 350 { 351 _strModifySpecificTemplate = strModifySpecific; 352 } 353 354 /** 355 * Sets the ModifySpecificForm 356 * @param strModifySpecificForm The ModifySpecificForm 357 */ 358 public void setModifySpecificFormTemplate( String strModifySpecificForm ) 359 { 360 _strModifySpecificFormTemplate = strModifySpecificForm; 361 } 362 363 /** 364 * Implements Localizable 365 * @param locale The current locale 366 */ 367 public void setLocale( Locale locale ) 368 { 369 _locale = locale; 370 } 371 }