public void setLastUpdated(DateRangeParam theLastUpdated) { if (theLastUpdated == null) { myLastUpdatedLow = null; myLastUpdatedHigh = null; } else { myLastUpdatedLow = theLastUpdated.getLowerBoundAsInstant(); myLastUpdatedHigh = theLastUpdated.getUpperBoundAsInstant(); } }
public boolean isEmpty() { return (getLowerBoundAsInstant() == null) && (getUpperBoundAsInstant() == null); }
@Override public boolean matches(IQueryParameterType theParam) { if (!(theParam instanceof DateParam)) { return false; } DateParam date = (DateParam) theParam; DateRangeParam range = new DateRangeParam(date); Date lowerBound = range.getLowerBoundAsInstant(); Date upperBound = range.getUpperBoundAsInstant(); if (lowerBound == null && upperBound == null) { // should never happen return false; } boolean result = true; if (lowerBound != null) { result &= (myValueLow.after(lowerBound) || myValueLow.equals(lowerBound)); result &= (myValueHigh.after(lowerBound) || myValueHigh.equals(lowerBound)); } if (upperBound != null) { result &= (myValueLow.before(upperBound) || myValueLow.equals(upperBound)); result &= (myValueHigh.before(upperBound) || myValueHigh.equals(upperBound)); } return result; }
private static List<Predicate> createLastUpdatedPredicates(final DateRangeParam theLastUpdated, CriteriaBuilder builder, From<?, ResourceTable> from) { List<Predicate> lastUpdatedPredicates = new ArrayList<>(); if (theLastUpdated != null) { if (theLastUpdated.getLowerBoundAsInstant() != null) { ourLog.debug("LastUpdated lower bound: {}", new InstantDt(theLastUpdated.getLowerBoundAsInstant())); Predicate predicateLower = builder.greaterThanOrEqualTo(from.get("myUpdated"), theLastUpdated.getLowerBoundAsInstant()); lastUpdatedPredicates.add(predicateLower); } if (theLastUpdated.getUpperBoundAsInstant() != null) { Predicate predicateUpper = builder.lessThanOrEqualTo(from.get("myUpdated"), theLastUpdated.getUpperBoundAsInstant()); lastUpdatedPredicates.add(predicateUpper); } } return lastUpdatedPredicates; }
@Search() public List<Observation> searchByDateRange( @RequiredParam(name=Observation.SP_DATE) DateRangeParam theRange ) { Date from = theRange.getLowerBoundAsInstant(); Date to = theRange.getUpperBoundAsInstant(); List<Observation> retVal = new ArrayList<Observation>(); // ...populate... return retVal; } //END SNIPPET: dateRange
if (theLastUpdated != null && (theLastUpdated.getLowerBoundAsInstant() != null || theLastUpdated.getUpperBoundAsInstant() != null)) { pidsToInclude = new HashSet<>(filterResourceIdsByLastUpdated(theEntityManager, theLastUpdated, pidsToInclude));
protected DateRangeParam processSinceOrAt(Date theSince, DateRangeParam theAt) { boolean haveAt = theAt != null && (theAt.getLowerBoundAsInstant() != null || theAt.getUpperBoundAsInstant() != null); if (haveAt && theSince != null) { String msg = getContext().getLocalizer().getMessage(BaseJpaProvider.class, "cantCombintAtAndSince"); throw new InvalidRequestException(msg); } if (haveAt) { return theAt; } return new DateRangeParam(theSince, null); }
@History public IBundleProvider historyServer(HttpServletRequest theRequest, @Since Date theDate, @At DateRangeParam theAt, RequestDetails theRequestDetails) { startRequest(theRequest); try { DateRangeParam range = super.processSinceOrAt(theDate, theAt); return myDao.history(range.getLowerBoundAsInstant(), range.getUpperBoundAsInstant(), theRequestDetails); } finally { endRequest(theRequest); } }
@History public IBundleProvider getHistoryForResourceType( HttpServletRequest theRequest, @Since Date theSince, @At DateRangeParam theAt, RequestDetails theRequestDetails) { startRequest(theRequest); try { DateRangeParam sinceOrAt = processSinceOrAt(theSince, theAt); return myDao.history(sinceOrAt.getLowerBoundAsInstant(), sinceOrAt.getUpperBoundAsInstant(), theRequestDetails); } finally { endRequest(theRequest); } }
@History public IBundleProvider getHistoryForResourceInstance( HttpServletRequest theRequest, @IdParam IIdType theId, @Since Date theSince, @At DateRangeParam theAt, RequestDetails theRequestDetails) { startRequest(theRequest); try { DateRangeParam sinceOrAt = processSinceOrAt(theSince, theAt); return myDao.history(theId, sinceOrAt.getLowerBoundAsInstant(), sinceOrAt.getUpperBoundAsInstant(), theRequestDetails); } finally { endRequest(theRequest); } }
private Predicate createPredicateDateFromRange(CriteriaBuilder theBuilder, From<?, ResourceIndexedSearchParamDate> theFrom, DateRangeParam theRange) { Date lowerBound = theRange.getLowerBoundAsInstant(); Date upperBound = theRange.getUpperBoundAsInstant();
public void setLastUpdated(DateRangeParam theLastUpdated) { if (theLastUpdated == null) { myLastUpdatedLow = null; myLastUpdatedHigh = null; } else { myLastUpdatedLow = theLastUpdated.getLowerBoundAsInstant(); myLastUpdatedHigh = theLastUpdated.getUpperBoundAsInstant(); } }
public boolean isEmpty() { return (getLowerBoundAsInstant() == null) && (getUpperBoundAsInstant() == null); }
private static List<Predicate> createLastUpdatedPredicates(final DateRangeParam theLastUpdated, CriteriaBuilder builder, From<?, ResourceTable> from) { List<Predicate> lastUpdatedPredicates = new ArrayList<>(); if (theLastUpdated != null) { if (theLastUpdated.getLowerBoundAsInstant() != null) { ourLog.debug("LastUpdated lower bound: {}", new InstantDt(theLastUpdated.getLowerBoundAsInstant())); Predicate predicateLower = builder.greaterThanOrEqualTo(from.get("myUpdated"), theLastUpdated.getLowerBoundAsInstant()); lastUpdatedPredicates.add(predicateLower); } if (theLastUpdated.getUpperBoundAsInstant() != null) { Predicate predicateUpper = builder.lessThanOrEqualTo(from.get("myUpdated"), theLastUpdated.getUpperBoundAsInstant()); lastUpdatedPredicates.add(predicateUpper); } } return lastUpdatedPredicates; }
if (theLastUpdated != null && (theLastUpdated.getLowerBoundAsInstant() != null || theLastUpdated.getUpperBoundAsInstant() != null)) { pidsToInclude = new HashSet<>(filterResourceIdsByLastUpdated(theEntityManager, theLastUpdated, pidsToInclude));
protected DateRangeParam processSinceOrAt(Date theSince, DateRangeParam theAt) { boolean haveAt = theAt != null && (theAt.getLowerBoundAsInstant() != null || theAt.getUpperBoundAsInstant() != null); if (haveAt && theSince != null) { String msg = getContext().getLocalizer().getMessage(BaseJpaProvider.class, "cantCombintAtAndSince"); throw new InvalidRequestException(msg); } if (haveAt) { return theAt; } return new DateRangeParam(theSince, null); }
@History public IBundleProvider historyServer(HttpServletRequest theRequest, @Since Date theDate, @At DateRangeParam theAt, RequestDetails theRequestDetails) { startRequest(theRequest); try { DateRangeParam range = super.processSinceOrAt(theDate, theAt); return myDao.history(range.getLowerBoundAsInstant(), range.getUpperBoundAsInstant(), theRequestDetails); } finally { endRequest(theRequest); } }
@History public IBundleProvider getHistoryForResourceType( HttpServletRequest theRequest, @Since Date theSince, @At DateRangeParam theAt, RequestDetails theRequestDetails) { startRequest(theRequest); try { DateRangeParam sinceOrAt = processSinceOrAt(theSince, theAt); return myDao.history(sinceOrAt.getLowerBoundAsInstant(), sinceOrAt.getUpperBoundAsInstant(), theRequestDetails); } finally { endRequest(theRequest); } }
@History public IBundleProvider getHistoryForResourceInstance( HttpServletRequest theRequest, @IdParam IIdType theId, @Since Date theSince, @At DateRangeParam theAt, RequestDetails theRequestDetails) { startRequest(theRequest); try { DateRangeParam sinceOrAt = processSinceOrAt(theSince, theAt); return myDao.history(theId, sinceOrAt.getLowerBoundAsInstant(), sinceOrAt.getUpperBoundAsInstant(), theRequestDetails); } finally { endRequest(theRequest); } }
private Predicate createPredicateDateFromRange(CriteriaBuilder theBuilder, From<?, ResourceIndexedSearchParamDate> theFrom, DateRangeParam theRange) { Date lowerBound = theRange.getLowerBoundAsInstant(); Date upperBound = theRange.getUpperBoundAsInstant();