List of usage examples for java.sql Time after
public boolean after(Date when)
From source file:org.sakaiproject.tool.section.jsf.backingbean.AddSectionsBean.java
/** * As part of the crutch for JSF's inability to do validation on relative * values in different components, this method checks whether two times, as * expressed by string start and end times and booleans indicating am/pm, * express times where the end time proceeds a start time. * /*from ww w. j ava2 s . c o m*/ * @param meeting * @return */ public static boolean isEndTimeBeforeStartTime(LocalMeetingModel meeting) { String startTime = null; if (!meeting.isStartTimeDefault()) { startTime = meeting.getStartTimeString(); } String endTime = null; if (!meeting.isEndTimeDefault()) { endTime = meeting.getEndTimeString(); } boolean startTimeAm = meeting.isStartTimeAm(); boolean endTimeAm = meeting.isEndTimeAm(); if (StringUtils.trimToNull(startTime) != null && StringUtils.trimToNull(endTime) != null) { Time start = JsfUtil.convertStringToTime(startTime, startTimeAm); Time end = JsfUtil.convertStringToTime(endTime, endTimeAm); if (start.after(end)) { if (log.isDebugEnabled()) log.debug("You can not set an end time earlier than the start time."); return true; } } if (StringUtils.trimToNull(startTime) != null && StringUtils.trimToNull(endTime) != null) { Time start = JsfUtil.convertStringToTime(startTime, startTimeAm); Time end = JsfUtil.convertStringToTime(endTime, endTimeAm); if (start.equals(end)) { if (log.isDebugEnabled()) log.debug("You can not set an end time that same as start time."); return true; } } return false; }