/** Get the end date as a date. */ public Date getEndDateAsDate() { try { return Utilities.getDateFormat(null).parse(this.endDate); } catch (ParseException e) { return null; } }
/** Validate the dates. */ public List<ValidationError> validate() { List<ValidationError> errors = new ArrayList<>(); try { if (Utilities.getDateFormat(null) .parse(this.startDate) .after(Utilities.getDateFormat(null).parse(this.endDate))) { // the end date should be after the start date errors.add( new ValidationError( "endDate", Messages.get("object.data_syndication_agreement.end_date.invalid"))); } } catch (Exception e) { Logger.warn("impossible to validate the dates"); } return errors.isEmpty() ? null : errors; }