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.unittree.business.unit; 35 36 import org.apache.commons.lang.StringUtils; 37 38 /** 39 * 40 * UnitFilter 41 * 42 */ 43 public class UnitFilter 44 { 45 private int _nIdParent; 46 private String _strLabel; 47 private String _strDescription; 48 private boolean _bIsWideSearch; 49 50 /** 51 * Constructor 52 */ 53 public UnitFilter( ) 54 { 55 _nIdParent = Unit.ID_NULL; 56 _strLabel = StringUtils.EMPTY; 57 _strDescription = StringUtils.EMPTY; 58 _bIsWideSearch = false; 59 } 60 61 /** 62 * Get the label 63 * 64 * @return the label 65 */ 66 public String getLabel( ) 67 { 68 return _strLabel; 69 } 70 71 /** 72 * Set the label 73 * 74 * @param strLabel 75 * the label 76 */ 77 public void setLabel( String strLabel ) 78 { 79 this._strLabel = strLabel; 80 } 81 82 /** 83 * Check if the filter contains the label 84 * 85 * @return true if it contains, false otherwise 86 */ 87 public boolean containsLabel( ) 88 { 89 return StringUtils.isNotBlank( _strLabel ); 90 } 91 92 /** 93 * Get the description 94 * 95 * @return the description 96 */ 97 public String getDescription( ) 98 { 99 return _strDescription; 100 } 101 102 /** 103 * Set the description 104 * 105 * @param strDescription 106 * the description 107 */ 108 public void setDescription( String strDescription ) 109 { 110 this._strDescription = strDescription; 111 } 112 113 /** 114 * Check if the filter contains the description 115 * 116 * @return true if it contains, false otherwise 117 */ 118 public boolean containsDescription( ) 119 { 120 return StringUtils.isNotBlank( _strDescription ); 121 } 122 123 /** 124 * Get the id parent 125 * 126 * @return the id parent 127 */ 128 public int getIdParent( ) 129 { 130 return _nIdParent; 131 } 132 133 /** 134 * Set the id parent 135 * 136 * @param nIdParent 137 * the reference code 138 */ 139 public void setIdParent( int nIdParent ) 140 { 141 this._nIdParent = nIdParent; 142 } 143 144 /** 145 * Check if the filter contains the id parent 146 * 147 * @return true if the it contains, false otherwise 148 */ 149 public boolean containsIdParent( ) 150 { 151 return _nIdParent != -1; 152 } 153 154 /** 155 * Set true if the search is wide, false otherwise 156 * 157 * @param isWideSearch 158 * true if the search is wide, false otherwise 159 */ 160 public void setWideSearch( boolean isWideSearch ) 161 { 162 this._bIsWideSearch = isWideSearch; 163 } 164 165 /** 166 * Return true if the search is wide, false otherwise 167 * 168 * @return true if the search is wide, false otherwise 169 */ 170 public boolean isWideSearch( ) 171 { 172 return _bIsWideSearch; 173 } 174 }