/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, String theDate) { setPrefix(thePrefix); setValueAsString(theDate); }
/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, Date theDate) { setPrefix(thePrefix); setValue(theDate); }
/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, long theDate) { ValidateUtil.isGreaterThan(theDate, 0, "theDate must not be 0 or negative"); setPrefix(thePrefix); setValue(new Date(theDate)); }
/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, DateTimeDt theDate) { setPrefix(thePrefix); myValue.setValueAsString(theDate != null ? theDate.getValueAsString() : null); }
/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, IPrimitiveType<Date> theDate) { setPrefix(thePrefix); myValue.setValueAsString(theDate != null ? theDate.getValueAsString() : null); }
/** * 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); }
/** * Accepts values with or without a prefix (e.g. <code>gt2011-01-01</code> and <code>2011-01-01</code>). * If no prefix is provided in the given value, the {@link #getPrefix() existing prefix} is preserved */ public void setValueAsString(String theDate) { if (isNotBlank(theDate)) { ParamPrefixEnum existingPrefix = getPrefix(); myValue.setValueAsString(super.extractPrefixAndReturnRest(theDate)); if (getPrefix() == null) { setPrefix(existingPrefix); } } else { myValue.setValue(null); } }
@Override public void setValuesAsQueryTokens(FhirContext theContext, String theParamName, QualifiedParamList theParameters) { setMissing(null); setPrefix(null); setValueAsString(null); if (theParameters.size() == 1) { setValueAsString(theParameters.get(0)); } else if (theParameters.size() > 1) { throw new InvalidRequestException("This server does not support multi-valued dates for this parameter: " + theParameters); } }
/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, Date theDate) { setPrefix(thePrefix); setValue(theDate); }
/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, String theDate) { setPrefix(thePrefix); setValueAsString(theDate); }
/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, long theDate) { ValidateUtil.isGreaterThan(theDate, 0, "theDate must not be 0 or negative"); setPrefix(thePrefix); setValue(new Date(theDate)); }
/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, DateTimeDt theDate) { setPrefix(thePrefix); myValue.setValueAsString(theDate != null ? theDate.getValueAsString() : null); }
/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, IPrimitiveType<Date> theDate) { setPrefix(thePrefix); myValue.setValueAsString(theDate != null ? theDate.getValueAsString() : null); }
/** * 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); }
/** * Accepts values with or without a prefix (e.g. <code>gt2011-01-01</code> and <code>2011-01-01</code>). * If no prefix is provided in the given value, the {@link #getPrefix() existing prefix} is preserved */ public void setValueAsString(String theDate) { if (isNotBlank(theDate)) { ParamPrefixEnum existingPrefix = getPrefix(); myValue.setValueAsString(super.extractPrefixAndReturnRest(theDate)); if (getPrefix() == null) { setPrefix(existingPrefix); } } else { myValue.setValue(null); } }
@Override public void setValuesAsQueryTokens(FhirContext theContext, String theParamName, QualifiedParamList theParameters) { setMissing(null); setPrefix(null); setValueAsString(null); if (theParameters.size() == 1) { setValueAsString(theParameters.get(0)); } else if (theParameters.size() > 1) { throw new InvalidRequestException("This server does not support multi-valued dates for this parameter: " + theParameters); } }