diff --git a/examples/src/main/java/example/ClientExamples.java b/examples/src/main/java/example/ClientExamples.java
index 5725e8b161c..5f191520a59 100644
--- a/examples/src/main/java/example/ClientExamples.java
+++ b/examples/src/main/java/example/ClientExamples.java
@@ -7,6 +7,7 @@ import ca.uhn.fhir.rest.client.api.IBasicClient;
import ca.uhn.fhir.rest.client.interceptor.BasicAuthInterceptor;
import ca.uhn.fhir.rest.client.interceptor.BearerTokenAuthInterceptor;
import ca.uhn.fhir.rest.client.interceptor.CookieInterceptor;
+import ca.uhn.fhir.rest.client.interceptor.GZipContentInterceptor;
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.server.EncodingEnum;
@@ -90,6 +91,18 @@ public class ClientExamples {
// END SNIPPET: cookie
}
+ @SuppressWarnings("unused")
+ public void gzip() {
+ // START SNIPPET: gzip
+ // Create a context and get the client factory so it can be configured
+ FhirContext ctx = FhirContext.forDstu2();
+ IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();
+
+ // Register the interceptor with your client (either style)
+ IPatientClient annotationClient = ctx.newRestfulClient(IPatientClient.class, "http://localhost:9999/fhir");
+ annotationClient.registerInterceptor(new GZipContentInterceptor());
+ // END SNIPPET: gzip
+ }
@SuppressWarnings("unused")
public void createSecurityBearer() {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/GetPage.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/GetPage.java
index b347033d74c..bcf1bd87633 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/GetPage.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/GetPage.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.annotation;
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2015 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/PageIdParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/PageIdParam.java
index ed5a493fd99..4560eeaa648 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/PageIdParam.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/PageIdParam.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.annotation;
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2015 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/interceptor/GZipContentInterceptor.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/interceptor/GZipContentInterceptor.java
new file mode 100644
index 00000000000..c4d73341395
--- /dev/null
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/interceptor/GZipContentInterceptor.java
@@ -0,0 +1,56 @@
+package ca.uhn.fhir.rest.client.interceptor;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.zip.GZIPOutputStream;
+
+import org.apache.http.Header;
+import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.entity.ByteArrayEntity;
+
+import ca.uhn.fhir.rest.client.IClientInterceptor;
+import ca.uhn.fhir.rest.server.Constants;
+
+/**
+ * Client interceptor which GZip compresses outgoing (POST/PUT) contents being uploaded
+ * from the client to the server. This can improve performance by reducing network
+ * load time.
+ */
+public class GZipContentInterceptor implements IClientInterceptor {
+ private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(GZipContentInterceptor.class);
+
+ @Override
+ public void interceptRequest(HttpRequestBase theRequest) {
+ if (theRequest instanceof HttpEntityEnclosingRequest) {
+ Header[] encodingHeaders = theRequest.getHeaders(Constants.HEADER_CONTENT_ENCODING);
+ if (encodingHeaders == null || encodingHeaders.length == 0) {
+ HttpEntityEnclosingRequest req = (HttpEntityEnclosingRequest)theRequest;
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ GZIPOutputStream gos;
+ try {
+ gos = new GZIPOutputStream(bos);
+ req.getEntity().writeTo(gos);
+ gos.finish();
+ } catch (IOException e) {
+ ourLog.warn("Failed to GZip outgoing content", e);
+ return;
+ }
+
+ byte[] byteArray = bos.toByteArray();
+ ByteArrayEntity newEntity = new ByteArrayEntity(byteArray);
+ req.setEntity(newEntity);
+ req.addHeader(Constants.HEADER_CONTENT_ENCODING, "gzip");
+ }
+ }
+
+ }
+
+ @Override
+ public void interceptResponse(HttpResponse theResponse) throws IOException {
+ // nothing
+ }
+
+}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IRestfulHeader.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IRestfulHeader.java
index 2abce5282a8..04b94b032b4 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IRestfulHeader.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/IRestfulHeader.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.method;
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2015 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
public interface IRestfulHeader {
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/PageMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/PageMethodBinding.java
index a19d5459790..2eaa9c97a07 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/PageMethodBinding.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/PageMethodBinding.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.method;
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2015 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.lang.reflect.Method;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ParseAction.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ParseAction.java
index a3b3e29cc14..463c4b3fda8 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ParseAction.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/ParseAction.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.method;
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2015 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
import java.io.IOException;
import java.io.Writer;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/RequestDetails.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/RequestDetails.java
index 61b00ae6a2d..ff60bbe59f4 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/RequestDetails.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/RequestDetails.java
@@ -39,7 +39,7 @@ import ca.uhn.fhir.rest.server.IRestfulServerDefaults;
public abstract class RequestDetails {
- private byte[] myRequestContents;
+ private byte[] myRequestContents;
private String myCompartmentName;
private String myCompleteUrl;
private String myFhirServerBase;
@@ -54,7 +54,7 @@ public abstract class RequestDetails {
private String mySecondaryOperation;
private MapBufferedReader
. The reader translates the character
- * data according to the character encoding used on the body.
- * Either this method or {@link #getInputStream} may be called to read the
- * body, not both.
- *
- * @return a Reader
containing the body of the request
- *
- * @exception UnsupportedEncodingException if the character set encoding
- * used is not supported and the text cannot be decoded
- *
- * @exception IllegalStateException if {@link #getInputStream} method
- * has been called on this request
- *
- * @exception IOException if an input or output exception occurred
- *
- * @see javax.servlet.http.HttpServletRequest#getInputStream
- */
- public abstract Reader getReader() throws IOException;
+ /**
+ * Retrieves the body of the request as character data using a BufferedReader
. The reader translates the
+ * character data according to the character encoding used on the body. Either this method or {@link #getInputStream}
+ * may be called to read the body, not both.
+ *
+ * @return a Reader
containing the body of the request
+ *
+ * @exception UnsupportedEncodingException
+ * if the character set encoding used is not supported and the text cannot be decoded
+ *
+ * @exception IllegalStateException
+ * if {@link #getInputStream} method has been called on this request
+ *
+ * @exception IOException
+ * if an input or output exception occurred
+ *
+ * @see javax.servlet.http.HttpServletRequest#getInputStream
+ */
+ public abstract Reader getReader() throws IOException;
- /**
- * Retrieves the body of the request as binary data.
- * Either this method or {@link #getReader} may be called to
- * read the body, not both.
- *
- * @return a {@link InputStream} object containing
- * the body of the request
- *
- * @exception IllegalStateException if the {@link #getReader} method
- * has already been called for this request
- *
- * @exception IOException if an input or output exception occurred
- */
- public abstract InputStream getInputStream() throws IOException;
+ /**
+ * Retrieves the body of the request as binary data. Either this method or {@link #getReader} may be called to read
+ * the body, not both.
+ *
+ * @return a {@link InputStream} object containing the body of the request
+ *
+ * @exception IllegalStateException
+ * if the {@link #getReader} method has already been called for this request
+ *
+ * @exception IOException
+ * if an input or output exception occurred
+ */
+ public abstract InputStream getInputStream() throws IOException;
- /**
- * Returns the server base URL (with no trailing '/') for a given request
- */
- public abstract String getServerBaseForRequest();
+ /**
+ * Returns the server base URL (with no trailing '/') for a given request
+ */
+ public abstract String getServerBaseForRequest();
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ResourceParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ResourceParameter.java
index f626ae783c2..fa86a054849 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ResourceParameter.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/ResourceParameter.java
@@ -122,7 +122,7 @@ public class ResourceParameter implements IParameter {
}
public static Reader createRequestReader(RequestDetails theRequest, Charset charset) {
- Reader requestReader = new InputStreamReader(new ByteArrayInputStream(theRequest.loadRequestContents(theRequest)), charset);
+ Reader requestReader = new InputStreamReader(new ByteArrayInputStream(theRequest.loadRequestContents()), charset);
return requestReader;
}
@@ -179,7 +179,7 @@ public class ResourceParameter implements IParameter {
String msg = ctx.getLocalizer().getMessage(ResourceParameter.class, "noContentTypeInRequest", restOperationType);
throw new InvalidRequestException(msg);
} else {
- requestReader = new InputStreamReader(new ByteArrayInputStream(theRequest.loadRequestContents(theRequest)), charset);
+ requestReader = new InputStreamReader(new ByteArrayInputStream(theRequest.loadRequestContents()), charset);
}
} else {
String msg = ctx.getLocalizer().getMessage(ResourceParameter.class, "invalidContentTypeInRequest", ctValue, restOperationType);
@@ -219,7 +219,7 @@ public class ResourceParameter implements IParameter {
String ct = theRequest.getHeader(Constants.HEADER_CONTENT_TYPE);
IBaseBinary binary = (IBaseBinary) ctx.getResourceDefinition("Binary").newInstance();
binary.setContentType(ct);
- binary.setContent(theRequest.loadRequestContents(theRequest));
+ binary.setContent(theRequest.loadRequestContents());
retVal = binary;
} else {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulResponse.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulResponse.java
index afbb3000fd3..a88aa73711b 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulResponse.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulResponse.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server;
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2015 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java
index 6029f2ebeb5..b97395a69d9 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server;
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2015 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
import ca.uhn.fhir.context.FhirContext;
public interface IRestfulServerDefaults {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerUtil.java
index b55330d0836..abe86bbfee8 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerUtil.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerUtil.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server;
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2015 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.rest.method.BaseMethodBinding;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/PageProvider.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/PageProvider.java
index e6dc7af9992..3af59f57946 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/PageProvider.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/PageProvider.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server;
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2015 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.rest.annotation.GetPage;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulResponse.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulResponse.java
index 7d30b9f7959..e79840480f2 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulResponse.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulResponse.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server;
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2015 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
import java.io.IOException;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
index 9ac8c538d2f..3e2fd30ac04 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
@@ -80,13 +80,13 @@ import ca.uhn.fhir.util.VersionUtil;
public class RestfulServer extends HttpServlet implements IRestfulServer
Accept
header
- * in the request. The default is {@link EncodingEnum#XML}. Will not return null.
+ * Returns the default encoding to return (XML/JSON) if an incoming request does not specify a preference (either
+ * with the _format
URL parameter, or with an Accept
header in the request. The default is
+ * {@link EncodingEnum#XML}. Will not return null.
*/
@Override
public EncodingEnum getDefaultResponseEncoding() {
@@ -344,8 +391,8 @@ public class RestfulServer extends HttpServlet implements IRestfulServer
- * By default, the ServerConformanceProvider for the declared version of FHIR is used, but this can be changed, or set to null
to use the appropriate one for the given FHIR version.
+ * By default, the ServerConformanceProvider for the declared version of FHIR is used, but this can be changed, or
+ * set to null
to use the appropriate one for the given FHIR version.
*
Accept
header in the request, or a _pretty
parameter in the request URL.
+ *
+ * The default is false
+ *
true
). Typically this
+ * should be set to true
unless the server has other configuration to deal with decompressing request
+ * bodies (e.g. a filter applied to the whole server).
+ */
+ public boolean isUncompressIncomingContents() {
+ return myUncompressIncomingContents;
+ }
+
+ @Override
+ public boolean isUseBrowserFriendlyContentTypes() {
+ return myUseBrowserFriendlyContentTypes;
}
public void populateRequestDetailsFromRequestPath(RequestDetails theRequestDetails, String theRequestPath) {
StringTokenizer tok = new StringTokenizer(theRequestPath, "/");
String resourceName = null;
-
+
IdDt id = null;
String operation = null;
String compartment = null;
@@ -752,118 +939,41 @@ public class RestfulServer extends HttpServlet implements IRestfulServerAccept
header in the request, or a _pretty
- * parameter in the request URL.
- *
- * The default is false
- *
_pretty
- * parameter in the request URL.
+ * Should the server "pretty print" responses by default (requesting clients can always override this default by
+ * supplying an Accept
header in the request, or a _pretty
parameter in the request URL.
*
* The default is false
*
Accept
header in
- * the request. The default is {@link EncodingEnum#XML}.
+ * Sets the default encoding to return (XML/JSON) if an incoming request does not specify a preference (either with
+ * the _format
URL parameter, or with an Accept
header in the request. The default is
+ * {@link EncodingEnum#XML}.
* - * Note when testing this feature: Some browsers will include "application/xml" in their Accept header, which means that the + * Note when testing this feature: Some browsers will include "application/xml" in their Accept header, which means + * that the *
*/ public void setDefaultResponseEncoding(EncodingEnum theDefaultResponseEncoding) { @@ -1103,7 +1168,8 @@ public class RestfulServer extends HttpServlet implements IRestfulServernull
. Default is
+ * {@link #DEFAULT_ETAG_SUPPORT}
*
* @param theETagSupport
* The ETag support mode
@@ -1211,7 +1277,8 @@ public class RestfulServer extends HttpServlet implements IRestfulServernull
if you do not wish to export a conformance
- * statement.
+ * By default, the ServerConformanceProvider implementation for the declared version of FHIR is used, but this can be
+ * changed, or set to null
if you do not wish to export a conformance statement.
*
* Note that this method can only be called before the server is initialized.
*
* @throws IllegalStateException
- * Note that this method can only be called prior to {@link #init() initialization} and will throw an {@link IllegalStateException} if called after that.
+ * Note that this method can only be called prior to {@link #init() initialization} and will throw an
+ * {@link IllegalStateException} if called after that.
*/
public void setServerConformanceProvider(Object theServerConformanceProvider) {
if (myStarted) {
@@ -1237,35 +1306,46 @@ public class RestfulServer extends HttpServlet implements IRestfulServertrue
). Typically this
+ * should be set to true
unless the server has other configuration to deal with decompressing request
+ * bodies (e.g. a filter applied to the whole server).
+ */
+ public void setUncompressIncomingContents(boolean theUncompressIncomingContents) {
+ myUncompressIncomingContents = theUncompressIncomingContents;
+ }
+
+ /**
+ * If set to true
(default is false), the server will use browser friendly content-types (instead of
+ * standard FHIR ones) when it detects that the request is coming from a browser instead of a FHIR
*/
public void setUseBrowserFriendlyContentTypes(boolean theUseBrowserFriendlyContentTypes) {
myUseBrowserFriendlyContentTypes = theUseBrowserFriendlyContentTypes;
@@ -1276,6 +1356,46 @@ public class RestfulServer extends HttpServlet implements IRestfulServernull
+ */
+ public void setValueAsEnum(Collectionnull
+ */
+ public void setValueAsEnum(T theValue) {
+ Validate.notNull(myBinder, "This object does not have a binder. Constructor BoundCodeableConceptDt() should not be called!");
+ getCoding().clear();
+ if (theValue == null) {
+ return;
+ }
+ getCoding().add(new CodingDt(myBinder.toSystemString(theValue), myBinder.toCodeString(theValue)));
+ }
+
+ /**
+ * Loops through the {@link #getCoding() codings} in this codeable concept
+ * and returns the first bound enumerated type that matches. Use
+ * caution using this method, see the return description for more
+ * information.
+ *
+ * @return Returns the bound enumerated type, or null
if none
+ * are found. Note that a null return value doesn't neccesarily
+ * imply that this Codeable Concept has no codes, only that it has
+ * no codes that match the enum.
+ */
+ public Set+ * Definition: + * A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text + *
+ * + *+ * Requirements: + * This is a common pattern in healthcare - a concept that may be defined by one or more codes from formal definitions including LOINC and SNOMED CT, and/or defined by the provision of text that captures a human sense of the concept + *
+ */ +@DatatypeDef(name="CodeableConceptDt") +public class CodeableConceptDt + extends BaseIdentifiableElement implements ICompositeDatatype{ + + /** + * Constructor + */ + public CodeableConceptDt() { + // nothing + } + + /** + * Constructor which creates a CodeableConceptDt with one coding repetition, containing + * the given system and code + */ + public CodeableConceptDt(String theSystem, String theCode) { + addCoding().setSystem(theSystem).setCode(theCode); + } + + @Child(name="coding", type=CodingDt.class, order=0, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) + @Description( + shortDefinition="", + formalDefinition="A reference to a code defined by a terminology system" + ) + private java.util.Listnull
.
+ *
+ * + * Definition: + * A reference to a code defined by a terminology system + *
+ */ + public java.util.List+ * Definition: + * A reference to a code defined by a terminology system + *
+ */ + public CodeableConceptDt setCoding(java.util.List+ * Definition: + * A reference to a code defined by a terminology system + *
+ */ + public CodingDt addCoding() { + CodingDt newType = new CodingDt(); + getCoding().add(newType); + return newType; + } + + /** + * Adds a given new value for coding () + * + *+ * Definition: + * A reference to a code defined by a terminology system + *
+ * @param theValue The coding to add (must not benull
)
+ */
+ public CodeableConceptDt addCoding(CodingDt theValue) {
+ if (theValue == null) {
+ throw new NullPointerException("theValue must not be null");
+ }
+ getCoding().add(theValue);
+ return this;
+ }
+
+ /**
+ * Gets the first repetition for coding (),
+ * creating it if it does not already exist.
+ *
+ * + * Definition: + * A reference to a code defined by a terminology system + *
+ */ + public CodingDt getCodingFirstRep() { + if (getCoding().isEmpty()) { + return addCoding(); + } + return getCoding().get(0); + } + + /** + * Gets the value(s) for text (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user + *
+ */ + public StringDt getTextElement() { + if (myText == null) { + myText = new StringDt(); + } + return myText; + } + + + /** + * Gets the value(s) for text (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user + *
+ */ + public String getText() { + return getTextElement().getValue(); + } + + /** + * Sets the value(s) for text () + * + *+ * Definition: + * A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user + *
+ */ + public CodeableConceptDt setText(StringDt theValue) { + myText = theValue; + return this; + } + + + + /** + * Sets the value for text () + * + *+ * Definition: + * A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user + *
+ */ + public CodeableConceptDt setText( String theString) { + myText = new StringDt(theString); + return this; + } + + + + +} \ No newline at end of file diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/CodingDt.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/CodingDt.java new file mode 100644 index 00000000000..254eb32b01e --- /dev/null +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/CodingDt.java @@ -0,0 +1,426 @@ + + + + + + + + + + + + + + + + +package ca.uhn.fhir.model.dstu21.composite; + +import java.util.List; + +import ca.uhn.fhir.model.api.ICompositeDatatype; +import ca.uhn.fhir.model.api.IElement; +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.base.composite.BaseCodingDt; +import ca.uhn.fhir.model.primitive.BooleanDt; +import ca.uhn.fhir.model.primitive.CodeDt; +import ca.uhn.fhir.model.primitive.StringDt; +import ca.uhn.fhir.model.primitive.UriDt; + +/** + * HAPI/FHIR CodingDt Datatype + * () + * + *+ * Definition: + * A reference to a code defined by a terminology system + *
+ * + *+ * Requirements: + * References to codes are very common in healthcare models + *
+ */ +@DatatypeDef(name="CodingDt") +public class CodingDt + extends BaseCodingDt implements ICompositeDatatype, org.hl7.fhir.instance.model.api.IBaseCoding { + + /** + * Constructor + */ + public CodingDt() { + // nothing + } + + /** + * Creates a new Coding with the given system and code + */ + public CodingDt(String theSystem, String theCode) { + setSystem(theSystem); + setCode(theCode); + } + + /** + * Copy constructor: Creates a new Coding with the system and code copied out of the given coding + */ + public CodingDt(BaseCodingDt theCoding) { + this(theCoding.getSystemElement().getValueAsString(), theCoding.getCodeElement().getValue()); + } + + + @Child(name="system", type=UriDt.class, order=0, min=0, max=1, summary=true, modifier=false) + @Description( + shortDefinition="", + formalDefinition="The identification of the code system that defines the meaning of the symbol in the code." + ) + private UriDt mySystem; + + @Child(name="version", type=StringDt.class, order=1, min=0, max=1, summary=true, modifier=false) + @Description( + shortDefinition="", + formalDefinition="The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged" + ) + private StringDt myVersion; + + @Child(name="code", type=CodeDt.class, order=2, min=0, max=1, summary=true, modifier=false) + @Description( + shortDefinition="", + formalDefinition="A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)" + ) + private CodeDt myCode; + + @Child(name="display", type=StringDt.class, order=3, min=0, max=1, summary=true, modifier=false) + @Description( + shortDefinition="", + formalDefinition="A representation of the meaning of the code in the system, following the rules of the system" + ) + private StringDt myDisplay; + + @Child(name="userSelected", type=BooleanDt.class, order=4, min=0, max=1, summary=true, modifier=false) + @Description( + shortDefinition="", + formalDefinition="Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays)" + ) + private BooleanDt myUserSelected; + + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySystem, myVersion, myCode, myDisplay, myUserSelected); + } + + @Override + publicnull
.
+ *
+ * + * Definition: + * The identification of the code system that defines the meaning of the symbol in the code. + *
+ */ + public UriDt getSystemElement() { + if (mySystem == null) { + mySystem = new UriDt(); + } + return mySystem; + } + + + /** + * Gets the value(s) for system (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * The identification of the code system that defines the meaning of the symbol in the code. + *
+ */ + public String getSystem() { + return getSystemElement().getValue(); + } + + /** + * Sets the value(s) for system () + * + *+ * Definition: + * The identification of the code system that defines the meaning of the symbol in the code. + *
+ */ + public CodingDt setSystem(UriDt theValue) { + mySystem = theValue; + return this; + } + + + + /** + * Sets the value for system () + * + *+ * Definition: + * The identification of the code system that defines the meaning of the symbol in the code. + *
+ */ + public CodingDt setSystem( String theUri) { + mySystem = new UriDt(theUri); + return this; + } + + + /** + * Gets the value(s) for version (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged + *
+ */ + public StringDt getVersionElement() { + if (myVersion == null) { + myVersion = new StringDt(); + } + return myVersion; + } + + + /** + * Gets the value(s) for version (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged + *
+ */ + public String getVersion() { + return getVersionElement().getValue(); + } + + /** + * Sets the value(s) for version () + * + *+ * Definition: + * The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged + *
+ */ + public CodingDt setVersion(StringDt theValue) { + myVersion = theValue; + return this; + } + + + + /** + * Sets the value for version () + * + *+ * Definition: + * The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged + *
+ */ + public CodingDt setVersion( String theString) { + myVersion = new StringDt(theString); + return this; + } + + + /** + * Gets the value(s) for code (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination) + *
+ */ + public CodeDt getCodeElement() { + if (myCode == null) { + myCode = new CodeDt(); + } + return myCode; + } + + + /** + * Gets the value(s) for code (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination) + *
+ */ + public String getCode() { + return getCodeElement().getValue(); + } + + /** + * Sets the value(s) for code () + * + *+ * Definition: + * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination) + *
+ */ + public CodingDt setCode(CodeDt theValue) { + myCode = theValue; + return this; + } + + + + /** + * Sets the value for code () + * + *+ * Definition: + * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination) + *
+ */ + public CodingDt setCode( String theCode) { + myCode = new CodeDt(theCode); + return this; + } + + + /** + * Gets the value(s) for display (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * A representation of the meaning of the code in the system, following the rules of the system + *
+ */ + public StringDt getDisplayElement() { + if (myDisplay == null) { + myDisplay = new StringDt(); + } + return myDisplay; + } + + + /** + * Gets the value(s) for display (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * A representation of the meaning of the code in the system, following the rules of the system + *
+ */ + public String getDisplay() { + return getDisplayElement().getValue(); + } + + /** + * Sets the value(s) for display () + * + *+ * Definition: + * A representation of the meaning of the code in the system, following the rules of the system + *
+ */ + public CodingDt setDisplay(StringDt theValue) { + myDisplay = theValue; + return this; + } + + + + /** + * Sets the value for display () + * + *+ * Definition: + * A representation of the meaning of the code in the system, following the rules of the system + *
+ */ + public CodingDt setDisplay( String theString) { + myDisplay = new StringDt(theString); + return this; + } + + + /** + * Gets the value(s) for userSelected (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays) + *
+ */ + public BooleanDt getUserSelectedElement() { + if (myUserSelected == null) { + myUserSelected = new BooleanDt(); + } + return myUserSelected; + } + + + /** + * Gets the value(s) for userSelected (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays) + *
+ */ + public Boolean getUserSelected() { + return getUserSelectedElement().getValue(); + } + + /** + * Sets the value(s) for userSelected () + * + *+ * Definition: + * Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays) + *
+ */ + public CodingDt setUserSelected(BooleanDt theValue) { + myUserSelected = theValue; + return this; + } + + + + /** + * Sets the value for userSelected () + * + *+ * Definition: + * Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays) + *
+ */ + public CodingDt setUserSelected( boolean theBoolean) { + myUserSelected = new BooleanDt(theBoolean); + return this; + } + + + + +} \ No newline at end of file diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/ContainedDt.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/ContainedDt.java new file mode 100644 index 00000000000..3f3f2f2322d --- /dev/null +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/ContainedDt.java @@ -0,0 +1,54 @@ +package ca.uhn.fhir.model.dstu21.composite; + +/* + * #%L + * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0) + * %% + * Copyright (C) 2014 - 2015 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import java.util.ArrayList; +import java.util.List; + +import ca.uhn.fhir.model.api.IDatatype; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.base.composite.BaseContainedDt; + +@DatatypeDef(name = "contained") +public class ContainedDt extends BaseContainedDt { + + @Child(name = "resource", type = IResource.class, order = 0, min = 0, max = Child.MAX_UNLIMITED) + private List+ * Definition: + * A human-readable formatted text, including images + *
+ * + *+ * Requirements: + * + *
+ */ +@DatatypeDef(name="Narrative") +public class NarrativeDt extends BaseNarrativeDt { + + @Child(name="div", type=XhtmlDt.class, order=1, min=1, max=1) + private XhtmlDt myDiv; + + public NarrativeDt() { + // nothing + } + + @Override + public boolean isEmpty() { + return ca.uhn.fhir.util.ElementUtil.isEmpty( myDiv ); + } + + + @Override + publicnull
.
+ *
+ * + * Definition: + * The actual narrative content, a stripped down version of XHTML + *
+ */ + public XhtmlDt getDivElement() { + return getDiv(); + } + + /** + * Gets the value(s) for div (Limited xhtml content). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * The actual narrative content, a stripped down version of XHTML + *
+ */ + public XhtmlDt getDiv() { + if (myDiv == null) { + myDiv = new XhtmlDt(); + } + return myDiv; + } + + /** + * Sets the value(s) for div (Limited xhtml content) + * + *+ * Definition: + * The actual narrative content, a stripped down version of XHTML + *
+ */ + public void setDiv(XhtmlDt theValue) { + myDiv = theValue; + } + + /** + * Sets the value using a textual DIV (or simple text block which will be + * converted to XHTML) + */ + public void setDiv(String theTextDiv) { + myDiv = new XhtmlDt(theTextDiv); + } + + @Override + public BoundCodeDt getStatus() { + return null; + } + + + + +} diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/QuantityDt.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/QuantityDt.java new file mode 100644 index 00000000000..7c6b173144d --- /dev/null +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/QuantityDt.java @@ -0,0 +1,523 @@ + + + + + + + + + + + + + + + + +package ca.uhn.fhir.model.dstu21.composite; + +import java.math.BigDecimal; +import java.util.List; + +import ca.uhn.fhir.model.api.ICompositeDatatype; +import ca.uhn.fhir.model.api.IElement; +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.api.annotation.SimpleSetter; +import ca.uhn.fhir.model.base.composite.BaseQuantityDt; +import ca.uhn.fhir.model.dstu2.valueset.QuantityComparatorEnum; +import ca.uhn.fhir.model.primitive.BoundCodeDt; +import ca.uhn.fhir.model.primitive.CodeDt; +import ca.uhn.fhir.model.primitive.DecimalDt; +import ca.uhn.fhir.model.primitive.StringDt; +import ca.uhn.fhir.model.primitive.UriDt; + +/** + * HAPI/FHIR QuantityDt Datatype + * () + * + *+ * Definition: + * A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies + *
+ * + *+ * Requirements: + * Need to able to capture all sorts of measured values, even if the measured value are not precisely quantified. Values include exact measures such as 3.51g, customary units such as 3 tablets, and currencies such as $100.32USD + *
+ */ +@DatatypeDef(name="QuantityDt") +public class QuantityDt + extends BaseQuantityDt implements ICompositeDatatype{ + + /** + * Constructor + */ + public QuantityDt() { + // nothing + } + + + /** + * Constructor + */ + @SimpleSetter + public QuantityDt(@SimpleSetter.Parameter(name="theValue") double theValue) { + setValue(theValue); + } + + /** + * Constructor + */ + @SimpleSetter + public QuantityDt(@SimpleSetter.Parameter(name="theValue") long theValue) { + setValue(theValue); + } + + /** + * Constructor + */ + @SimpleSetter + public QuantityDt(@SimpleSetter.Parameter(name = "theComparator") QuantityComparatorEnum theComparator, @SimpleSetter.Parameter(name = "theValue") double theValue, + @SimpleSetter.Parameter(name = "theUnits") String theUnits) { + setValue(theValue); + setComparator(theComparator); + setUnits(theUnits); + } + + /** + * Constructor + */ + @SimpleSetter + public QuantityDt(@SimpleSetter.Parameter(name = "theComparator") QuantityComparatorEnum theComparator, @SimpleSetter.Parameter(name = "theValue") long theValue, + @SimpleSetter.Parameter(name = "theUnits") String theUnits) { + setValue(theValue); + setComparator(theComparator); + setUnits(theUnits); + } + + /** + * Constructor + */ + @SimpleSetter + public QuantityDt(@SimpleSetter.Parameter(name="theComparator") QuantityComparatorEnum theComparator, @SimpleSetter.Parameter(name="theValue") double theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) { + setValue(theValue); + setComparator(theComparator); + setSystem(theSystem); + setUnits(theUnits); + } + + /** + * Constructor + */ + @SimpleSetter + public QuantityDt(@SimpleSetter.Parameter(name="theComparator") QuantityComparatorEnum theComparator, @SimpleSetter.Parameter(name="theValue") long theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) { + setValue(theValue); + setComparator(theComparator); + setSystem(theSystem); + setUnits(theUnits); + } + + /** + * @deprecated Use {@link #setUnit(String)} instead - Quantity.units was renamed to Quantity.unit in DSTU2 + */ + @Deprecated + @Override + public BaseQuantityDt setUnits(String theString) { + return setUnit(theString); + } + + /** + * @deprecated Use {@link #getUnitElement()} - Quantity.units was renamed to Quantity.unit in DSTU2 + */ + @Deprecated + @Override + public StringDt getUnitsElement() { + return getUnitElement(); + } + + @Child(name="value", type=DecimalDt.class, order=0, min=0, max=1, summary=true, modifier=false) + @Description( + shortDefinition="", + formalDefinition="The value of the measured amount. The value includes an implicit precision in the presentation of the value" + ) + private DecimalDt myValue; + + @Child(name="comparator", type=CodeDt.class, order=1, min=0, max=1, summary=true, modifier=true) + @Description( + shortDefinition="", + formalDefinition="How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value" + ) + private BoundCodeDtnull
.
+ *
+ * + * Definition: + * The value of the measured amount. The value includes an implicit precision in the presentation of the value + *
+ */ + public DecimalDt getValueElement() { + if (myValue == null) { + myValue = new DecimalDt(); + } + return myValue; + } + + + /** + * Gets the value(s) for value (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * The value of the measured amount. The value includes an implicit precision in the presentation of the value + *
+ */ + public BigDecimal getValue() { + return getValueElement().getValue(); + } + + /** + * Sets the value(s) for value () + * + *+ * Definition: + * The value of the measured amount. The value includes an implicit precision in the presentation of the value + *
+ */ + public QuantityDt setValue(DecimalDt theValue) { + myValue = theValue; + return this; + } + + + + /** + * Sets the value for value () + * + *+ * Definition: + * The value of the measured amount. The value includes an implicit precision in the presentation of the value + *
+ */ + public QuantityDt setValue( long theValue) { + myValue = new DecimalDt(theValue); + return this; + } + + /** + * Sets the value for value () + * + *+ * Definition: + * The value of the measured amount. The value includes an implicit precision in the presentation of the value + *
+ */ + public QuantityDt setValue( double theValue) { + myValue = new DecimalDt(theValue); + return this; + } + + /** + * Sets the value for value () + * + *+ * Definition: + * The value of the measured amount. The value includes an implicit precision in the presentation of the value + *
+ */ + public QuantityDt setValue( java.math.BigDecimal theValue) { + myValue = new DecimalDt(theValue); + return this; + } + + + /** + * Gets the value(s) for comparator (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value + *
+ */ + public BoundCodeDtnull
.
+ *
+ * + * Definition: + * How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value + *
+ */ + public String getComparator() { + return getComparatorElement().getValue(); + } + + /** + * Sets the value(s) for comparator () + * + *+ * Definition: + * How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value + *
+ */ + public QuantityDt setComparator(BoundCodeDt+ * Definition: + * How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value + *
+ */ + public QuantityDt setComparator(QuantityComparatorEnum theValue) { + setComparator(new BoundCodeDtnull
.
+ *
+ * + * Definition: + * A human-readable form of the unit + *
+ */ + public StringDt getUnitElement() { + if (myUnit == null) { + myUnit = new StringDt(); + } + return myUnit; + } + + + /** + * Gets the value(s) for unit (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * A human-readable form of the unit + *
+ */ + public String getUnit() { + return getUnitElement().getValue(); + } + + /** + * Sets the value(s) for unit () + * + *+ * Definition: + * A human-readable form of the unit + *
+ */ + public QuantityDt setUnit(StringDt theValue) { + myUnit = theValue; + return this; + } + + + + /** + * Sets the value for unit () + * + *+ * Definition: + * A human-readable form of the unit + *
+ */ + public QuantityDt setUnit( String theString) { + myUnit = new StringDt(theString); + return this; + } + + + /** + * Gets the value(s) for system (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * The identification of the system that provides the coded form of the unit + *
+ */ + public UriDt getSystemElement() { + if (mySystem == null) { + mySystem = new UriDt(); + } + return mySystem; + } + + + /** + * Gets the value(s) for system (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * The identification of the system that provides the coded form of the unit + *
+ */ + public String getSystem() { + return getSystemElement().getValue(); + } + + /** + * Sets the value(s) for system () + * + *+ * Definition: + * The identification of the system that provides the coded form of the unit + *
+ */ + public QuantityDt setSystem(UriDt theValue) { + mySystem = theValue; + return this; + } + + + + /** + * Sets the value for system () + * + *+ * Definition: + * The identification of the system that provides the coded form of the unit + *
+ */ + public QuantityDt setSystem( String theUri) { + mySystem = new UriDt(theUri); + return this; + } + + + /** + * Gets the value(s) for code (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * A computer processable form of the unit in some unit representation system + *
+ */ + public CodeDt getCodeElement() { + if (myCode == null) { + myCode = new CodeDt(); + } + return myCode; + } + + + /** + * Gets the value(s) for code (). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * A computer processable form of the unit in some unit representation system + *
+ */ + public String getCode() { + return getCodeElement().getValue(); + } + + /** + * Sets the value(s) for code () + * + *+ * Definition: + * A computer processable form of the unit in some unit representation system + *
+ */ + public QuantityDt setCode(CodeDt theValue) { + myCode = theValue; + return this; + } + + + + /** + * Sets the value for code () + * + *+ * Definition: + * A computer processable form of the unit in some unit representation system + *
+ */ + public QuantityDt setCode( String theCode) { + myCode = new CodeDt(theCode); + return this; + } + + + + +} \ No newline at end of file diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/ResourceReferenceDt.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/ResourceReferenceDt.java new file mode 100644 index 00000000000..54ce5c234da --- /dev/null +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/ResourceReferenceDt.java @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + +package ca.uhn.fhir.model.dstu21.composite; + +/* + * #%L + * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0) + * %% + * Copyright (C) 2014 - 2015 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +import java.util.List; + +import org.hl7.fhir.instance.model.api.IIdType; + +import ca.uhn.fhir.model.api.ICompositeDatatype; +import ca.uhn.fhir.model.api.IElement; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.api.annotation.SimpleSetter; +import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; +import ca.uhn.fhir.model.primitive.IdDt; +import ca.uhn.fhir.model.primitive.StringDt; + +/** + * HAPI/FHIR ResourceReferenceDt Datatype + * (A reference from one resource to another) + * + *+ * Definition: + * A reference from one resource to another + *
+ * + *+ * Requirements: + * + *
+ */ +@DatatypeDef(name="ResourceReferenceDt") +public class ResourceReferenceDt + extends BaseResourceReferenceDt implements ICompositeDatatype +{ + + /** + * Constructor + */ + public ResourceReferenceDt() { + // nothing + } + + /** + * Constructor which creates a resource reference containing the actual resource in question. + *+ * When using this in a server: Generally if this is serialized, it will be serialized as a contained + * resource, so this should not be used if the intent is not to actually supply the referenced resource. This is not + * a hard-and-fast rule however, as the server can be configured to not serialized this resource, or to load an ID + * and contain even if this constructor is not used. + *
+ * + * @param theResource + * The resource instance + */ + @SimpleSetter() + public ResourceReferenceDt(IResource theResource) { + super(theResource); + } + + /** + * Constructor which accepts a reference directly (this can be an ID, a partial/relative URL or a complete/absolute + * URL) + * + * @param theId + * The reference itself + */ + public ResourceReferenceDt(String theId) { + setReference(new IdDt(theId)); + } + + /** + * Constructor which accepts a reference directly (this can be an ID, a partial/relative URL or a complete/absolute + * URL) + * + * @param theResourceId + * The reference itself + */ + public ResourceReferenceDt(IdDt theResourceId) { + setReference(theResourceId); + } + + /** + * Constructor which accepts a reference directly (this can be an ID, a partial/relative URL or a complete/absolute + * URL) + * + * @param theResourceId + * The reference itself + */ + public ResourceReferenceDt(IIdType theResourceId) { + setReference(theResourceId); + } + + @Child(name="reference", type=IdDt.class, order=0, min=0, max=1) + @Description( + shortDefinition="Relative, internal or absolute URL reference", + formalDefinition="A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources" + ) + private IdDt myReference; + + @Child(name="display", type=StringDt.class, order=1, min=0, max=1) + @Description( + shortDefinition="Text alternative for the resource", + formalDefinition="Plain text narrative that identifies the resource in addition to the resource reference" + ) + private StringDt myDisplay; + + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myReference, myDisplay); + } + + @Override + publicnull
.
+ *
+ * + * Definition: + * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources + *
+ */ + public IdDt getReference() { + if (myReference == null) { + myReference = new IdDt(); + } + return myReference; + } + + @Override + public IdDt getReferenceElement() { + return getReference(); + } + + + /** + * Sets the value(s) for reference (Relative, internal or absolute URL reference) + * + *+ * Definition: + * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources + *
+ */ + public ResourceReferenceDt setReference(IdDt theValue) { + myReference = theValue; + return this; + } + + /** + * Sets the value for reference (Relative, internal or absolute URL reference) + * + *+ * Definition: + * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources + *
+ */ + public ResourceReferenceDt setReference( String theId) { + myReference = new IdDt(theId); + return this; + } + + + /** + * Gets the value(s) for display (Text alternative for the resource). + * creating it if it does + * not exist. Will not returnnull
.
+ *
+ * + * Definition: + * Plain text narrative that identifies the resource in addition to the resource reference + *
+ */ + public StringDt getDisplay() { + if (myDisplay == null) { + myDisplay = new StringDt(); + } + return myDisplay; + } + + /** + * Sets the value(s) for display (Text alternative for the resource) + * + *+ * Definition: + * Plain text narrative that identifies the resource in addition to the resource reference + *
+ */ + public ResourceReferenceDt setDisplay(StringDt theValue) { + myDisplay = theValue; + return this; + } + + /** + * Sets the value for display (Text alternative for the resource) + * + *+ * Definition: + * Plain text narrative that identifies the resource in addition to the resource reference + *
+ */ + public ResourceReferenceDt setDisplay( String theString) { + myDisplay = new StringDt(theString); + return this; + } + + @Override + public StringDt getDisplayElement() { + return getDisplay(); + } + + + + +} diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/SimpleQuantityDt.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/SimpleQuantityDt.java new file mode 100644 index 00000000000..5e26b311014 --- /dev/null +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu21/composite/SimpleQuantityDt.java @@ -0,0 +1,98 @@ +package ca.uhn.fhir.model.dstu21.composite; + +import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.api.annotation.SimpleSetter; +import ca.uhn.fhir.model.dstu2.valueset.QuantityComparatorEnum; + +/* + * #%L + * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0) + * %% + * Copyright (C) 2014 - 2015 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + +@DatatypeDef(name="SimpleQuantity") +public class SimpleQuantityDt extends QuantityDt { + + private static final long serialVersionUID = 1L; + + /** + * Constructor + */ + public SimpleQuantityDt() { + // nothing + } + + + /** + * Constructor + */ + @SimpleSetter + public SimpleQuantityDt(@SimpleSetter.Parameter(name="theValue") double theValue) { + setValue(theValue); + } + + /** + * Constructor + */ + @SimpleSetter + public SimpleQuantityDt(@SimpleSetter.Parameter(name="theValue") long theValue) { + setValue(theValue); + } + + /** + * Constructor + */ + @SimpleSetter + public SimpleQuantityDt(@SimpleSetter.Parameter(name = "theComparator") QuantityComparatorEnum theComparator, @SimpleSetter.Parameter(name = "theValue") double theValue, + @SimpleSetter.Parameter(name = "theUnits") String theUnits) { + setValue(theValue); + setComparator(theComparator); + setUnit(theUnits); + } + + /** + * Constructor + */ + @SimpleSetter + public SimpleQuantityDt(@SimpleSetter.Parameter(name = "theComparator") QuantityComparatorEnum theComparator, @SimpleSetter.Parameter(name = "theValue") long theValue, + @SimpleSetter.Parameter(name = "theUnits") String theUnits) { + setValue(theValue); + setComparator(theComparator); + setUnit(theUnits); + } + + /** + * Constructor + */ + @SimpleSetter + public SimpleQuantityDt(@SimpleSetter.Parameter(name="theValue") double theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) { + setValue(theValue); + setSystem(theSystem); + setUnit(theUnits); + } + + /** + * Constructor + */ + @SimpleSetter + public SimpleQuantityDt(@SimpleSetter.Parameter(name="theValue") long theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) { + setValue(theValue); + setSystem(theSystem); + setUnit(theUnits); + } + +} diff --git a/src/changes/changes.xml b/src/changes/changes.xml index b0f260d22f0..04899c57d74 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -27,6 +27,12 @@
+ The GZipContentInterceptor
compresses outgoing contents.
+ With this interceptor, if the client is transmitting resources to the server
+ (e.g. for a create, update, transaction, etc.) the content will be GZipped
+ before transmission to the server.
+