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.plugins.calendar.business; 35 36 /** 37 * Filter for calendar 38 */ 39 public class CalendarFilter 40 { 41 private static final int ALL_INT = -1; 42 43 // Variables declarations 44 private int _nIdCalendar = ALL_INT; 45 private int _nSortEvents = ALL_INT; 46 private int[] _arrayCategoriesId; 47 private int[] _arrayId; 48 private int[] _arrayCalendarId; 49 50 /** 51 * @return the calendar id 52 */ 53 public int getIdCalendar( ) 54 { 55 return _nIdCalendar; 56 } 57 58 /** 59 * @param idCalendar the _nIdCalendar to set 60 */ 61 public void setIdCalendar( int idCalendar ) 62 { 63 _nIdCalendar = idCalendar; 64 } 65 66 /** 67 * @return the _nSortEvents 68 */ 69 public int getSortEvents( ) 70 { 71 return _nSortEvents; 72 } 73 74 /** 75 * @param sortEvents the _nSortEvents to set 76 */ 77 public void setSortEvents( int sortEvents ) 78 { 79 _nSortEvents = sortEvents; 80 } 81 82 /** 83 * @return the _arrayCategoriesId 84 */ 85 public int[] getCategoriesId( ) 86 { 87 return _arrayCategoriesId; 88 } 89 90 /** 91 * @param arrayCategoriesId the _arrayCategoriesId to set 92 */ 93 public void setCategoriesId( int[] arrayCategoriesId ) 94 { 95 _arrayCategoriesId = arrayCategoriesId; 96 } 97 98 /** 99 * @return the _arrayId 100 */ 101 public int[] getIds( ) 102 { 103 return _arrayId; 104 } 105 106 /** 107 * @param arrayId the _arrayId to set 108 */ 109 public void setIds( int[] arrayId ) 110 { 111 _arrayId = arrayId; 112 } 113 114 /** 115 * @return the _arrayId 116 */ 117 public int[] getCalendarIds( ) 118 { 119 return _arrayCalendarId; 120 } 121 122 /** 123 * @param calendarId the _arrayId to set 124 */ 125 public void setCalendarIds( int[] calendarId ) 126 { 127 _arrayCalendarId = calendarId; 128 } 129 130 /** 131 * Tell if the filter contains a criteria on the Category 132 * @return True if the filter contains a criteria on the categories 133 * otherwise false 134 */ 135 public boolean containsCategoriesCriteria( ) 136 { 137 return ( ( _arrayCategoriesId != null ) && ( _arrayCategoriesId.length != 0 ) ); 138 } 139 140 /** 141 * Tell if the filter contains a criteria on the Id 142 * @return True if the filter contains a criteria on the Ids otherwise false 143 */ 144 public boolean containsIdsCriteria( ) 145 { 146 return ( ( _arrayId != null ) && ( _arrayId.length != 0 ) ); 147 } 148 149 /** 150 * Tell if the filter contains a criteria on the calendar Ids 151 * @return True if the filter contains a criteria on the calendar Ids 152 * otherwise false 153 */ 154 public boolean containsCalendarIdsCriteria( ) 155 { 156 return ( ( _arrayCalendarId != null ) && ( _arrayCalendarId.length != 0 ) ); 157 } 158 159 /** 160 * Tell if the filter contains a criteria on the calendars 161 * @return True if the filter contains a criteria on the calendars otherwise 162 * false 163 */ 164 public boolean containsCalendarCriteria( ) 165 { 166 return ( _nIdCalendar != ALL_INT ); 167 } 168 169 /** 170 * Tell if the filter contains a criteria on the calendars 171 * @return True if the filter contains a criteria on the calendars otherwise 172 * false 173 */ 174 public boolean containsSortCriteria( ) 175 { 176 return ( _nSortEvents != ALL_INT ); 177 } 178 }