From 0bc703107c60339031ca959190ede65cb46eff1d Mon Sep 17 00:00:00 2001
From: jamesagnew
+ * If the parameter is not a composite, this parameter must be empty
+ *
*
- * Description: Both name and one of the value parameters
- * Type: composite
- * Path: name & value-[x]
- *
- * Description: Both name and one of the value parameters
- * Type: composite
- * Path: name & value-[x]
- *
@@ -239,7 +193,7 @@ public class Observation extends BaseResource implements IResource {
* Path: Observation.applies[x]
*
- * Description: Related Observations - search on related-type and related-target together
+ * Description: Both name and one of the value parameters
* Type: composite
- * Path: related-target & related-type
+ * Path: name & value-[x]
*
+ * Description: Both name and one of the value parameters
+ * Type: composite
+ * Path: name & value-[x]
+ *
+ * Description: Both name and one of the value parameters
+ * Type: composite
+ * Path: name & value-[x]
+ *
+ * Description: Both name and one of the value parameters
+ * Type: composite
+ * Path: name & value-[x]
+ *
+ * Description: Both name and one of the value parameters
+ * Type: composite
+ * Path: name & value-[x]
+ *
+ * Description: Both name and one of the value parameters
+ * Type: composite
+ * Path: name & value-[x]
+ *
+ * Description: Both name and one of the value parameters
+ * Type: composite
+ * Path: name & value-[x]
+ *
+ * Description: Both name and one of the value parameters
+ * Type: composite
+ * Path: name & value-[x]
+ *
* Description: Related Observations - search on related-type and related-target together
* Type: composite
* Path: related-target & related-type
*
+ * Description: Related Observations - search on related-type and related-target together
+ * Type: composite
+ * Path: related-target & related-type
+ *
- * Definition: - * The assessment made based on the result of the observation. - *
- */ - public Observation setInterpretation(ObservationInterpretationCodesEnum theValue) { - getInterpretation().setValueAsEnum(theValue); - return this; - } - /** * Gets the value(s) for comments (Comments about result). @@ -786,8 +811,8 @@ public class Observation extends BaseResource implements IResource { * * */ - public Observation setIssued( Date theDate, TemporalPrecisionEnum thePrecision) { - myIssued = new InstantDt(theDate, thePrecision); + public Observation setIssuedWithMillisPrecision( Date theDate) { + myIssued = new InstantDt(theDate); return this; } @@ -799,8 +824,8 @@ public class Observation extends BaseResource implements IResource { * * */ - public Observation setIssuedWithMillisPrecision( Date theDate) { - myIssued = new InstantDt(theDate); + public Observation setIssued( Date theDate, TemporalPrecisionEnum thePrecision) { + myIssued = new InstantDt(theDate, thePrecision); return this; } @@ -815,9 +840,9 @@ public class Observation extends BaseResource implements IResource { * The status of the result value * */ - public BoundCodeDt* Definition: * The status of the result value *
*/ - public Observation setStatus(ObservationStatusEnum theValue) { - getStatus().setValueAsEnum(theValue); - return this; + public Observation setStatus( String theCode) { + myStatus = new CodeDt(theCode); + return this; } - + /** * Gets the value(s) for reliability (ok | ongoing | early | questionable | calibrating | error +). * creating it if it does @@ -859,9 +884,9 @@ public class Observation extends BaseResource implements IResource { * An estimate of the degree to which quality issues have impacted on the value reported * */ - public BoundCodeDt* Definition: * An estimate of the degree to which quality issues have impacted on the value reported *
*/ - public Observation setReliability(ObservationReliabilityEnum theValue) { - getReliability().setValueAsEnum(theValue); - return this; + public Observation setReliability( String theCode) { + myReliability = new CodeDt(theCode); + return this; } - + /** * Gets the value(s) for bodySite (Observed body part). * creating it if it does @@ -993,8 +1018,8 @@ public class Observation extends BaseResource implements IResource { * A unique identifier for the simple observation * */ - public Observation setIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { - myIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel); + public Observation setIdentifier( String theSystem, String theValue) { + myIdentifier = new IdentifierDt(theSystem, theValue); return this; } @@ -1006,8 +1031,8 @@ public class Observation extends BaseResource implements IResource { * A unique identifier for the simple observation * */ - public Observation setIdentifier( String theSystem, String theValue) { - myIdentifier = new IdentifierDt(theSystem, theValue); + public Observation setIdentifier( IdentifierUseEnum theUse, String theSystem, String theValue, String theLabel) { + myIdentifier = new IdentifierDt(theUse, theSystem, theValue, theLabel); return this; } @@ -1324,32 +1349,6 @@ public class Observation extends BaseResource implements IResource { ** Definition: * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 - *
- */ - public ReferenceRange setLow( QuantityCompararatorEnum theComparator, double theValue, String theSystem, String theUnits) { - myLow = new QuantityDt(theComparator, theValue, theSystem, theUnits); - return this; - } - - /** - * Sets the value for low (Low Range, if relevant) - * - *- * Definition: - * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 - *
- */ - public ReferenceRange setLow( QuantityCompararatorEnum theComparator, long theValue, String theSystem, String theUnits) { - myLow = new QuantityDt(theComparator, theValue, theSystem, theUnits); - return this; - } - - /** - * Sets the value for low (Low Range, if relevant) - * - *- * Definition: - * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 *
*/ public ReferenceRange setLow( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { @@ -1363,19 +1362,6 @@ public class Observation extends BaseResource implements IResource { ** Definition: * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 - *
- */ - public ReferenceRange setLow( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { - myLow = new QuantityDt(theComparator, theValue, theUnits); - return this; - } - - /** - * Sets the value for low (Low Range, if relevant) - * - *- * Definition: - * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 *
*/ public ReferenceRange setLow( double theValue) { @@ -1396,6 +1382,45 @@ public class Observation extends BaseResource implements IResource { return this; } + /** + * Sets the value for low (Low Range, if relevant) + * + *+ * Definition: + * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 + *
+ */ + public ReferenceRange setLow( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myLow = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for low (Low Range, if relevant) + * + *+ * Definition: + * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 + *
+ */ + public ReferenceRange setLow( QuantityCompararatorEnum theComparator, double theValue, String theSystem, String theUnits) { + myLow = new QuantityDt(theComparator, theValue, theSystem, theUnits); + return this; + } + + /** + * Sets the value for low (Low Range, if relevant) + * + *+ * Definition: + * The value of the low bound of the reference range. If this is omitted, the low bound of the reference range is assumed to be meaningless. E.g. <2.3 + *
+ */ + public ReferenceRange setLow( QuantityCompararatorEnum theComparator, long theValue, String theSystem, String theUnits) { + myLow = new QuantityDt(theComparator, theValue, theSystem, theUnits); + return this; + } + /** * Gets the value(s) for high (High Range, if relevant). @@ -1433,32 +1458,6 @@ public class Observation extends BaseResource implements IResource { ** Definition: * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 - *
- */ - public ReferenceRange setHigh( QuantityCompararatorEnum theComparator, double theValue, String theSystem, String theUnits) { - myHigh = new QuantityDt(theComparator, theValue, theSystem, theUnits); - return this; - } - - /** - * Sets the value for high (High Range, if relevant) - * - *- * Definition: - * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 - *
- */ - public ReferenceRange setHigh( QuantityCompararatorEnum theComparator, long theValue, String theSystem, String theUnits) { - myHigh = new QuantityDt(theComparator, theValue, theSystem, theUnits); - return this; - } - - /** - * Sets the value for high (High Range, if relevant) - * - *- * Definition: - * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 *
*/ public ReferenceRange setHigh( QuantityCompararatorEnum theComparator, double theValue, String theUnits) { @@ -1472,19 +1471,6 @@ public class Observation extends BaseResource implements IResource { ** Definition: * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 - *
- */ - public ReferenceRange setHigh( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { - myHigh = new QuantityDt(theComparator, theValue, theUnits); - return this; - } - - /** - * Sets the value for high (High Range, if relevant) - * - *- * Definition: - * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 *
*/ public ReferenceRange setHigh( double theValue) { @@ -1505,6 +1491,45 @@ public class Observation extends BaseResource implements IResource { return this; } + /** + * Sets the value for high (High Range, if relevant) + * + *+ * Definition: + * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 + *
+ */ + public ReferenceRange setHigh( QuantityCompararatorEnum theComparator, long theValue, String theUnits) { + myHigh = new QuantityDt(theComparator, theValue, theUnits); + return this; + } + + /** + * Sets the value for high (High Range, if relevant) + * + *+ * Definition: + * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 + *
+ */ + public ReferenceRange setHigh( QuantityCompararatorEnum theComparator, double theValue, String theSystem, String theUnits) { + myHigh = new QuantityDt(theComparator, theValue, theSystem, theUnits); + return this; + } + + /** + * Sets the value for high (High Range, if relevant) + * + *+ * Definition: + * The value of the high bound of the reference range. If this is omitted, the high bound of the reference range is assumed to be meaningless. E.g. >5 + *
+ */ + public ReferenceRange setHigh( QuantityCompararatorEnum theComparator, long theValue, String theSystem, String theUnits) { + myHigh = new QuantityDt(theComparator, theValue, theSystem, theUnits); + return this; + } + /** * Gets the value(s) for meaning (Indicates the meaning/use of this range of this range). @@ -1588,7 +1613,7 @@ public class Observation extends BaseResource implements IResource { shortDefinition="has-component | has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by", formalDefinition="A code specifying the kind of relationship that exists with the target observation" ) - private BoundCodeDt* Definition: * A code specifying the kind of relationship that exists with the target observation *
*/ - public Related setType(ObservationRelationshipTypeEnum theValue) { - getType().setValueAsEnum(theValue); - return this; + public Related setType( String theCode) { + myType = new CodeDt(theCode); + return this; } - + /** * Gets the value(s) for target (Observation that is related to this one). * creating it if it does @@ -1687,7 +1712,15 @@ public class Observation extends BaseResource implements IResource { } + public void setStatus(ObservationStatusEnum theFinal) { + if (theFinal==null) { + getStatus().setValue(null); + }else { + getStatus().setValue(theFinal.getCode()); + } + } -} + +} \ No newline at end of file diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java index 3e1d42bdee7..57489041793 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java @@ -35,11 +35,12 @@ import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.rest.server.Constants; /** - * Represents the FHIR ID type. This is the actual resource ID, meaning the ID that will be used in RESTful URLs, Resource References, etc. to represent a specific instance of a resource. + * Represents the FHIR ID type. This is the actual resource ID, meaning the ID that will be used in RESTful URLs, + * Resource References, etc. to represent a specific instance of a resource. * *- * Description: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or any other combination of lowercase letters, numerals, "-" and ".", with a length - * limit of 36 characters. + * Description: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or any + * other combination of lowercase letters, numerals, "-" and ".", with a length limit of 36 characters. *
*
* regex: [a-z0-9\-\.]{1,36}
@@ -52,7 +53,7 @@ public class IdDt extends BasePrimitive
- * Description: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or any other combination of lowercase letters, numerals, "-" and ".", with a length
- * limit of 36 characters.
+ * Description: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or
+ * any other combination of lowercase letters, numerals, "-" and ".", with a length limit of 36 characters.
*
* regex: [a-z0-9\-\.]{1,36}
@@ -107,13 +110,6 @@ public class IdDt extends BasePrimitive
- * Description: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or any other combination of lowercase letters, numerals, "-" and ".", with a length
- * limit of 36 characters.
+ * Description: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or
+ * any other combination of lowercase letters, numerals, "-" and ".", with a length limit of 36 characters.
*
* regex: [a-z0-9\-\.]{1,36}
@@ -300,7 +309,7 @@ public class IdDt extends BasePrimitive
- * Description: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or any other combination of lowercase letters, numerals, "-" and ".", with a length
- * limit of 36 characters.
+ * Description: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or
+ * any other combination of lowercase letters, numerals, "-" and ".", with a length limit of 36 characters.
*
* regex: [a-z0-9\-\.]{1,36}
@@ -372,9 +381,15 @@ public class IdDt extends BasePrimitive
+ * Most resource model classes have constants which may be used to
+ * supply values for this field, e.g. {@link Patient#SP_NAME} or
+ * {@link Observation#SP_DATE}
+ *
+ * If you wish to specify a parameter for a resource reference which
+ * only accepts a specific chained value, it is also valid to supply
+ * a chained name here, such as "patient.name". It is recommended to
+ * supply this using constants where possible, e.g.
+ *
+ * If the parameter annotated with this annotation is not a {@link ReferenceParam},
+ * this value must not be populated.
+ *
+ * If the parameter annotated with this annotation is not a {@link CompositeParam},
+ * this value must not be populated.
+ *
+ * Most resource model classes have constants which may be used to
+ * supply values for this field, e.g. {@link Patient#SP_NAME} or
+ * {@link Observation#SP_DATE}
+ *
+ * If you wish to specify a parameter for a resource reference which
+ * only accepts a specific chained value, it is also valid to supply
+ * a chained name here, such as "patient.name". It is recommended to
+ * supply this using constants where possible, e.g.
+ *
+ * If the parameter annotated with this annotation is not a {@link ReferenceParam},
+ * this value must not be populated.
+ *
+ * If the parameter annotated with this annotation is not a {@link CompositeParam},
+ * this value must not be populated.
+ *
The following example shows how to query using the generic client:
If the server supports paging results, the client has a page method
which can be used to load subsequent pages.
@@ -106,6 +109,21 @@
+
+
+ If a composite parameter is being searched on, the parameter
+ takes a "left" and "right" operand, each of which is
+ a parameter from the resource being seached. The following example shows the
+ syntax.
+
The fluent search also has methods for sorting, limiting, specifying
JSON encoding, etc.
@@ -115,6 +133,7 @@
+
+ Updating a resource is similar to creating one, except that
+ an ID must be supplied since you are updating a previously
+ existing resource instance.
+
+ The following example shows how to perform an update
+ operation using the generic client:
+
To retrieve the server's conformance statement, simply call the
- HAPI also provides a second style of client caled the annotation-driven client.
+ HAPI also provides a second style of client, called the annotation-driven client.
diff --git a/hapi-fhir-base/src/site/xdoc/doc_rest_operations.xml b/hapi-fhir-base/src/site/xdoc/doc_rest_operations.xml
index 95398292051..0cacc1411c4 100644
--- a/hapi-fhir-base/src/site/xdoc/doc_rest_operations.xml
+++ b/hapi-fhir-base/src/site/xdoc/doc_rest_operations.xml
@@ -727,6 +727,34 @@
+ Composite search parameters incorporate two parameters in a single
+ value. Each of those parameters will themselves have a parameter type.
+
+ In the following example, Observation.name-value-date is shown. This parameter
+ is a composite of a string and a date. Note that the composite parameter types
+ (StringParam and DateParam) must be specified in both the annotation's
+
+ Example URL to invoke this method:
+
diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java
index 0e0baf6f5df..493258f0af8 100644
--- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java
+++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java
@@ -10,7 +10,6 @@ import org.junit.Before;
import org.junit.Test;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.dstu.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu.composite.NarrativeDt;
diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java
index 405342fdd87..64532dad613 100644
--- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java
+++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java
@@ -28,7 +28,6 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.BundleEntry;
import ca.uhn.fhir.model.api.ExtensionDt;
-import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.api.annotation.Child;
@@ -113,8 +112,11 @@ public class JsonParserTest {
" }" +
"}";
//@formatter:on
- IResource res = ourCtx.newJsonParser().parseResource(text);
+ Patient res = (Patient) ourCtx.newJsonParser().parseResource(text);
+ String value = res.getText().getDiv().getValueAsString();
+
+ assertNull(value);
}
diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java
index e8f9a8996fa..0266537d7fa 100644
--- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java
+++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java
@@ -9,6 +9,7 @@ import static org.mockito.Mockito.when;
import java.io.InputStream;
import java.io.StringReader;
+import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Date;
@@ -45,6 +46,7 @@ import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.dstu.composite.CodingDt;
import ca.uhn.fhir.model.dstu.resource.Conformance;
+import ca.uhn.fhir.model.dstu.resource.Observation;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
@@ -58,6 +60,7 @@ import ca.uhn.fhir.rest.annotation.Search;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.client.api.IBasicClient;
import ca.uhn.fhir.rest.client.interceptor.CapturingInterceptor;
+import ca.uhn.fhir.rest.param.CompositeParam;
import ca.uhn.fhir.rest.param.DateParam;
import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.QuantityParam;
@@ -771,7 +774,7 @@ public class ClientTest {
}
@Test
- public void testSearchComposite() throws Exception {
+ public void testSearchOrList() throws Exception {
String msg = getPatientFeedWithOneResult();
@@ -944,6 +947,28 @@ public class ClientTest {
assertEquals("PRP1660", resource.getIdentifier().get(0).getValue().getValue());
}
+
+
+
+ @Test
+ public void testSearchByCompositeParam() throws Exception {
+
+ String msg = getPatientFeedWithOneResult();
+
+ ArgumentCaptorthis
IdDt. It is generally not neccesary to use this method but it is provided for consistency with the rest of the API.
+ * Returns a reference to this
IdDt. It is generally not neccesary to use this method but it is
+ * provided for consistency with the rest of the API.
*/
@Override
public IdDt getId() {
@@ -209,18 +207,27 @@ public class IdDt extends BasePrimitivetrue
if the unqualified ID is a valid {@link Long} value (in other words, it consists only of digits)
+ * Returns true
if the unqualified ID is a valid {@link Long} value (in other words, it consists only
+ * of digits)
*/
public boolean isIdPartValidLong() {
String id = getIdPart();
@@ -278,7 +286,8 @@ public class IdDt extends BasePrimitivethis
IdDt. It is generally not neccesary to use this method but it is provided for consistency with the rest of the API.
+ * Copies the value from the given IdDt to this
IdDt. It is generally not neccesary to use this method
+ * but it is provided for consistency with the rest of the API.
*/
@Override
public void setId(IdDt theId) {
@@ -289,8 +298,8 @@ public class IdDt extends BasePrimitive{@link Observation#SP_SUBJECT} + '.' + {@link Patient#SP_IDENTIFIER}
+ * {@link Observation#SP_SUBJECT} + '.' + {@link Patient#SP_IDENTIFIER}
+ * Search - Paging
Search - Composite Parameters
+ Search - Query Options
conformance()
@@ -157,7 +193,7 @@
compositeTypes
field, as well as the generic types for the
+ CompositeParam
method parameter itself.
+
+ http://fhir.example.com/Observation?name-value-date=PROCTIME$2001-02-02
+ >() {
+ @Override
+ public List