@Override DateParam newInstance() { return new DateParam(); }
/** * Sets the range from a pair of dates, inclusive on both ends * * @param theLowerBound A qualified date param representing the lower date bound (optionally may include time), e.g. * "2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or * theUpperBound may both be populated, or one may be null, but it is not valid for both to be null. * @param theUpperBound A qualified date param representing the upper date bound (optionally may include time), e.g. * "2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or * theUpperBound may both be populated, or one may be null, but it is not valid for both to be null. */ public void setRangeFromDatesInclusive(Date theLowerBound, Date theUpperBound) { DateParam lowerBound = theLowerBound != null ? new DateParam(GREATERTHAN_OR_EQUALS, theLowerBound) : null; DateParam upperBound = theUpperBound != null ? new DateParam(LESSTHAN_OR_EQUALS, theUpperBound) : null; validateAndSet(lowerBound, upperBound); }
/** * Sets the lower bound to be greaterthan or equal to the given date */ public DateRangeParam setLowerBoundInclusive(Date theLowerBound) { validateAndSet(new DateParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, theLowerBound), myUpperBound); return this; }
/** * Sets the lower bound using a string that is compliant with * FHIR dateTime format (ISO-8601). * <p> * This lower bound is assumed to have a <code>ge</code> * (greater than or equals) modifier. * </p> */ public DateRangeParam setLowerBound(String theLowerBound) { setLowerBound(new DateParam(GREATERTHAN_OR_EQUALS, theLowerBound)); return this; }
/** * Sets the upper bound using a string that is compliant with * FHIR dateTime format (ISO-8601). * <p> * This upper bound is assumed to have a <code>le</code> * (less than or equals) modifier. * </p> */ public DateRangeParam setUpperBound(String theUpperBound) { setUpperBound(new DateParam(LESSTHAN_OR_EQUALS, theUpperBound)); return this; }
/** * Sets the upper bound to be greaterthan or equal to the given date */ public DateRangeParam setUpperBoundInclusive(Date theUpperBound) { validateAndSet(myLowerBound, new DateParam(ParamPrefixEnum.LESSTHAN_OR_EQUALS, theUpperBound)); return this; }
/** * Sets the lower bound to be greaterthan to the given date */ public DateRangeParam setLowerBoundExclusive(Date theLowerBound) { validateAndSet(new DateParam(ParamPrefixEnum.GREATERTHAN, theLowerBound), myUpperBound); return this; }
/** * Sets the upper bound to be greaterthan to the given date */ public DateRangeParam setUpperBoundExclusive(Date theUpperBound) { validateAndSet(myLowerBound, new DateParam(ParamPrefixEnum.LESSTHAN, theUpperBound)); return this; }
public void dateClientExample() { ITestClient client = provideTc(); //START SNIPPET: dateClient DateParam param = new DateParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, "2011-01-02"); List<Patient> response = client.getPatientByDob(param); //END SNIPPET: dateClient }
/** * Sets the range from a pair of dates, inclusive on both ends * * @param theLowerBound A qualified date param representing the lower date bound (optionally may include time), e.g. * "2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or * theUpperBound may both be populated, or one may be null, but it is not valid for both to be null. * @param theUpperBound A qualified date param representing the upper date bound (optionally may include time), e.g. * "2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or * theUpperBound may both be populated, or one may be null, but it is not valid for both to be null. */ public void setRangeFromDatesInclusive(String theLowerBound, String theUpperBound) { DateParam lowerBound = theLowerBound != null ? new DateParam(GREATERTHAN_OR_EQUALS, theLowerBound) : null; DateParam upperBound = theUpperBound != null ? new DateParam(LESSTHAN_OR_EQUALS, theUpperBound) : null; if (isNotBlank(theLowerBound) && isNotBlank(theUpperBound) && theLowerBound.equals(theUpperBound)) { lowerBound.setPrefix(EQUAL); upperBound.setPrefix(EQUAL); } validateAndSet(lowerBound, upperBound); }
/** * Returns a new param containing the same value as this param, but with the type copnverted * to {@link DateParam}. This is useful if you are using reference parameters and want to handle * chained parameters of different types in a single method. * <p> * See <a href="http://jamesagnew.github.io/hapi-fhir/doc_rest_operations.html#dynamic_chains">Dynamic Chains</a> * in the HAPI FHIR documentation for an example of how to use this method. * </p> */ public DateParam toDateParam(FhirContext theContext) { DateParam retVal = new DateParam(); retVal.setValueAsQueryToken(theContext, null, null, getValueAsQueryToken(theContext)); return retVal; }
/** * Sets the range from a pair of dates, inclusive on both ends. Note that if * theLowerBound is after theUpperBound, thie method will automatically reverse * the order of the arguments in order to create an inclusive range. * * @param theLowerBound A qualified date param representing the lower date bound (optionally may include time), e.g. * "2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or * theUpperBound may both be populated, or one may be null, but it is not valid for both to be null. * @param theUpperBound A qualified date param representing the upper date bound (optionally may include time), e.g. * "2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or * theUpperBound may both be populated, or one may be null, but it is not valid for both to be null. */ public void setRangeFromDatesInclusive(IPrimitiveType<Date> theLowerBound, IPrimitiveType<Date> theUpperBound) { IPrimitiveType<Date> lowerBound = theLowerBound; IPrimitiveType<Date> upperBound = theUpperBound; if (lowerBound != null && lowerBound.getValue() != null && upperBound != null && upperBound.getValue() != null) { if (lowerBound.getValue().after(upperBound.getValue())) { IPrimitiveType<Date> temp = lowerBound; lowerBound = upperBound; upperBound = temp; } } validateAndSet( lowerBound != null ? new DateParam(GREATERTHAN_OR_EQUALS, lowerBound) : null, upperBound != null ? new DateParam(LESSTHAN_OR_EQUALS, upperBound) : null); }
@Override public IQueryParameterType toQueryParameterType() { DateTimeType value = new DateTimeType(myOriginalValue); if (value.getPrecision().ordinal() > TemporalPrecisionEnum.DAY.ordinal()) { value.setTimeZoneZulu(true); } return new DateParam(value.getValueAsString()); }
switch (theParam.getParamType()) { case DATE: qp = new DateParam(); break; case NUMBER:
@Override public void setValuesAsQueryTokens(FhirContext theContext, String theParamName, List<QualifiedParamList> theParameters) throws InvalidRequestException { boolean haveHadUnqualifiedParameter = false; for (QualifiedParamList paramList : theParameters) { if (paramList.size() == 0) { continue; } if (paramList.size() > 1) { throw new InvalidRequestException("DateRange parameter does not suppport OR queries"); } String param = paramList.get(0); /* * Since ' ' is escaped as '+' we'll be nice to anyone might have accidentally not * escaped theirs */ param = param.replace(' ', '+'); DateParam parsed = new DateParam(); parsed.setValueAsQueryToken(theContext, theParamName, paramList.getQualifier(), param); addParam(parsed); if (parsed.getPrefix() == null) { if (haveHadUnqualifiedParameter) { throw new InvalidRequestException("Multiple date parameters with the same name and no qualifier (>, <, etc.) is not supported"); } haveHadUnqualifiedParameter = true; } } }
@Override DateParam newInstance() { return new DateParam(); }
/** * Sets the upper bound to be greaterthan to the given date */ public DateRangeParam setUpperBoundExclusive(Date theUpperBound) { validateAndSet(myLowerBound, new DateParam(ParamPrefixEnum.LESSTHAN, theUpperBound)); return this; }
/** * Sets the upper bound to be greaterthan or equal to the given date */ public DateRangeParam setUpperBoundInclusive(Date theUpperBound) { validateAndSet(myLowerBound, new DateParam(ParamPrefixEnum.LESSTHAN_OR_EQUALS, theUpperBound)); return this; }
break; case DATE: param = new DateParam(value); break; case STRING: