Example #1
0
 private long getStartTime(Query request, String context) throws BeanValidationException {
   if (request.getStartAbsolute() != null) {
     return request.getStartAbsolute();
   } else if (request.getStartRelative() != null) {
     return request.getStartRelative().getTimeRelativeTo(System.currentTimeMillis());
   } else {
     throw new BeanValidationException(
         new SimpleConstraintViolation("start_time", "relative or absolute time must be set"),
         context);
   }
 }
Example #2
0
 private long getEndTime(Query request) {
   if (request.getEndAbsolute() != null) return request.getEndAbsolute();
   else if (request.getEndRelative() != null)
     return request.getEndRelative().getTimeRelativeTo(System.currentTimeMillis());
   return -1;
 }