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.plugins.genericattributes.business; 35 36 import fr.paris.lutece.util.ErrorMessage; 37 38 import java.io.Serializable; 39 40 /** 41 * class GenericAttributeError 42 */ 43 public class GenericAttributeError implements Serializable, ErrorMessage 44 { 45 private static final long serialVersionUID = -7407796611197325735L; 46 private String _strTitleQuestion; 47 private String _strErrorMessage; 48 private boolean _bMandatoryError; 49 private String _strUrl; 50 private boolean _bDisplayableError = true; 51 52 /** 53 * return true if the error is a mandatory error 54 * 55 * @return true if the error is a mandatory error 56 */ 57 public boolean isMandatoryError( ) 58 { 59 return _bMandatoryError; 60 } 61 62 /** 63 * set true if the error is a mandatory error 64 * 65 * @param mandatoryError 66 * true if the error is a mandatory error 67 */ 68 public void setMandatoryError( boolean mandatoryError ) 69 { 70 _bMandatoryError = mandatoryError; 71 } 72 73 /** 74 * Gets the error Message 75 * 76 * @return the error Message 77 */ 78 public String getErrorMessage( ) 79 { 80 return _strErrorMessage; 81 } 82 83 /** 84 * set the error message 85 * 86 * @param errorMessage 87 * the error message 88 */ 89 public void setErrorMessage( String errorMessage ) 90 { 91 _strErrorMessage = errorMessage; 92 } 93 94 /** 95 * 96 * @return the title of the mandatory question 97 */ 98 public String getTitleQuestion( ) 99 { 100 return _strTitleQuestion; 101 } 102 103 /** 104 * set the title of the mandatory question 105 * 106 * @param titleMandatoryQuestion 107 * the title of the mandatory question 108 */ 109 public void setTitleQuestion( String titleMandatoryQuestion ) 110 { 111 _strTitleQuestion = titleMandatoryQuestion; 112 } 113 114 /** 115 * @param strUrl 116 * the _strUrl to set 117 */ 118 public void setUrl( String strUrl ) 119 { 120 this._strUrl = strUrl; 121 } 122 123 /** 124 * @return the _strUrl 125 */ 126 public String getUrl( ) 127 { 128 return _strUrl; 129 } 130 131 /** 132 * {@inheritDoc} 133 */ 134 @Override 135 public String getMessage( ) 136 { 137 return getErrorMessage( ); 138 } 139 140 /** 141 * Check if the error is a displayable error. Non displayable errors should not be displayed in any manners to users. 142 * 143 * @return True if the error is a displayable error, false otherwise 144 */ 145 public boolean getIsDisplayableError( ) 146 { 147 return _bDisplayableError; 148 } 149 150 /** 151 * Set the error as displayable or not. Non displayable errors should not be displayed in any manners to users. 152 * 153 * @param bDisplayableError 154 * True if the error is a displayable error, false otherwise 155 */ 156 public void setIsDisplayableError( boolean bDisplayableError ) 157 { 158 _bDisplayableError = bDisplayableError; 159 } 160 161 @Override 162 public String getFieldName( ) 163 { 164 // TODO Auto-generated method stub 165 return null; 166 } 167 }