Example #1
0
  public HashMap<String, String> validate() {
    HashMap<String, String> errors = new HashMap<String, String>();
    if ("".equals(this.carPlate) || this.carPlate == null) {
      errors.put("Car Plate", "should not be empty");
    }
    if ("".equals(this.referenceCode) || this.referenceCode == null) {
      errors.put("Reference Code", "should not be empty");
    }
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    try {

      if (Utility.dateDifference(df.parse(this.startDatetime), df.parse(this.endDateTime)) < 0) {
        errors.put("Start and End Date", "should not be Conflicting");
      }
    } catch (Exception e) {
      errors.put("Start and End Date", "should be valid date");
    }
    if (this.customerid <= 0) {
      errors.put("Customer ID", "should not be Null/Empty");
    }
    return errors;
  }