changelog

This commit is contained in:
Ken Stevens 2019-09-09 14:22:42 -04:00
parent cdbe527456
commit 9e83f1d40a
4 changed files with 36 additions and 17 deletions

View File

@ -20,21 +20,20 @@ package ca.uhn.fhir.model.primitive;
* #L%
*/
import static org.apache.commons.lang3.StringUtils.isBlank;
import ca.uhn.fhir.model.api.BasePrimitive;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.parser.DataFormatException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.lang3.time.FastDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.lang3.time.FastDateFormat;
import ca.uhn.fhir.model.api.BasePrimitive;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.parser.DataFormatException;
import static org.apache.commons.lang3.StringUtils.isBlank;
public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
static final long NANOS_PER_MILLIS = 1000000L;
@ -343,6 +342,10 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
throwBadDateFormat(value);
}
if (value.equalsIgnoreCase("%now")) {
return new Date();
}
TemporalPrecisionEnum precision = null;
cal.set(Calendar.YEAR, parseInt(value, value.substring(0, 4), 0, 9999));
precision = TemporalPrecisionEnum.YEAR;

View File

@ -47,7 +47,7 @@ public abstract class BaseParamWithPrefix<T extends BaseParam> extends BaseParam
break;
} else {
char nextChar = theString.charAt(offset);
if (nextChar == '-' || Character.isDigit(nextChar)) {
if (nextChar == '-' || nextChar == '%' || Character.isDigit(nextChar)) {
break;
}
}

View File

@ -29,6 +29,8 @@ public class InMemoryResourceMatcherTest {
public static final String OBS_DATE = "1970-10-17";
private static final String EARLY_DATE = "1965-08-09";
private static final String LATE_DATE = "2000-06-29";
// FIXME KHS move this
private static final String NOW = "NOW";
@Autowired
private
@ -67,13 +69,6 @@ public class InMemoryResourceMatcherTest {
mySearchParams = extractDateSearchParam(myObservation);
}
private ResourceIndexedSearchParams extractDateSearchParam(Observation theObservation) {
ResourceIndexedSearchParams retval = new ResourceIndexedSearchParams();
BaseDateTimeType dateValue = (BaseDateTimeType) theObservation.getEffective();
ResourceIndexedSearchParamDate dateParam = new ResourceIndexedSearchParamDate("date", dateValue.getValue(), dateValue.getValue(), dateValue.getValueAsString());
retval.myDateParams.add(dateParam);
return retval;
}
@Test
public void testUnsupportedOps() {
@ -115,7 +110,21 @@ public class InMemoryResourceMatcherTest {
assertTrue(result.getUnsupportedReason(), result.supported());
assertEquals(result.matched(), theLater);
}
}
@Test
public void testNow() {
InMemoryMatchResult result = myInMemoryResourceMatcher.match("date=lt%now", myObservation, mySearchParams);
assertTrue(result.getUnsupportedReason(), result.supported());
assertTrue(result.matched());
}
private ResourceIndexedSearchParams extractDateSearchParam(Observation theObservation) {
ResourceIndexedSearchParams retval = new ResourceIndexedSearchParams();
BaseDateTimeType dateValue = (BaseDateTimeType) theObservation.getEffective();
ResourceIndexedSearchParamDate dateParam = new ResourceIndexedSearchParamDate("date", dateValue.getValue(), dateValue.getValue(), dateValue.getValueAsString());
retval.myDateParams.add(dateParam);
return retval;
}
}

View File

@ -117,6 +117,13 @@
the RequestValidatingInterceptor, but not including any HAPI FHIR security interceptors)
could be bypassed if a Content Type was not included.
</action>
<action type="add">
Added support for comparing resource dates to the current time via a new variable %now. E.g.
Procedure?date=gt%now would match future procedures.
</action>
<action type="add">
Add support for in-memory matching on date comparisons ge,gt,eq,lt,le.
</action>
</release>
<release version="4.0.1" date="2019-09-03" description="Igloo (Point Release)">
<action type="fix">