@Search() public List<Patient> searchByObservationNames( @RequiredParam(name=Patient.SP_BIRTHDATE) DateParam theDate ) { ParamPrefixEnum prefix = theDate.getPrefix(); // e.g. gt, le, etc.. Date date = theDate.getValue(); // e.g. 2011-01-02 TemporalPrecisionEnum precision = theDate.getPrecision(); // e.g. DAY List<Patient> retVal = new ArrayList<Patient>(); // ...populate... return retVal; } //END SNIPPET: dates
if (myUpperBound.getPrecision().ordinal() <= TemporalPrecisionEnum.DAY.ordinal()) { Calendar cal = DateUtils.toCalendar(retVal); cal.setTimeZone(TimeZone.getTimeZone("GMT+11:30")); case EQUAL: case LESSTHAN_OR_EQUALS: retVal = myUpperBound.getPrecision().add(retVal, 1); retVal = new Date(retVal.getTime() - 1L); break;
public Date getLowerBoundAsInstant() { if (myLowerBound == null || myLowerBound.getValue() == null) { return null; } Date retVal = myLowerBound.getValue(); if (myLowerBound.getPrecision().ordinal() <= TemporalPrecisionEnum.DAY.ordinal()) { Calendar cal = DateUtils.toCalendar(retVal); cal.setTimeZone(TimeZone.getTimeZone("GMT-11:30")); cal = DateUtils.truncate(cal, Calendar.DATE); retVal = cal.getTime(); } if (myLowerBound.getPrefix() != null) { switch (myLowerBound.getPrefix()) { case GREATERTHAN: case STARTS_AFTER: retVal = myLowerBound.getPrecision().add(retVal, 1); break; case EQUAL: case GREATERTHAN_OR_EQUALS: break; case LESSTHAN: case APPROXIMATE: case LESSTHAN_OR_EQUALS: case ENDS_BEFORE: case NOT_EQUAL: throw new IllegalStateException("Unvalid lower bound comparator: " + myLowerBound.getPrefix()); } } return retVal; }
if (myUpperBound.getPrecision().ordinal() <= TemporalPrecisionEnum.DAY.ordinal()) { Calendar cal = DateUtils.toCalendar(retVal); cal.setTimeZone(TimeZone.getTimeZone("GMT+11:30")); case EQUAL: case LESSTHAN_OR_EQUALS: retVal = myUpperBound.getPrecision().add(retVal, 1); retVal = new Date(retVal.getTime() - 1L); break;
public Date getLowerBoundAsInstant() { if (myLowerBound == null || myLowerBound.getValue() == null) { return null; } Date retVal = myLowerBound.getValue(); if (myLowerBound.getPrecision().ordinal() <= TemporalPrecisionEnum.DAY.ordinal()) { Calendar cal = DateUtils.toCalendar(retVal); cal.setTimeZone(TimeZone.getTimeZone("GMT-11:30")); cal = DateUtils.truncate(cal, Calendar.DATE); retVal = cal.getTime(); } if (myLowerBound.getPrefix() != null) { switch (myLowerBound.getPrefix()) { case GREATERTHAN: case STARTS_AFTER: retVal = myLowerBound.getPrecision().add(retVal, 1); break; case EQUAL: case GREATERTHAN_OR_EQUALS: break; case LESSTHAN: case APPROXIMATE: case LESSTHAN_OR_EQUALS: case ENDS_BEFORE: case NOT_EQUAL: throw new IllegalStateException("Unvalid lower bound comparator: " + myLowerBound.getPrefix()); } } return retVal; }