1 6 package com.quikj.application.communicator.admin.controller; 7 8 import org.apache.struts.action.*; 9 import javax.servlet.http.HttpServletRequest ; 10 import java.text.SimpleDateFormat ; 11 12 import java.util.*; 13 14 18 public class LogSearchForm extends ActionForm { 19 20 21 private String startDate; 22 23 24 private String endDate; 25 26 27 private Object [] processNames; 28 29 30 31 private Date startSearch; 32 33 34 private Date endSearch; 35 36 37 private Object [] severityLevels; 38 39 40 private String messageText; 41 42 43 public LogSearchForm() { 44 reset(); 45 } 46 47 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) 48 { 49 ActionErrors errors = new ActionErrors(); 50 51 Date date = DateUtility.processInputDate(startDate); 52 if (date == null) 53 { 54 errors.add("startDate", new ActionError("error.date.invalid", "start")); 55 } 56 else 57 { 58 startSearch = date; 59 } 60 61 date = DateUtility.processInputDate(endDate, 23, 59, 59); 62 if (date == null) 63 { 64 errors.add("endDate", new ActionError("error.date.invalid", "end")); 65 } 66 else 67 { 68 endSearch = date; 69 } 70 71 72 return errors; 73 } 74 75 public void reset() 76 { 77 Calendar cal = Calendar.getInstance(); 78 SimpleDateFormat formatter = new SimpleDateFormat ("MM/dd/yyyy"); 79 80 endDate = formatter.format(cal.getTime()); 81 82 cal.add(Calendar.DAY_OF_MONTH, -1); 83 84 startDate = formatter.format(cal.getTime()); 85 86 startSearch = null; 87 endSearch = null; 88 processNames = null; 89 severityLevels = null; 90 messageText = null; 91 } 92 93 97 public String getStartDate() { 98 return this.startDate; 99 } 100 101 105 public void setStartDate(String startDate) { 106 this.startDate = startDate; 107 } 108 109 113 public String getEndDate() { 114 return this.endDate; 115 } 116 117 121 public void setEndDate(String endDate) { 122 this.endDate = endDate; 123 } 124 125 129 public Object [] getProcessNames() 130 { 131 return this.processNames; 132 } 133 134 138 public void setProcessNames(Object [] processNames) 139 { 140 this.processNames = processNames; 141 } 142 143 147 public Date getStartSearch() 148 { 149 return this.startSearch; 150 } 151 152 156 public void setStartSearch(Date startSearch) 157 { 158 this.startSearch = startSearch; 159 } 160 161 165 public Date getEndSearch() 166 { 167 return this.endSearch; 168 } 169 170 174 public void setEndSearch(Date endSearch) 175 { 176 this.endSearch = endSearch; 177 } 178 179 183 public Object [] getSeverityLevels() 184 { 185 return this.severityLevels; 186 } 187 188 192 public void setSeverityLevels(Object [] severityLevels) 193 { 194 this.severityLevels = severityLevels; 195 } 196 197 201 public String getMessageText() 202 { 203 return this.messageText; 204 } 205 206 210 public void setMessageText(String messageText) 211 { 212 this.messageText = messageText.trim(); 213 } 214 215 } 216 | Popular Tags |