001 /* 002 * MakeReservationHandler.java 003 * 004 * Created on 3. huhtikuuta 2003, 20:06 005 */ 006 007 package kiurubeans; 008 009 /** This class is used as handler for makeReservation.jsp. It just encapsulates 010 * HTTP parameter parsing. 011 * @author jusmaki 012 */ 013 public class MakeReservationHandler { 014 015 /** Holds value of property space. */ 016 private int space = 0; 017 018 /** Holds value of property person. */ 019 private int person = 0; 020 021 /** Holds value of property calendarMode. */ 022 private boolean calendarMode = false; 023 024 /** Holds value of property showPartials. */ 025 private boolean showPartials = false; 026 027 /** Holds value of property eventID. */ 028 private String[] eventID = new String[0]; 029 030 /** Holds value of property organisation. */ 031 private int organisation = 0; 032 033 /** Holds value of property payOrganisation. */ 034 private int payOrganisation = 0; 035 036 /** Holds value of property requestState. */ 037 private int requestState = 1; 038 039 /** Holds value of property cPerson. */ 040 private int cPerson = 0; 041 042 /** Creates a new instance of MakeReservationHandler */ 043 public MakeReservationHandler() { 044 } 045 046 /** Getter for property space. 047 * @return Value of property space. 048 * 049 */ 050 public int getSpace() { 051 return this.space; 052 } 053 054 /** Setter for property space. 055 * @param space New value of property space. 056 * 057 */ 058 public void setSpace(int space) { 059 this.space = space; 060 } 061 062 /** Setter for property space. 063 * @param space New value of space as String 064 */ 065 public void setSpace(String space) { 066 try { 067 this.space = Integer.parseInt(space); 068 } 069 catch (NumberFormatException nfe) { 070 this.space = 0; 071 } 072 } 073 074 /** Getter for property person. 075 * @return Value of property person. 076 * 077 */ 078 public int getPerson() { 079 return this.person; 080 } 081 082 /** Setter for property person. 083 * @param person New value of property person. 084 */ 085 public void setPerson(int person) { 086 this.person = person; 087 } 088 089 /** Setter for property person. 090 * @param person New value of property person as String. 091 */ 092 public void setPerson(String person) { 093 try { 094 this.person = Integer.parseInt(person); 095 } 096 catch (NumberFormatException nfe) { 097 this.person = 0; 098 } 099 } 100 101 /** Getter for property calendarMode. 102 * @return Value of property calendarMode. 103 * 104 */ 105 public boolean isCalendarMode() { 106 return this.calendarMode; 107 } 108 109 /** Setter for property calendarMode. 110 * @param calendarMode New value of property calendarMode. 111 * 112 */ 113 public void setCalendarMode(boolean calendarMode) { 114 this.calendarMode = calendarMode; 115 } 116 117 /** Getter for property showPartials. 118 * @return Value of property showPartials. 119 * 120 */ 121 public boolean isShowPartials() { 122 return this.showPartials; 123 } 124 125 /** Setter for property showPartials. 126 * @param showPartials New value of property showPartials. 127 * 128 */ 129 public void setShowPartials(boolean showPartials) { 130 this.showPartials = showPartials; 131 } 132 133 /** Indexed getter for property eventID. 134 * @param index Index of the property. 135 * @return Value of the property at <CODE>index</CODE>. 136 * 137 */ 138 public String getEventID(int index) { 139 return this.eventID[index]; 140 } 141 142 /** Getter for property eventID. 143 * @return Value of property eventID. 144 * 145 */ 146 public String[] getEventID() { 147 return this.eventID; 148 } 149 150 /** Indexed setter for property eventID. 151 * @param index Index of the property. 152 * @param eventID New value of the property at <CODE>index</CODE>. 153 * 154 */ 155 public void setEventID(int index, String eventID) { 156 this.eventID[index] = eventID; 157 } 158 159 /** Setter for property eventID. 160 * @param eventID New value of property eventID. 161 * 162 */ 163 public void setEventID(String[] eventID) { 164 this.eventID = eventID; 165 } 166 167 /** Tells how many reservations are going to be made 168 * @return Length of array <CODE>eventID</CODE> 169 */ 170 public int getEventAmount() { 171 return this.eventID.length; 172 } 173 174 /** Getter for property organisation. 175 * @return Value of property organisation. 176 * 177 */ 178 public int getOrganisation() { 179 return this.organisation; 180 } 181 182 /** Setter for property organisation. 183 * @param organisation organisationID for organisation that is arranging the event. 184 * 185 */ 186 public void setOrganisation(int organisation) { 187 this.organisation = organisation; 188 } 189 190 /** Setter for property organisation. 191 * @param organisation organisationID for organisation that is arranging the event. 192 */ 193 public void setOrganisation(String organisation) { 194 try { 195 this.organisation = Integer.parseInt(organisation); 196 } 197 catch (NumberFormatException nfe) { 198 this.organisation = 0; 199 } 200 } 201 202 /** Getter for property payOrganisation. 203 * @return Value of property organisation. 204 * 205 */ 206 public int getPayOrganisation() { 207 return this.payOrganisation; 208 } 209 210 /** Setter for property payOrganisation. 211 * @param payOrganisation organisationID for the organisation that is paying the event. 212 */ 213 public void setPayOrganisation(int payOrganisation) { 214 this.payOrganisation = payOrganisation; 215 } 216 217 /** Setter for property organisation. 218 * @param payOrganisation organisationID for the organisation that is paying the event. 219 */ 220 public void setPayOrganisation(String payOrganisation) { 221 try { 222 this.payOrganisation = Integer.parseInt(payOrganisation); 223 } 224 catch (NumberFormatException nfe) { 225 this.payOrganisation = 0; 226 } 227 } 228 229 /** Getter for property requestState. 230 * @return Value of property requestState. 231 * 232 */ 233 public int getRequestState() { 234 return this.requestState; 235 } 236 237 /** Setter for property requestState. 238 * @param requestState New value of property requestState. 239 * 240 */ 241 public void setRequestState(int requestState) { 242 this.requestState = requestState; 243 System.out.println("cPerson on "+cPerson); 244 } 245 246 /** Getter for property cPerson. 247 * @return Value of property cPerson. 248 * 249 */ 250 public int getCPerson() { 251 return this.cPerson; 252 } 253 254 /** Setter for property cPerson. 255 * @param cPerson New value of property cPerson. 256 * 257 */ 258 public void setCPerson(int cPerson) { 259 this.cPerson = cPerson; 260 } 261 262 /** setter for property cPerson. 263 * @see #setCPerson(int) 264 * @param cPerson personID for the contact person of the reservation. 265 */ 266 public void setcPerson(int cPerson) { 267 this.cPerson = cPerson; 268 } 269 }