1 package com.dotmarketing.portlets.events.struts; 2 3 import java.text.ParseException ; 4 import java.text.SimpleDateFormat ; 5 import java.util.ArrayList ; 6 import java.util.StringTokenizer ; 7 8 import javax.servlet.http.HttpServletRequest ; 9 10 import org.apache.commons.lang.builder.EqualsBuilder; 11 import org.apache.commons.lang.builder.HashCodeBuilder; 12 import org.apache.commons.lang.builder.ToStringBuilder; 13 import org.apache.struts.action.ActionErrors; 14 import org.apache.struts.action.ActionMapping; 15 import org.apache.struts.validator.ValidatorForm; 16 17 import com.dotmarketing.beans.Inode; 18 import com.dotmarketing.portlets.categories.model.Category; 19 import com.dotmarketing.util.UtilMethods; 20 21 22 23 public class EventForm extends ValidatorForm { 24 25 private String address1; 26 private String address2; 27 private String address3; 28 private String city; 29 private String contactCompany; 30 private String contactEmail; 31 private String contactFax; 32 private String contactName; 33 private String contactPhone; 34 private String country; 35 private String description; 36 private String directions; 37 private String dispatch; 38 private String email; 39 private String emailResponse; 40 private String fax; 41 private String includeFile; 42 private String location; 43 private String phone; 44 private String state; 45 private String title; 46 private String subtitle; 47 private String url; 48 private String zip; 49 private String [] categories; 50 private String [] filesInodes; 51 private boolean registration; 52 private boolean showPublic; 53 private long inode; 54 private String webAddress; 55 private java.util.Date startDate; 56 private java.util.Date endDate; 57 private java.util.Date setupDate; 59 private java.util.Date breakDate; 61 private String commentsEquipment; 62 private boolean receivedAdminApproval; 63 private boolean timeTBD; 64 private long facilityInode; 65 private int approvalStatus; 66 67 public EventForm() {} 68 69 public void setAddress1(java.lang.String address1) { 70 this.address1 = address1; 71 } 72 73 public java.lang.String getAddress1() { 74 return this.address1; 75 } 76 77 public void setAddress2(java.lang.String address2) { 78 this.address2 = address2; 79 } 80 81 public java.lang.String getAddress2() { 82 return this.address2; 83 } 84 85 public void setAddress3(java.lang.String address3) { 86 this.address3 = address3; 87 } 88 89 public java.lang.String getAddress3() { 90 return this.address3; 91 } 92 93 97 public void setCategories(String [] categories) { 98 ArrayList list = new ArrayList (); 99 for (int i = 0; i < categories.length; i++) { 100 String cat = categories[i]; 101 if (!cat.trim().equals("")) { 102 list.add(cat); 103 } 104 } 105 if (list.size() == 0) 106 this.categories = null; 107 else 108 this.categories = (String [])list.toArray(new String [0]); 109 } 110 111 public void setCategories(java.util.List al) { 112 if (al != null) { 113 String [] x = new String [al.size()]; 114 java.util.Iterator i = al.iterator(); 115 int n = 0; 116 117 while (i.hasNext()) { 118 Category cat = (Category) i.next(); 119 x[n++] = Long.toString(cat.getInode()); 120 } 121 122 setCategories(x); 123 } 124 } 125 126 130 public String [] getCategories() { 131 return categories; 132 } 133 134 public void setCity(java.lang.String city) { 135 this.city = city; 136 } 137 138 public java.lang.String getCity() { 139 return this.city; 140 } 141 142 public void setContactCompany(java.lang.String contactCompany) { 143 this.contactCompany = contactCompany; 144 } 145 146 public java.lang.String getContactCompany() { 147 return this.contactCompany; 148 } 149 150 public void setContactEmail(java.lang.String contactEmail) { 151 this.contactEmail = contactEmail; 152 } 153 154 public java.lang.String getContactEmail() { 155 return this.contactEmail; 156 } 157 158 public void setContactFax(java.lang.String contactFax) { 159 this.contactFax = contactFax; 160 } 161 162 public java.lang.String getContactFax() { 163 return this.contactFax; 164 } 165 166 public void setContactName(java.lang.String contactName) { 167 this.contactName = contactName; 168 } 169 170 public java.lang.String getContactName() { 171 return this.contactName; 172 } 173 174 public void setContactPhone(java.lang.String contactPhone) { 175 this.contactPhone = contactPhone; 176 } 177 178 public java.lang.String getContactPhone() { 179 return this.contactPhone; 180 } 181 182 public void setCountry(java.lang.String country) { 183 this.country = country; 184 } 185 186 public java.lang.String getCountry() { 187 return this.country; 188 } 189 190 public void setDescription(java.lang.String description) { 191 this.description = description; 193 } 194 195 public java.lang.String getDescription() { 196 return this.description; 197 } 198 199 public void setDirections(java.lang.String directions) { 200 this.directions = directions; 201 } 202 203 public java.lang.String getDirections() { 204 return this.directions; 205 } 206 207 211 public void setDispatch(String dispatch) { 212 this.dispatch = dispatch; 213 } 214 215 219 public String getDispatch() { 220 return dispatch; 221 } 222 223 public void setEmail(java.lang.String email) { 224 this.email = email; 225 } 226 227 public java.lang.String getEmail() { 228 return this.email; 229 } 230 231 public void setEmailResponse(java.lang.String emailResponse) { 232 this.emailResponse = emailResponse; 233 } 234 235 public java.lang.String getEmailResponse() { 236 return this.emailResponse; 237 } 238 239 243 public void setEndDateString(String endDateString) { 244 if (endDateString.equals("")) 245 return; 246 try { 247 this.endDate = new SimpleDateFormat ("MM/dd/yyyy HH:mm").parse(endDateString); 248 } catch(ParseException ex) { 249 ex.printStackTrace(); 251 } 252 } 253 254 258 public String getEndDateString() { 259 return UtilMethods.dateToHTMLDate(endDate) + " " + UtilMethods.dateToHTMLTime(endDate); 260 } 261 262 public java.util.Date getEndDate () { 263 return this.endDate; 264 } 265 266 269 public java.util.Date getStartDate() { 270 return startDate; 271 } 272 275 public void setStartDate(java.util.Date startDate) { 276 this.startDate = startDate; 277 } 278 281 public void setEndDate(java.util.Date endDate) { 282 this.endDate = endDate; 283 } 284 285 public void setFax(java.lang.String fax) { 286 this.fax = fax; 287 } 288 289 public java.lang.String getFax() { 290 return this.fax; 291 } 292 293 public void setIncludeFile(java.lang.String includeFile) { 294 this.includeFile = includeFile; 295 } 296 297 public java.lang.String getIncludeFile() { 298 return this.includeFile; 299 } 300 301 public void setInode(long inode) { 302 this.inode = inode; 303 } 304 305 public long getInode() { 306 return this.inode; 307 } 308 309 public void setLocation(java.lang.String location) { 310 this.location = location; 311 } 312 313 public java.lang.String getLocation() { 314 return this.location; 315 } 316 317 public void setPhone(java.lang.String phone) { 318 this.phone = phone; 319 } 320 321 public java.lang.String getPhone() { 322 return this.phone; 323 } 324 325 329 public void setRegistration(boolean registration) { 330 this.registration = registration; 331 } 332 333 public boolean getRegistration() { 334 return this.registration; 335 } 336 337 341 public boolean isRegistration() { 342 return registration; 343 } 344 345 349 public void setShowPublic(boolean showPublic) { 350 this.showPublic = showPublic; 351 } 352 353 357 public boolean isShowPublic() { 358 return showPublic; 359 } 360 361 365 public void setStartDateString(String startDateString) { 366 if (startDateString.equals("")) 367 return; 368 try { 369 this.startDate = new SimpleDateFormat ("MM/dd/yyyy HH:mm").parse(startDateString); 370 } catch(ParseException ex) { 371 ex.printStackTrace(); 373 } 374 } 375 376 380 public String getStartDateString() { 381 return UtilMethods.dateToHTMLDate(startDate) + " " + UtilMethods.dateToHTMLTime(startDate); 382 } 383 384 public void setState(java.lang.String state) { 385 this.state = state; 386 } 387 388 public java.lang.String getState() { 389 return this.state; 390 } 391 392 public void setTitle(java.lang.String title) { 393 this.title = title; 395 } 396 397 public java.lang.String getTitle() { 398 return this.title; 399 } 400 401 public void setUrl(java.lang.String url) { 402 this.url = url; 403 } 404 405 public java.lang.String getUrl() { 406 return this.url; 407 } 408 409 public void setZip(java.lang.String zip) { 410 this.zip = zip; 411 } 412 413 public java.lang.String getZip() { 414 return this.zip; 415 } 416 417 public boolean equals(Object other) { 418 if (!(other instanceof EventForm)) { 419 return false; 420 } 421 422 EventForm castOther = (EventForm) other; 423 424 return new EqualsBuilder().append(this.getInode(), castOther.getInode()).isEquals(); 425 } 426 427 public int hashCode() { 428 return new HashCodeBuilder().append(getInode()).toHashCode(); 429 } 430 431 public void reset() { 432 this.categories = new String [0]; 433 this.filesInodes = new String [0]; 434 } 435 436 public String toString() { 437 return new ToStringBuilder(this).append("inode", getInode()).toString(); 438 } 439 440 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { 441 if ("save".equals(dispatch)) { 442 return super.validate(mapping, request); 443 } 444 445 return null; 446 } 447 451 public String getWebAddress() { 452 return webAddress; 453 } 454 455 459 public void setWebAddress(String webAddress) { 460 this.webAddress = webAddress; 461 } 462 465 public String getSubtitle() { 466 return subtitle; 467 } 468 471 public void setSubtitle(String subtitle) { 472 this.subtitle = subtitle; 473 } 474 477 public String [] getFilesInodes() { 478 return filesInodes; 479 } 480 481 484 public void setFilesInodes(String [] filesInodes) { 485 ArrayList list = new ArrayList (); 486 if (filesInodes != null) { 487 for (int i = 0; i < filesInodes.length; i++) { 488 StringTokenizer tok = new StringTokenizer (filesInodes[i],","); 489 while (tok.hasMoreTokens()) { 490 String inode = tok.nextToken(); 491 if (!inode.trim().equals("")) { 492 list.add(inode); 493 } 494 } 495 } 496 } 497 if (list.size() == 0) 498 this.filesInodes = new String [0]; 499 else 500 this.filesInodes = (String [])list.toArray(new String [0]); 501 } 502 503 public void setFilesInodes(java.util.List filesInodesList) { 504 if (filesInodesList != null) { 505 ArrayList inodeList = new ArrayList (); 506 java.util.Iterator i = filesInodesList.iterator(); 507 int n = 0; 508 while (i.hasNext()) { 509 Inode in = (Inode) i.next(); 510 inodeList.add(Long.toString(in.getInode())); 511 } 512 513 setFilesInodes ((String [])inodeList.toArray(new String [0])); 514 } 515 } 516 517 public java.util.Date getBreakDate() { 518 return breakDate; 519 } 520 public void setBreakDate(java.util.Date breakDate) { 521 this.breakDate = breakDate; 522 } 523 public String getBreakDateString() { 524 return UtilMethods.dateToHTMLDate(breakDate) + " " + UtilMethods.dateToHTMLTime(breakDate); 525 } 526 public void setBreakDateString(String breakDateString) { 527 if (breakDateString.equals("")) 528 return; 529 try { 530 this.breakDate = new SimpleDateFormat ("MM/dd/yyyy HH:mm").parse(breakDateString); 531 } catch(ParseException ex) { 532 ex.printStackTrace(); 534 } 535 } 536 public String getCommentsEquipment() { 537 return commentsEquipment; 538 } 539 public void setCommentsEquipment(String commentsEquipment) { 540 this.commentsEquipment = commentsEquipment; 541 } 542 public boolean isReceivedAdminApproval() { 543 return receivedAdminApproval; 544 } 545 public void setReceivedAdminApproval(boolean receivedAdminApproval) { 546 this.receivedAdminApproval = receivedAdminApproval; 547 } 548 public java.util.Date getSetupDate() { 549 return setupDate; 550 } 551 public void setSetupDate(java.util.Date setupDate) { 552 this.setupDate = setupDate; 553 } 554 public String getSetupDateString() { 555 return UtilMethods.dateToHTMLDate(setupDate) + " " + UtilMethods.dateToHTMLTime(setupDate); 556 } 557 public void setSetupDateString(String setupDateString) { 558 if (setupDateString.equals("")) 559 return; 560 try { 561 this.setupDate = new SimpleDateFormat ("MM/dd/yyyy HH:mm").parse(setupDateString); 562 } catch(ParseException ex) { 563 ex.printStackTrace(); 565 } 566 } 567 public long getFacilityInode() { 568 return facilityInode; 569 } 570 public void setFacilityInode(long facilityInode) { 571 this.facilityInode = facilityInode; 572 } 573 public int getApprovalStatus() { 574 return approvalStatus; 575 } 576 public void setApprovalStatus(int approvalStatus) { 577 this.approvalStatus = approvalStatus; 578 } 579 public boolean isTimeTBD() { 580 return timeTBD; 581 } 582 public void setTimeTBD(boolean timeTBD) { 583 this.timeTBD = timeTBD; 584 } 585 } 586 | Popular Tags |