From 70aa4e812d550108ec876c7f7b65de5fcd300c81 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Mon, 16 Feb 2015 23:02:50 -0500 Subject: [PATCH] Work on build --- .../src/main/java/example/ClientExamples.java | 7 + examples/src/main/java/example/HttpProxy.java | 5 +- hapi-fhir-android/pom.xml | 2 +- .../ca/uhn/fhir/context/ModelScanner.java | 2 +- .../java/ca/uhn/fhir/parser/BaseParser.java | 56 + .../java/ca/uhn/fhir/parser/JsonParser.java | 17 +- .../java/ca/uhn/fhir/parser/ParserState.java | 19 +- .../java/ca/uhn/fhir/parser/XmlParser.java | 44 +- .../rest/client/IRestfulClientFactory.java | 8 + .../rest/client/RestfulClientFactory.java | 30 +- .../fhir/instance/model/api/IBaseBundle.java | 7 + .../uhn/fhir/rest/client/HttpProxyTest.java | 38 +- .../TransactionWithBundleParamTest.java | 24 +- hapi-fhir-structures-dstu2/pom.xml | 2 +- .../uhn/fhir/model/dstu2/schema/fhir-all.xsd | 3 +- .../uhn/fhir/model/dstu2/schema/fhir-base.xsd | 61 +- .../fhir/model/dstu2/schema/fhir-single.xsd | 743 +- .../ca/uhn/fhir/parser/JsonParserTest.java | 60 +- .../ca/uhn/fhir/parser/XmlParserTest.java | 48 +- ...ransactionWithBundleResourceParamTest.java | 234 + .../src/test/resources/bundle-example.json | 14 +- .../src/test/resources/bundle-example.xml | 22 +- hapi-fhir-structures-hl7org-dstu2/.classpath | 1 + .../org/hl7/fhir/instance/model/Bundle.java | 3 +- .../src/test/resources/bundle-example.xml | 52 + .../fhir/tinder/TinderJpaRestServerMojo.java | 3 + .../ca/uhn/fhir/tinder/model/BaseElement.java | 2 +- .../java/ca/uhn/fhir/tinder/model/Child.java | 5 + .../fhir/tinder/model/SearchParameter.java | 2 +- .../tinder/parser/BaseStructureParser.java | 3 + .../DatatypeGeneratorUsingSpreadsheet.java | 1 + .../res/dstu2/bundle-spreadsheet.xml | 1551 +- .../resources/vm/jpa_resource_provider.vm | 3 +- .../src/main/resources/vm/resource.vm | 5 +- .../src/main/resources/vm/templates.vm | 15 +- .../vs/dstu2/all-valuesets-bundle.xml | 37696 +++++++++------- pom.xml | 1 + 37 files changed, 23161 insertions(+), 17628 deletions(-) create mode 100644 hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseBundle.java create mode 100644 hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java create mode 100644 hapi-fhir-structures-hl7org-dstu2/src/test/resources/bundle-example.xml diff --git a/examples/src/main/java/example/ClientExamples.java b/examples/src/main/java/example/ClientExamples.java index cd22c69c41f..fcbec0495f6 100644 --- a/examples/src/main/java/example/ClientExamples.java +++ b/examples/src/main/java/example/ClientExamples.java @@ -20,8 +20,15 @@ public class ClientExamples { public void createProxy() { // START SNIPPET: proxy FhirContext ctx = new FhirContext(); + + // Set connections to access the network via the HTTP proxy at + // example.com : 8888 ctx.getRestfulClientFactory().setProxy("example.com", 8888); + // If the proxy requires authentication, use the following as well + ctx.getRestfulClientFactory().setProxyCredentials("theUsername", "thePassword"); + + // Create the client IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir"); // END SNIPPET: proxy } diff --git a/examples/src/main/java/example/HttpProxy.java b/examples/src/main/java/example/HttpProxy.java index 5a7106c6db9..73348773488 100644 --- a/examples/src/main/java/example/HttpProxy.java +++ b/examples/src/main/java/example/HttpProxy.java @@ -18,7 +18,10 @@ import ca.uhn.fhir.rest.client.IGenericClient; public class HttpProxy { public static void main(String[] args) { - + /* + * This is out ot date - Just keeping + * it in case it's helpful... + */ final String authUser = "username"; final String authPassword = "password"; CredentialsProvider credsProvider = new BasicCredentialsProvider(); diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index 1d3dccd06ba..d3c73a1c71f 100644 --- a/hapi-fhir-android/pom.xml +++ b/hapi-fhir-android/pom.xml @@ -12,7 +12,7 @@ hapi-fhir-android jar - HAPI FHIR - Distribution Archive + HAPI FHIR - Android diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java index df5a3b85206..44bd306f661 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java @@ -488,7 +488,7 @@ class ModelScanner { Class nextElementType = determineElementType(next); - if (IAnyResource.class.isAssignableFrom(nextElementType)) { + if (IAnyResource.class.isAssignableFrom(nextElementType) || IResource.class.equals(nextElementType)) { /* * Child is a resource as a direct child, as in Bundle.entry.resource */ diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java index 6e3ab1bca68..c93c297e1f1 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java @@ -38,18 +38,23 @@ import java.util.Set; import org.apache.commons.lang3.StringUtils; import org.hl7.fhir.instance.model.IBase; import org.hl7.fhir.instance.model.IBaseResource; +import org.hl7.fhir.instance.model.IPrimitiveType; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IDomainResource; import org.hl7.fhir.instance.model.api.IReference; import ca.uhn.fhir.context.BaseRuntimeChildDefinition; import ca.uhn.fhir.context.BaseRuntimeDeclaredChildDefinition; +import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition; +import ca.uhn.fhir.context.BaseRuntimeElementDefinition; import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeChildChoiceDefinition; +import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.BundleEntry; 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.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.primitive.IdDt; @@ -266,6 +271,57 @@ public abstract class BaseParser implements IParser { return parseResource(null, theReader); } + protected abstract T doParseResource(Class theResourceType, Reader theReader) throws DataFormatException; + + public T parseResource(Class theResourceType, Reader theReader) throws DataFormatException { + T retVal = doParseResource(theResourceType, theReader); + + RuntimeResourceDefinition def = myContext.getResourceDefinition(retVal); + if ("Bundle".equals(def.getName())) { + List base = def.getChildByName("base").getAccessor().getValues(retVal); + if (base != null && base.size() > 0) { + IPrimitiveType baseType = (IPrimitiveType) base.get(0); + IResource res = ((IResource)retVal); + res.setId(new IdDt(baseType.getValueAsString(), def.getName(), res.getId().getIdPart(), res.getId().getVersionIdPart())); + } + + BaseRuntimeChildDefinition entryChild = def.getChildByName("entry"); + BaseRuntimeElementCompositeDefinition entryDef = (BaseRuntimeElementCompositeDefinition) entryChild.getChildByName("entry"); + List entries = entryChild.getAccessor().getValues(retVal); + if (entries != null) { + for (IBase nextEntry : entries) { + List entryBase = entryDef.getChildByName("base").getAccessor().getValues(nextEntry); + + if (entryBase == null || entryBase.isEmpty()) { + entryBase = base; + } + + if (entryBase != null && entryBase.size() > 0) { + IPrimitiveType baseType = (IPrimitiveType) entryBase.get(0); + + List entryResources = entryDef.getChildByName("resource").getAccessor().getValues(nextEntry); + if (entryResources != null && entryResources.size() > 0) { + IResource res = (IResource) entryResources.get(0); + RuntimeResourceDefinition resDef = myContext.getResourceDefinition(res); + String versionIdPart = res.getId().getVersionIdPart(); + if (isBlank(versionIdPart)) { + versionIdPart = ResourceMetadataKeyEnum.VERSION.get(res); + } + + res.setId(new IdDt(baseType.getValueAsString(), resDef.getName(), res.getId().getIdPart(), versionIdPart)); + } + + } + + + } + } + + } + + return retVal; + } + @Override public IResource parseResource(String theMessageString) throws ConfigurationException, DataFormatException { return parseResource(null, theMessageString); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java index e7133e2c7e4..7c11fae1054 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java @@ -277,6 +277,13 @@ public class JsonParser extends BaseParser implements IParser { writeOptionalTagWithTextNode(theEventWriter, "base", determineResourceBaseUrl(theBundle.getLinkBase().getValue(), nextEntry)); + boolean deleted = nextEntry.getDeletedAt() != null && nextEntry.getDeletedAt().isEmpty() == false; + IResource resource = nextEntry.getResource(); + if (resource != null && !resource.isEmpty() && !deleted) { + RuntimeResourceDefinition resDef = myContext.getResourceDefinition(resource); + encodeResourceToJsonStreamWriter(resDef, resource, theEventWriter, "resource", false); + } + if (nextEntry.getSearchMode().isEmpty() == false || nextEntry.getScore().isEmpty() == false) { theEventWriter.writeStartObject("search"); writeOptionalTagWithTextNode(theEventWriter, "mode", nextEntry.getSearchMode().getValueAsString()); @@ -288,11 +295,10 @@ public class JsonParser extends BaseParser implements IParser { if (nextEntry.getTransactionOperation().isEmpty() == false || nextEntry.getLinkSearch().isEmpty() == false) { theEventWriter.writeStartObject("transaction"); writeOptionalTagWithTextNode(theEventWriter, "operation", nextEntry.getTransactionOperation().getValue()); - writeOptionalTagWithTextNode(theEventWriter, "match", nextEntry.getLinkSearch().getValue()); + writeOptionalTagWithTextNode(theEventWriter, "url", nextEntry.getLinkSearch().getValue()); theEventWriter.writeEnd(); } - boolean deleted = nextEntry.getDeletedAt() != null && nextEntry.getDeletedAt().isEmpty() == false; if (deleted) { theEventWriter.writeStartObject("deleted"); if (nextEntry.getResource() != null) { @@ -319,11 +325,6 @@ public class JsonParser extends BaseParser implements IParser { // // writeAuthor(nextEntry, theEventWriter); - IResource resource = nextEntry.getResource(); - if (resource != null && !resource.isEmpty() && !deleted) { - RuntimeResourceDefinition resDef = myContext.getResourceDefinition(resource); - encodeResourceToJsonStreamWriter(resDef, resource, theEventWriter, "resource", false); - } if (nextEntry.getSummary().isEmpty() == false) { theEventWriter.write("summary", nextEntry.getSummary().getValueAsString()); @@ -1096,7 +1097,7 @@ public class JsonParser extends BaseParser implements IParser { } @Override - public T parseResource(Class theResourceType, Reader theReader) { + public T doParseResource(Class theResourceType, Reader theReader) { JsonReader reader = Json.createReader(theReader); JsonObject object = reader.readObject(); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java index 13a23e074d7..1df2a0c1b1b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java @@ -1121,7 +1121,7 @@ class ParserState { public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException { if ("operation".equals(theLocalPart)) { push(new PrimitiveState(getPreResourceState(), myEntry.getTransactionOperation())); - } else if ("match".equals(theLocalPart)) { + } else if ("url".equals(theLocalPart)) { push(new PrimitiveState(getPreResourceState(), myEntry.getLinkSearch())); } else { throw new DataFormatException("Unexpected element in Bundle.entry.search: " + theLocalPart); @@ -1658,6 +1658,8 @@ class ParserState { public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException { if (theLocalPart.equals("versionId")) { push(new MetaVersionElementState(getPreResourceState(), myMap)); +// } else if (theLocalPart.equals("profile")) { +// } else if (theLocalPart.equals("lastUpdated")) { InstantDt updated = new InstantDt(); push(new PrimitiveState(getPreResourceState(), updated)); @@ -1759,10 +1761,23 @@ class ParserState { @Override public void wereBack() { super.wereBack(); - if (myEntry == null) { myObject = (T) getCurrentElement(); } + + IResource nextResource = (IResource) getCurrentElement(); + String version = ResourceMetadataKeyEnum.VERSION.get(nextResource); + String resourceName = myContext.getResourceDefinition(nextResource).getName(); + String bundleIdPart = nextResource.getId().getIdPart(); + if (isNotBlank(bundleIdPart)) { +// if (isNotBlank(entryBaseUrl)) { +// nextResource.setId(new IdDt(entryBaseUrl, resourceName, bundleIdPart, version)); +// } else { + nextResource.setId(new IdDt(null, resourceName, bundleIdPart, version)); +// } + } + + } @Override diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java index 490e6d796a1..f3d3fcd4bd6 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java @@ -81,6 +81,7 @@ import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.XhtmlDt; import ca.uhn.fhir.narrative.INarrativeGenerator; +import ca.uhn.fhir.rest.method.BaseMethodBinding; import ca.uhn.fhir.util.NonPrettyPrintWriterWrapper; import ca.uhn.fhir.util.PrettyPrintWriterWrapper; import ca.uhn.fhir.util.XmlUtil; @@ -385,8 +386,22 @@ public class XmlParser extends BaseParser implements IParser { for (BundleEntry nextEntry : theBundle.getEntries()) { theEventWriter.writeStartElement("entry"); + boolean deleted = false; + if (nextEntry.getDeletedAt() != null && nextEntry.getDeletedAt().isEmpty() == false) { + deleted = true; + } + writeOptionalTagWithValue(theEventWriter, "base", determineResourceBaseUrl(bundleBaseUrl, nextEntry)); + IResource resource = nextEntry.getResource(); + if (resource != null && !resource.isEmpty() && !deleted) { + theEventWriter.writeStartElement("resource"); + encodeResourceToXmlStreamWriter(resource, theEventWriter, false); + theEventWriter.writeEndElement(); // content + } else { + ourLog.debug("Bundle entry contains null resource"); + } + if (nextEntry.getSearchMode().isEmpty() == false || nextEntry.getScore().isEmpty() == false) { theEventWriter.writeStartElement("search"); writeOptionalTagWithValue(theEventWriter, "mode", nextEntry.getSearchMode().getValueAsString()); @@ -398,13 +413,11 @@ public class XmlParser extends BaseParser implements IParser { if (nextEntry.getTransactionOperation().isEmpty() == false || nextEntry.getLinkSearch().isEmpty() == false) { theEventWriter.writeStartElement("transaction"); writeOptionalTagWithValue(theEventWriter, "operation", nextEntry.getTransactionOperation().getValue()); - writeOptionalTagWithValue(theEventWriter, "match", nextEntry.getLinkSearch().getValue()); + writeOptionalTagWithValue(theEventWriter, "url", nextEntry.getLinkSearch().getValue()); theEventWriter.writeEndElement(); } - boolean deleted = false; - if (nextEntry.getDeletedAt() != null && nextEntry.getDeletedAt().isEmpty() == false) { - deleted = true; + if (deleted) { theEventWriter.writeStartElement("deleted"); writeOptionalTagWithValue(theEventWriter, "type", nextEntry.getId().getResourceType()); writeOptionalTagWithValue(theEventWriter, "id", nextEntry.getId().getIdPart()); @@ -413,15 +426,6 @@ public class XmlParser extends BaseParser implements IParser { theEventWriter.writeEndElement(); } - IResource resource = nextEntry.getResource(); - if (resource != null && !resource.isEmpty() && !deleted) { - theEventWriter.writeStartElement("resource"); - encodeResourceToXmlStreamWriter(resource, theEventWriter, false); - theEventWriter.writeEndElement(); // content - } else { - ourLog.debug("Bundle entry contains null resource"); - } - theEventWriter.writeEndElement(); // entry } @@ -488,7 +492,11 @@ public class XmlParser extends BaseParser implements IParser { break; } case RESOURCE: { - throw new IllegalStateException(); // should not happen + theEventWriter.writeStartElement(childName); + IBaseResource resource = (IBaseResource) nextValue; + encodeResourceToXmlStreamWriter(resource, theEventWriter, false); + theEventWriter.writeEndElement(); + break; } case PRIMITIVE_XHTML: { XhtmlDt dt = (XhtmlDt) nextValue; @@ -703,7 +711,11 @@ public class XmlParser extends BaseParser implements IParser { IdDt resourceId = resource.getId(); if (resourceId != null && isNotBlank(resourceId.getVersionIdPart()) || (updated != null && !updated.isEmpty())) { theEventWriter.writeStartElement("meta"); - writeOptionalTagWithValue(theEventWriter, "versionId", resourceId.getVersionIdPart()); + String versionIdPart = resourceId.getVersionIdPart(); + if (isBlank(versionIdPart)) { + versionIdPart = ResourceMetadataKeyEnum.VERSION.get(resource); + } + writeOptionalTagWithValue(theEventWriter, "versionId", versionIdPart); if (updated != null) { writeOptionalTagWithValue(theEventWriter, "lastUpdated", updated.getValueAsString()); } @@ -922,7 +934,7 @@ public class XmlParser extends BaseParser implements IParser { } @Override - public T parseResource(Class theResourceType, Reader theReader) { + public T doParseResource(Class theResourceType, Reader theReader) { XMLEventReader streamReader = createStreamReader(theReader); return parseResource(theResourceType, streamReader); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IRestfulClientFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IRestfulClientFactory.java index 453a76d6b6f..35bb74541a0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IRestfulClientFactory.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IRestfulClientFactory.java @@ -150,6 +150,14 @@ public interface IRestfulClientFactory { */ void setProxy(String theHost, Integer thePort); + /** + * Sets the credentials to use to authenticate with the HTTP proxy, + * if one is defined. Set to null to use no authentication with the proxy. + * @param theUsername The username + * @param thePassword The password + */ + void setProxyCredentials(String theUsername, String thePassword); + /** * Sets the server validation mode for any clients created from this factory. Server * validation involves the client requesting the server's conformance statement diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java index 406cb0ca09d..24d25eaac50 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java @@ -23,6 +23,7 @@ package ca.uhn.fhir.rest.client; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -32,9 +33,15 @@ import java.util.concurrent.TimeUnit; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; import org.apache.http.HttpHost; +import org.apache.http.auth.AuthScope; +import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.CredentialsProvider; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; +import org.apache.http.impl.client.BasicCredentialsProvider; +import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.client.ProxyAuthenticationStrategy; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import ca.uhn.fhir.context.ConfigurationException; @@ -100,18 +107,35 @@ public class RestfulClientFactory implements IRestfulClientFactory { .setProxy(myProxy) .build(); - myHttpClient = HttpClients.custom() + HttpClientBuilder builder = HttpClients.custom() .setConnectionManager(connectionManager) .setDefaultRequestConfig(defaultRequestConfig) - .disableCookieManagement() - .build(); + .disableCookieManagement(); + + if (myProxy != null && StringUtils.isNotBlank(myProxyUsername) && StringUtils.isNotBlank(myProxyPassword)) { + CredentialsProvider credsProvider = new BasicCredentialsProvider(); + credsProvider.setCredentials(new AuthScope(myProxy.getHostName(), myProxy.getPort()), new UsernamePasswordCredentials(myProxyUsername, myProxyPassword)); + builder.setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy()); + builder.setDefaultCredentialsProvider(credsProvider); + } + + myHttpClient = builder.build(); //@formatter:on } return myHttpClient; } + + private String myProxyUsername; + private String myProxyPassword; + @Override + public void setProxyCredentials(String theUsername, String thePassword) { + myProxyUsername=theUsername; + myProxyPassword=thePassword; + } + @Override public ServerValidationModeEnum getServerValidationModeEnum() { return myServerValidationMode; diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseBundle.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseBundle.java new file mode 100644 index 00000000000..7e92f595067 --- /dev/null +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseBundle.java @@ -0,0 +1,7 @@ +package org.hl7.fhir.instance.model.api; + +import org.hl7.fhir.instance.model.IBaseResource; + +public interface IBaseBundle extends IBaseResource { + +} diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/HttpProxyTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/HttpProxyTest.java index 8a2a644b57b..5e1a900387f 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/HttpProxyTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/HttpProxyTest.java @@ -86,25 +86,27 @@ public class HttpProxyTest { server.start(); try { - final String authUser = "username"; - final String authPassword = "password"; - CredentialsProvider credsProvider = new BasicCredentialsProvider(); - credsProvider.setCredentials(new AuthScope("127.0.0.1", port), new UsernamePasswordCredentials(authUser, authPassword)); - - HttpHost myProxy = new HttpHost("127.0.0.1", port); - - //@formatter:off - HttpClientBuilder clientBuilder = HttpClientBuilder.create(); - clientBuilder - .setProxy(myProxy) - .setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy()) - .setDefaultCredentialsProvider(credsProvider) - .disableCookieManagement(); - CloseableHttpClient httpClient = clientBuilder.build(); - //@formatter:on - - ourCtx.getRestfulClientFactory().setHttpClient(httpClient); +// final String authUser = "username"; +// final String authPassword = "password"; +// CredentialsProvider credsProvider = new BasicCredentialsProvider(); +// credsProvider.setCredentials(new AuthScope("127.0.0.1", port), new UsernamePasswordCredentials(authUser, authPassword)); +// +// HttpHost myProxy = new HttpHost("127.0.0.1", port); +// +// //@formatter:off +// HttpClientBuilder clientBuilder = HttpClientBuilder.create(); +// clientBuilder +// .setProxy(myProxy) +// .setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy()) +// .setDefaultCredentialsProvider(credsProvider) +// .disableCookieManagement(); +// CloseableHttpClient httpClient = clientBuilder.build(); +// //@formatter:on +// ourCtx.getRestfulClientFactory().setHttpClient(httpClient); + ourCtx.getRestfulClientFactory().setProxy("127.0.0.1", port); + ourCtx.getRestfulClientFactory().setProxyCredentials("username", "password"); + String baseUri = "http://99.99.99.99:" + port + "/rootctx/rcp2/fhirctx/fcp2"; IGenericClient client = ourCtx.newRestfulGenericClient(baseUri); diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleParamTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleParamTest.java index 3663a7fed24..0d4ec224d6a 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleParamTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleParamTest.java @@ -62,17 +62,17 @@ public class TransactionWithBundleParamTest { Patient p1 = new Patient(); p1.addName().addFamily("Family1"); BundleEntry entry = b.addEntry(); - entry.getId().setValue("1"); + p1.getId().setValue("1"); entry.setResource(p1); Patient p2 = new Patient(); p2.addName().addFamily("Family2"); entry = b.addEntry(); - entry.getId().setValue("2"); + p2.getId().setValue("2"); entry.setResource(p2); BundleEntry deletedEntry = b.addEntry(); - deletedEntry.setId(new IdDt("Patient/3")); + deletedEntry.setDeletedResourceId(new IdDt("Patient/3")); deletedEntry.setDeleted(nowInstant); String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b); @@ -92,17 +92,17 @@ public class TransactionWithBundleParamTest { assertEquals(3, bundle.size()); BundleEntry entry0 = bundle.getEntries().get(0); - assertEquals("http://localhost:" + ourPort + "/Patient/81", entry0.getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getResource().getId().getValue()); assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getLinkSelf().getValue()); assertEquals("http://localhost:" + ourPort + "/Patient/1", entry0.getLinkAlternate().getValue()); BundleEntry entry1 = bundle.getEntries().get(1); - assertEquals("http://localhost:" + ourPort + "/Patient/82", entry1.getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getResource().getId().getValue()); assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getLinkSelf().getValue()); assertEquals("http://localhost:" + ourPort + "/Patient/2", entry1.getLinkAlternate().getValue()); BundleEntry entry2 = bundle.getEntries().get(2); - assertEquals("http://localhost:" + ourPort + "/Patient/3", entry2.getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getResource().getId().getValue()); assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getLinkSelf().getValue()); assertEquals(nowInstant.getValueAsString(), entry2.getDeletedAt().getValueAsString()); } @@ -118,17 +118,17 @@ public class TransactionWithBundleParamTest { Patient p1 = new Patient(); p1.addName().addFamily("Family1"); BundleEntry entry = b.addEntry(); - entry.getId().setValue("1"); + p1.getId().setValue("1"); entry.setResource(p1); Patient p2 = new Patient(); p2.addName().addFamily("Family2"); entry = b.addEntry(); - entry.getId().setValue("2"); + p2.getId().setValue("2"); entry.setResource(p2); BundleEntry deletedEntry = b.addEntry(); - deletedEntry.setId(new IdDt("Patient/3")); + deletedEntry.setDeletedResourceId(new IdDt("Patient/3")); deletedEntry.setDeleted(nowInstant); String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b); @@ -151,17 +151,17 @@ public class TransactionWithBundleParamTest { assertEquals("OperationOutcome (no ID)", bundle.getEntries().get(0).getTitle().getValue()); BundleEntry entry0 = bundle.getEntries().get(1); - assertEquals("http://localhost:" + ourPort + "/Patient/81", entry0.getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getResource().getId().getValue()); assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getLinkSelf().getValue()); assertEquals("http://localhost:" + ourPort + "/Patient/1", entry0.getLinkAlternate().getValue()); BundleEntry entry1 = bundle.getEntries().get(2); - assertEquals("http://localhost:" + ourPort + "/Patient/82", entry1.getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getResource().getId().getValue()); assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getLinkSelf().getValue()); assertEquals("http://localhost:" + ourPort + "/Patient/2", entry1.getLinkAlternate().getValue()); BundleEntry entry2 = bundle.getEntries().get(3); - assertEquals("http://localhost:" + ourPort + "/Patient/3", entry2.getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getResource().getId().getValue()); assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getLinkSelf().getValue()); assertEquals(nowInstant.getValueAsString(), entry2.getDeletedAt().getValueAsString()); } diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index cabf8841248..44b8e44cafe 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -204,7 +204,7 @@ basic - + bundle careplan careplan2 diff --git a/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-all.xsd b/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-all.xsd index e2e022121bd..04c85162446 100644 --- a/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-all.xsd +++ b/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-all.xsd @@ -26,7 +26,7 @@ Copyright (c) 2011+, HL7, Inc ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - Generated on Sat, Feb 7, 2015 18:18+0000 for FHIR v0.4.0 + Generated on Sat, Feb 14, 2015 16:12-0500 for FHIR v0.4.0 --> @@ -122,6 +122,7 @@ Copyright (c) 2011+, HL7, Inc + diff --git a/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-base.xsd b/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-base.xsd index 0e5c7a40c82..d581532155b 100644 --- a/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-base.xsd +++ b/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-base.xsd @@ -27,7 +27,7 @@ POSSIBILITY OF SUCH DAMAGE. - Generated on Sat, Feb 7, 2015 18:18+0000 for FHIR v0.4.0 + Generated on Sat, Feb 14, 2015 16:12-0500 for FHIR v0.4.0 --> @@ -351,6 +351,7 @@ + @@ -358,6 +359,7 @@ + @@ -2301,7 +2303,7 @@ P.O. Box number, delivery hints, and similar address information. - + A resource that includes narrative, extensions, and contained resources. @@ -2330,6 +2332,41 @@ P.O. Box number, delivery hints, and similar address information. + + + + + The context is all elements matching a particular resource element path. + + + + + The context is all nodes matching a particular data type element path (root or repeating element) or all elements referencing a particular primitive data type (expressed as the datatype name). + + + + + The context is all nodes whose mapping to a specified reference model corresponds to a particular mapping structure. The context identifies the mapping target. The mapping should clearly identify where such an extension could be used. + + + + + The context is a particular extension from a particular profile. Expressed as uri#name, where uri identifies the profile and #name identifies the extension code. + + + + + + + + If the element is present, it must have either a @value, an @id, or extensions + + + + + + + @@ -2447,7 +2484,7 @@ P.O. Box number, delivery hints, and similar address information.The value is no longer available - + The are no known applicable values in this context @@ -2717,7 +2754,7 @@ P.O. Box number, delivery hints, and similar address information.The Patient is present for the encounter, however is not currently meeting with a practitioner. - + The Encounter has begun and the patient is present / the practitioner and the patient are meeting. @@ -2912,7 +2949,7 @@ P.O. Box number, delivery hints, and similar address information.The specified property of the code is in the set of codes or concepts specified in the provided value (comma separated list). - + The specified property of the code is not in the set of codes or concepts specified in the provided value (comma separated list). @@ -2942,7 +2979,7 @@ P.O. Box number, delivery hints, and similar address information.This reference has been superseded by another reference. - + This reference was created in error. @@ -3727,6 +3764,11 @@ P.O. Box number, delivery hints, and similar address information.This resource provides processing status, errors and notes from the processing of a resource. + + + A Resource Profile - a statement of use of one or more FHIR Resources. It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions. + + Todo. @@ -4372,6 +4414,11 @@ P.O. Box number, delivery hints, and similar address information.This resource provides processing status, errors and notes from the processing of a resource. + + + A Resource Profile - a statement of use of one or more FHIR Resources. It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions. + + Todo. @@ -4442,7 +4489,7 @@ P.O. Box number, delivery hints, and similar address information.The composition or document has been modified subsequent to being released as "final", and is complete and verified by an authorized person. - + The composition or document was originally created/issued in error, and this is an amendment that marks that the entire series should not be considered as valid. diff --git a/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-single.xsd b/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-single.xsd index a36687fdc6e..30cbeb911f0 100644 --- a/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-single.xsd +++ b/hapi-fhir-structures-dstu2/src/main/resources/ca/uhn/fhir/model/dstu2/schema/fhir-single.xsd @@ -27,7 +27,7 @@ POSSIBILITY OF SUCH DAMAGE. - Generated on Sat, Feb 7, 2015 18:18+0000 for FHIR v0.4.0 + Generated on Sat, Feb 14, 2015 16:12-0500 for FHIR v0.4.0 --> @@ -351,6 +351,7 @@ + @@ -358,6 +359,7 @@ + @@ -2301,7 +2303,7 @@ P.O. Box number, delivery hints, and similar address information. - + A resource that includes narrative, extensions, and contained resources. @@ -2330,6 +2332,41 @@ P.O. Box number, delivery hints, and similar address information. + + + + + The context is all elements matching a particular resource element path. + + + + + The context is all nodes matching a particular data type element path (root or repeating element) or all elements referencing a particular primitive data type (expressed as the datatype name). + + + + + The context is all nodes whose mapping to a specified reference model corresponds to a particular mapping structure. The context identifies the mapping target. The mapping should clearly identify where such an extension could be used. + + + + + The context is a particular extension from a particular profile. Expressed as uri#name, where uri identifies the profile and #name identifies the extension code. + + + + + + + + If the element is present, it must have either a @value, an @id, or extensions + + + + + + + @@ -2447,7 +2484,7 @@ P.O. Box number, delivery hints, and similar address information.The value is no longer available - + The are no known applicable values in this context @@ -2717,7 +2754,7 @@ P.O. Box number, delivery hints, and similar address information.The Patient is present for the encounter, however is not currently meeting with a practitioner. - + The Encounter has begun and the patient is present / the practitioner and the patient are meeting. @@ -2912,7 +2949,7 @@ P.O. Box number, delivery hints, and similar address information.The specified property of the code is in the set of codes or concepts specified in the provided value (comma separated list). - + The specified property of the code is not in the set of codes or concepts specified in the provided value (comma separated list). @@ -2942,7 +2979,7 @@ P.O. Box number, delivery hints, and similar address information.This reference has been superseded by another reference. - + This reference was created in error. @@ -3727,6 +3764,11 @@ P.O. Box number, delivery hints, and similar address information.This resource provides processing status, errors and notes from the processing of a resource. + + + A Resource Profile - a statement of use of one or more FHIR Resources. It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions. + + Todo. @@ -4372,6 +4414,11 @@ P.O. Box number, delivery hints, and similar address information.This resource provides processing status, errors and notes from the processing of a resource. + + + A Resource Profile - a statement of use of one or more FHIR Resources. It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions. + + Todo. @@ -4442,7 +4489,7 @@ P.O. Box number, delivery hints, and similar address information.The composition or document has been modified subsequent to being released as "final", and is complete and verified by an authorized person. - + The composition or document was originally created/issued in error, and this is an amendment that marks that the entire series should not be considered as valid. @@ -4534,7 +4581,7 @@ P.O. Box number, delivery hints, and similar address information.The alert does not need to be displayed any more. - + The alert was added in error, and should no longer be displayed. @@ -5468,6 +5515,11 @@ P.O. Box number, delivery hints, and similar address information.The Base URL for the resource, if different to the base URL specified for the bundle as a whole. + + + The Resources for the entry. + + Information about the search process that lead to the creation of this entry. @@ -5478,14 +5530,9 @@ P.O. Box number, delivery hints, and similar address information.Additional information about how this entry should be processed as part of a transaction. - + - The Resources for the entry. - - - - - Information about the resource (if deleted, or if a summary transaction response). + Additional information about how this entry should be processed as part of a transaction. @@ -5520,46 +5567,101 @@ P.O. Box number, delivery hints, and similar address information. - + - The operation associated with this entry in either a update history, or a transaction/ transaction response. + The HTTP verb for this entry in either a update history, or a transaction/ transaction response. - + A search URL for this resource that specifies how the resource is matched to an existing resource when processing a transaction (see transaction documentation). + + + If the ETag values match, return a 304 Not modified status. See the read/vread interaction documentation. + + + + + Only perform the operation if the Etag value matches. For more information, see the API section "Managing Resource Contention". + + + + + Only perform the operation if the last updated date matches. For more information, see the API section "Managing Resource Contention". + + + + + Instruct the server not to perform the create if a specified resource already exists. For further information, see "Conditional Create". + + - + A container for a group of resources. - + - The type of resource (required to construct the identity - e.g. identity Patient/345 is type + id). + The status code returned by processing this entry. - + - The id of the resource (required to construct the identity - e.g. identity Patient/345 is type + id). + The location header created by processing this operation. - + - The meta information for the resource. Optional - only provided if there is a need for version id, last updated, and/or tag, profile and security information. + The etag for the resource, it the operation for the entry produced a versioned resource. + + + + + HTTP GET. + + + + + HTTP POST. + + + + + HTTP PUT. + + + + + HTTP DELETE. + + + + + + + HTTP verbs (in the HTTP command line) + If the element is present, it must have either a @value, an @id, or extensions + + + + + + + @@ -5635,41 +5737,6 @@ P.O. Box number, delivery hints, and similar address information. - - - - - - - - - - - - - - - - - - - - No Operation occurred - only valid in a transaction response. - - - - - - - The operation associated with an entry in either a update history, or a transaction/ transaction response - If the element is present, it must have either a @value, an @id, or extensions - - - - - - - Describes the intention of how one or more practitioners intend to deliver care for a particular patient for a period of time, possibly limited to care for a specific condition or set of conditions. @@ -5976,7 +6043,7 @@ P.O. Box number, delivery hints, and similar address information. - + The goal is being sought but has not yet been reached. (Also applies if goal was reached in the past but there has been regression and goal is being sought again). @@ -6011,7 +6078,7 @@ P.O. Box number, delivery hints, and similar address information. - + Activity is planned but no action has yet been taken. @@ -6021,12 +6088,12 @@ P.O. Box number, delivery hints, and similar address information.Appointment or other booking has occurred but activity has not yet begun. - + Activity has been started but is not yet complete. - + Activity was started but has temporarily ceased with an expectation of resumption at a future time. @@ -6909,7 +6976,7 @@ P.O. Box number, delivery hints, and similar address information. - + The communication transmission is ongoing. @@ -7080,7 +7147,7 @@ P.O. Box number, delivery hints, and similar address information.The receiving system has accepted the order, but work has not yet commenced. - + The work to fulfill the order is happening. @@ -8068,6 +8135,21 @@ P.O. Box number, delivery hints, and similar address information.A flag to indicate that the server allows the client to create new identities on the server. If the update operation is used (client) or allowed (server) to a new location where a resource doesn't already exist. This means that the server allows the client to create new identities on the server. + + + A flag that indicates that the server supports conditional create. + + + + + A flag that indicates that the server supports conditional update. + + + + + A flag that indicates that the server supports conditional delete. + + A list of _include values supported by the server. @@ -8075,7 +8157,7 @@ P.O. Box number, delivery hints, and similar address information. - Additional search parameters for implementations to support and/or make use of. + Search parameters for implementations to support and/or make use of - either references to ones defined in the specification, or additional ones defined for/by the implementation. @@ -9206,7 +9288,7 @@ P.O. Box number, delivery hints, and similar address information.The data element is sufficiently well-constrained that multiple pieces of data captured according to the constraints of the data element will be comparable (though in some cases, a degree of automated conversion/normalization may be required). - + The data element is fully specified down to a single value set, single unit of measure, single data type, etc. Multiple pieces of data associated with this data element are fully compareable. @@ -9868,7 +9950,7 @@ period. The receiving system has accepted the request but work has not yet commenced. - + The work to fulfill the order is happening. @@ -10164,7 +10246,7 @@ period. The receiving system has accepted the order, but work has not yet commenced. - + The work to fulfill the order is happening. @@ -10280,6 +10362,11 @@ period. The diagnostic service that is responsible for issuing the report. + + + The link to the health care event (encounter) when the order was made. + + The local ID assigned to the report by the order filler, usually by the Information System of the diagnostic service provider. @@ -10399,7 +10486,7 @@ period. The report is unavailable because the measurement was not started or not completed (also sometimes called "aborted"). - + The report has been withdrawn following previous Final release. @@ -10430,7 +10517,7 @@ period. - + A single identifier that uniquely identifies this manifest. Principally used to refer to the manifest in non-FHIR contexts. @@ -10440,7 +10527,7 @@ period. Other identifiers associated with the document, including version independent, source record and workflow related identifiers. - + Who or what the set of documents is about. The documents can be about a person, (patient or healthcare practitioner), a device (i.e. machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure). If the documents cross more than one subject, then more than one subject is allowed here (unusual use case). @@ -10512,7 +10599,7 @@ period. - + Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document. @@ -10522,19 +10609,24 @@ period. Other identifiers associated with the document, including version independent, source record and workflow related identifiers. - + Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (I.e. machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure). - Specifies the particular kind of document (e.g. Patient Summary, Discharge Summary, Prescription, etc.). + The type code specifies the precise type of document from the user perspective. It is recommended that the value Set be drawn from a coding scheme providing a fine level of granularity such as LOINC. (e.g. Patient Summary, Discharge Summary, Prescription, etc.). - A categorization for the type of the document. This may be implied by or derived from the code specified in the Document Type. + The class code specifying the high-level use classification of the document type (e.g., Report, Summary, Images, Treatment Plan, Patient Preferences, Workflow). + + + + + An identifier that identifies the the document encoding, structure and template that the document conforms to beyond the base format indicated in the mimeType. @@ -10589,42 +10681,12 @@ period. - A code specifying the level of confidentiality of the XDS Document. + A set of Security-Tag codes specifying the level of privacy/security of the Document. - + - The primary language in which the source document is written. - - - - - The mime type of the source document. - - - - - An identifier that identifies that the format and content of the document conforms to additional rules beyond the base format indicated in the mimeType. - - - - - The size of the source document this reference refers to in bytes. - - - - - A hash of the source document to ensure that changes have not occurred. - - - - - A url at which the document can be accessed. - - - - - A description of a service call that can be used to retrieve the document. + The document or url to the document along with critical metadata to prove content has integrity. @@ -10657,53 +10719,6 @@ period. - - - A reference to a document. - - - - - - - The type of the service that can be used to access the documents. - - - - - Where the service end-point is located. - - - - - A list of named parameters that is used in the service call. - - - - - - - - - A reference to a document. - - - - - - - The name of a parameter. - - - - - The value of the named parameter. - - - - - - A reference to a document. @@ -10904,7 +10919,7 @@ period. - planned | arrived | in progress | onleave | finished | cancelled. + planned | arrived | in-progress | onleave | finished | cancelled. @@ -11000,7 +11015,7 @@ period. - planned | arrived | in progress | onleave | finished | cancelled. + planned | arrived | in-progress | onleave | finished | cancelled. @@ -11648,41 +11663,6 @@ period. - - - - - The context is all elements matching a particular resource element path. - - - - - The context is all nodes matching a particular data type element path (root or repeating element) or all elements referencing a particular primitive data type (expressed as the datatype name). - - - - - The context is all nodes whose mapping to a specified reference model corresponds to a particular mapping structure. The context identifies the mapping target. The mapping should clearly identify where such an extension could be used. - - - - - The context is a particular extension from a particular profile. Expressed as uri#name, where uri identifies the profile and #name identifies the extension code. - - - - - - - How an extension context is interpreted - If the element is present, it must have either a @value, an @id, or extensions - - - - - - - Significant health events and conditions for people related to the subject relevant in the context of care for the subject. @@ -11875,7 +11855,7 @@ period. A goal is planned for this patient. - + The goal is being sought but has not yet been reached. (Also applies if goal was reached in the past but there has been regression and goal is being sought again). @@ -12334,13 +12314,7 @@ period. Study instance uid of the SOP instances in the selection. - - - The DICOM Application Entity Title where the study can be retrieved. -Note that this AE Title is provided to retrieve all SOP instances of the study, not only those in the selection. - - - + WADO-RS URL to retrieve the study. Note that this URL retrieves all SOP instances of the study, not only those in the selection. @@ -12361,18 +12335,12 @@ Note that this AE Title is provided to retrieve all SOP instances of the study, - + Series instance uid of the SOP instances in the selection. - - - The DICOM Application Entity Title where the series can be retrieved. -Note that this AE Title is provided to retrieve all SOP instances of the series not only those in the selection. - - - + WADO-RS URL to retrieve the series Note that this URL retrieves all SOP instances of the series not only those in the selection. @@ -12403,16 +12371,37 @@ Note that this AE Title is provided to retrieve all SOP instances of the series SOP Instance uid of the selected instance. - - - The DICOM Application Entity Title where the DICOM SOP instance can be retrieved. - - - + WADO-RS URL to retrieve the DICOM SOP Instance. + + + Identity and location information of the frames in the selected instance. + + + + + + + + + A set of DICOM SOP Instances of a patient, selected for some application purpose, e.g., quality assurance, teaching, conference, consulting, etc. Objects selected can be from different studies, but must be of the same patient. + + + + + + + The frame numbers in the frame set. + + + + + WADO-RS URL to retrieve the DICOM frames. + + @@ -13151,7 +13140,7 @@ Note that this AE Title is provided to retrieve all SOP instances of the series - A unique identifier assigned to this adverse reaction record. + A unique identifier assigned to this immunization record. @@ -13164,14 +13153,14 @@ Note that this AE Title is provided to retrieve all SOP instances of the series Vaccine that was administered or was to be administered. - + - The patient to whom the vaccine was to be administered. + The patient who either received or did not receive the immunization. - + - Indicates if the vaccination was refused. + Indicates if the vaccination was or was not given. @@ -13189,6 +13178,11 @@ Note that this AE Title is provided to retrieve all SOP instances of the series Clinician who ordered the vaccination. + + + The visit or admission or other contact between patient and health care provider the immunization was performed as part of. + + Name of vaccine manufacturer. @@ -13226,7 +13220,7 @@ Note that this AE Title is provided to retrieve all SOP instances of the series - Reasons why a vaccine was administered or refused. + Reasons why a vaccine was or was not administered. @@ -13255,9 +13249,9 @@ Note that this AE Title is provided to retrieve all SOP instances of the series Reasons why a vaccine was administered. - + - Refusal or exemption reasons. + Reason why a vaccine was not administered. @@ -13359,9 +13353,9 @@ Note that this AE Title is provided to retrieve all SOP instances of the series A unique identifier assigned to this particular recommendation record. - + - The patient who is the subject of the profile. + The patient for whom the recommendations are for. @@ -14641,12 +14635,12 @@ Note that this AE Title is provided to retrieve all SOP instances of the series - + The administration has started but has not yet completed. - + Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called "suspended". @@ -14656,7 +14650,7 @@ Note that this AE Title is provided to retrieve all SOP instances of the series All actions that are implied by the administration have occurred. - + The administration was entered in error and therefore nullified. @@ -14867,12 +14861,12 @@ Note that this AE Title is provided to retrieve all SOP instances of the series - + The dispense has started but has not yet completed. - + Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called "suspended". @@ -14882,7 +14876,7 @@ Note that this AE Title is provided to retrieve all SOP instances of the series All actions that are implied by the dispense have occurred. - + The dispense was entered in error and therefore nullified. @@ -15116,7 +15110,7 @@ Note that this AE Title is provided to retrieve all SOP instances of the series The prescription is 'actionable', but not all actions that are implied by it have occurred yet. - + Actions implied by the prescription have been temporarily halted, but are expected to continue later. May also be called "suspended". @@ -15126,7 +15120,7 @@ Note that this AE Title is provided to retrieve all SOP instances of the series All actions that are implied by the prescription have occurred (this will rarely be made explicit). - + The prescription was entered in error and therefore nullified. @@ -15194,7 +15188,7 @@ Note that this AE Title is provided to retrieve all SOP instances of the series - A code specifying the state of the statement. Generally this will be in progress or completed state. + A code specifying the state of the statement. Generally this will be in-progress or completed state. @@ -15300,7 +15294,7 @@ Note that this AE Title is provided to retrieve all SOP instances of the series - + The medication is still being taken. @@ -15310,7 +15304,7 @@ Note that this AE Title is provided to retrieve all SOP instances of the series All actions that are implied by the statement have occurred. - + The statement was entered in error and therefore nullified. @@ -16146,6 +16140,11 @@ other observer (for example a relative or EMT), or any observation made about th Who was responsible for asserting the observed value as "true". + + + The device used to generate the observation data. + + The healthcare event ( e.g. a patient and healthcare provider interaction ) during which this observation is made. @@ -16299,7 +16298,7 @@ other observer (for example a relative or EMT), or any observation made about th The observation is unavailable because the measurement was not started or not completed (also sometimes called "aborted"). - + The observation has been withdrawn following previous Final release. @@ -19153,7 +19152,7 @@ other observer (for example a relative or EMT), or any observation made about th The receiving system has accepted the request, but work has not yet commenced. - + The work to fulfill the request is happening. @@ -20360,7 +20359,7 @@ other observer (for example a relative or EMT), or any observation made about th - + This QuestionnaireAnswers has been partially filled out with answers, but changes or additions are still expected to be made to it. @@ -22153,6 +22152,261 @@ other observer (for example a relative or EMT), or any observation made about th + + + A Resource Profile - a statement of use of one or more FHIR Resources. It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions. + + + + + A Resource Profile - a statement of use of one or more FHIR Resources. It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions. + If the element is present, it must have either a @value, an @id, or extensions + + + + + + + The URL at which this profile is (or will be) published, and which is used to reference this profile in extension urls and tag values in operational FHIR systems. + + + + + Formal identifier that is used to identify this profile when it is represented in other formats, or referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI). + + + + + The identifier that is used to identify this version of the profile when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually. + + + + + A free text natural language name identifying the Profile. + + + + + Defined so that applications can use this name when displaying the value of the extension to the user. + + + + + Details of the individual or organization who accepts responsibility for publishing the profile. + + + + + Contact details to assist a user in finding and communicating with the publisher. + + + + + A free text natural language description of the profile and its use. + + + + + A set of terms from external terminologies that may be used to assist with indexing and searching of templates. + + + + + The status of the profile. + + + + + This profile was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage. + + + + + The date that this version of the profile was published. + + + + + The Scope and Usage that this profile was created to meet. + + + + + The version of the FHIR specification on which this profile is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 0.4.0 for this version. + + + + + An external specification that the content is mapped to. + + + + + Defines the type of structure that this definition is describing. + + + + + Identifies the type of context to which the extension applies. + + + + + Identifies the types of resource or data type elements to which the extension can be applied. + + + + + The structure that is the base on which this set of constraints is derived from. + + + + + A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base profile. + + + + + A differential view is expressed relative to the base profile - a statement of differences that it applies. + + + + + + + + + A Resource Profile - a statement of use of one or more FHIR Resources. It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions. + + + + + + + An Internal id that is used to identify this mapping set when specific mappings are made. + + + + + A URI that identifies the specification that this mapping is expressed to. + + + + + A name for the specification that is being mapped to. + + + + + Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage. + + + + + + + + + A Resource Profile - a statement of use of one or more FHIR Resources. It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions. + + + + + + + Captures constraints on each element within the resource. + + + + + + + + + A Resource Profile - a statement of use of one or more FHIR Resources. It may include constraints on Resources and Data Types, Terminology Binding Statements and Extension Definitions. + + + + + + + Captures constraints on each element within the resource. + + + + + + + + + + + An abstract Type. Structure Definitions for abstract types are provided for structural completeness, and to support functions such as code generation. + + + + + A data type - either a primitive or complex structure that defines a set of data elements. These can be used throughout Resource and extension definitions. + + + + + A resource defined by the FHIR specification. + + + + + A set of constraints on a resource or data type that describe how it is used for a particular use. + + + + + A definition of an extension that can be used in a FHIR resource (or a set of constraints on an exsting extension). + + + + + + + Defines the type of structure that a definition is describing + If the element is present, it must have either a @value, an @id, or extensions + + + + + + + + + + + + This profile is still under development. + + + + + This profile is ready for normal use. + + + + + This profile has been deprecated, withdrawn or superseded and should no longer be used. + + + + + + + The lifecycle status of a StructureDefinition + If the element is present, it must have either a @value, an @id, or extensions + + + + + + + Todo. @@ -22536,7 +22790,7 @@ other observer (for example a relative or EMT), or any observation made about th - + Supply has been requested, but not dispensed. @@ -22737,11 +22991,6 @@ other observer (for example a relative or EMT), or any observation made about th A free text natural language name describing the value set. - - - This should describe "the semantic space" to be included in the value set. This can also describe the approach taken to build the value set. - - If this is set to 'true', then no new versions of the content logical definition can be created. Note: Other metadata might still change. @@ -22759,7 +23008,7 @@ other observer (for example a relative or EMT), or any observation made about th - A free text natural language description of the use of the value set - reason for definition, conditions of use, etc. The description may include a list of expected usages for the value set. + A free text natural language description of the use of the value set - reason for definition, "the semantic space" to be included in the value set, conditions of use, etc. The description may include a list of expected usages for the value set and can also describe the approach taken to build the value set. diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java index 87660ced776..cf7b148df43 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java @@ -94,14 +94,6 @@ public class JsonParserTest { " }],\n" + " \"entry\" : [{\n" + " \"base\" : \"http://foo/fhirBase2\",\n" + - " \"search\" : {\n" + - " \"mode\" : \"match\",\n" + - " \"score\" : 0.123\n" + - " },\n" + - " \"transaction\" : {\n" + - " \"operation\" : \"create\",\n" + - " \"match\" : \"http://foo/Patient?identifier=value\"\n" + - " },\n" + " \"resource\" : {\n" + " \"resourceType\" : \"Patient\",\n" + " \"id\" : \"1\",\n" + @@ -110,7 +102,15 @@ public class JsonParserTest { " \"lastUpdated\" : \"2001-02-22T11:22:33-05:00\"\n" + " },\n" + " \"birthDate\" : \"2012-01-02\"\n" + - " }\n" + + " },\n" + + " \"search\" : {\n" + + " \"mode\" : \"match\",\n" + + " \"score\" : 0.123\n" + + " },\n" + + " \"transaction\" : {\n" + + " \"operation\" : \"create\",\n" + + " \"url\" : \"http://foo/Patient?identifier=value\"\n" + + " }\n" + " }]\n" + "}"; //@formatter:on @@ -201,6 +201,48 @@ public class JsonParserTest { assertEquals(exp, act); } + + + @Test + public void testParseAndEncodeBundleNewStyle() throws Exception { + String content = IOUtils.toString(JsonParserTest.class.getResourceAsStream("/bundle-example.json")); + + ca.uhn.fhir.model.dstu2.resource.Bundle parsed = ourCtx.newJsonParser().parseResource(ca.uhn.fhir.model.dstu2.resource.Bundle.class, content); + assertEquals("http://example.com/base/Bundle/example/_history/1", parsed.getId().getValue()); + assertEquals("1", parsed.getResourceMetadata().get(ResourceMetadataKeyEnum.VERSION)); + assertEquals("1", parsed.getId().getVersionIdPart()); + assertEquals(new InstantDt("2014-08-18T01:43:30Z"), parsed.getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED)); + assertEquals("searchset", parsed.getType()); + assertEquals(3, parsed.getTotal().intValue()); + assertEquals("http://example.com/base", parsed.getBaseElement().getValueAsString()); + assertEquals("https://example.com/base/MedicationPrescription?patient=347&searchId=ff15fd40-ff71-4b48-b366-09c706bed9d0&page=2", parsed.getLink().get(0).getUrlElement().getValueAsString()); + assertEquals("https://example.com/base/MedicationPrescription?patient=347&_include=MedicationPrescription.medication", parsed.getLink().get(1).getUrlElement().getValueAsString()); + + assertEquals(2, parsed.getEntry().size()); + + MedicationPrescription p = (MedicationPrescription) parsed.getEntry().get(0).getResource(); + assertEquals("Patient/347", p.getPatient().getReference().getValue()); + assertEquals("2014-08-16T05:31:17Z", ResourceMetadataKeyEnum.UPDATED.get(p).getValueAsString()); + assertEquals("http://example.com/base/MedicationPrescription/3123/_history/1", p.getId().getValue()); + + String reencoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(parsed); + ourLog.info(reencoded); + + JsonConfig cfg = new JsonConfig(); + + JSON expected = JSONSerializer.toJSON(content.trim(), cfg); + JSON actual = JSONSerializer.toJSON(reencoded.trim(), cfg); + + String exp = expected.toString().replace("\\r\\n", "\\n"); // .replace("§", "§"); + String act = actual.toString().replace("\\r\\n", "\\n"); + + ourLog.info("Expected: {}", exp); + ourLog.info("Actual : {}", act); + + assertEquals(exp, act); + + } + @Test public void testParseAndEncodeNewExtensionFormat() { diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java index 7c39f58a0ea..392e1425786 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java @@ -85,6 +85,38 @@ public class XmlParserTest { } + @Test + public void testParseAndEncodeBundleNewStyle() throws Exception { + String content = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/bundle-example.xml")); + + ca.uhn.fhir.model.dstu2.resource.Bundle parsed = ourCtx.newXmlParser().parseResource(ca.uhn.fhir.model.dstu2.resource.Bundle.class, content); + assertEquals("http://example.com/base/Bundle/example/_history/1", parsed.getId().getValue()); + assertEquals("1", parsed.getResourceMetadata().get(ResourceMetadataKeyEnum.VERSION)); + assertEquals(new InstantDt("2014-08-18T01:43:30Z"), parsed.getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED)); + assertEquals("searchset", parsed.getType()); + assertEquals(3, parsed.getTotal().intValue()); + assertEquals("http://example.com/base", parsed.getBaseElement().getValueAsString()); + assertEquals("https://example.com/base/MedicationPrescription?patient=347&searchId=ff15fd40-ff71-4b48-b366-09c706bed9d0&page=2", parsed.getLink().get(0).getUrlElement().getValueAsString()); + assertEquals("https://example.com/base/MedicationPrescription?patient=347&_include=MedicationPrescription.medication", parsed.getLink().get(1).getUrlElement().getValueAsString()); + + assertEquals(2, parsed.getEntry().size()); + assertEquals("http://foo?search", parsed.getEntry().get(0).getTransaction().getUrlElement().getValueAsString()); + + MedicationPrescription p = (MedicationPrescription) parsed.getEntry().get(0).getResource(); + assertEquals("Patient/347", p.getPatient().getReference().getValue()); + assertEquals("2014-08-16T05:31:17Z", ResourceMetadataKeyEnum.UPDATED.get(p).getValueAsString()); + assertEquals("http://example.com/base/MedicationPrescription/3123/_history/1", p.getId().getValue()); +// assertEquals("3123", p.getId().getValue()); + + String reencoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(parsed); + ourLog.info(reencoded); + + Diff d = new Diff(new StringReader(content), new StringReader(reencoded)); + assertTrue(d.toString(), d.identical()); + + } + + @Test public void testEncodeAndParseBundleWithoutResourceIds() { Organization org = new Organization(); @@ -144,14 +176,6 @@ public class XmlParserTest { " \n" + " \n" + " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + " \n" + " \n" + " \n" + @@ -162,6 +186,14 @@ public class XmlParserTest { " \n" + " \n" + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + " \n" + ""; //@formatter:on diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java new file mode 100644 index 00000000000..d7f3c0d9288 --- /dev/null +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java @@ -0,0 +1,234 @@ +package ca.uhn.fhir.rest.server; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletHolder; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.dstu2.resource.Bundle; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; +import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry; +import ca.uhn.fhir.model.dstu2.resource.OperationOutcome; +import ca.uhn.fhir.model.dstu2.resource.Patient; +import ca.uhn.fhir.model.primitive.IdDt; +import ca.uhn.fhir.model.primitive.InstantDt; +import ca.uhn.fhir.rest.annotation.Transaction; +import ca.uhn.fhir.rest.annotation.TransactionParam; +import ca.uhn.fhir.util.PortUtil; + +/** + * Created by dsotnikov on 2/25/2014. + */ +public class TransactionWithBundleResourceParamTest { + + private static CloseableHttpClient ourClient; + private static FhirContext ourCtx = new FhirContext(); + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(TransactionWithBundleResourceParamTest.class); + private static int ourPort; + private static boolean ourReturnOperationOutcome; + + private static Server ourServer; + + + + @Before + public void before() { + ourReturnOperationOutcome = false; + } + + @Test + public void testTransaction() throws Exception { + Bundle b = new Bundle(); + InstantDt nowInstant = InstantDt.withCurrentTime(); + + Patient p1 = new Patient(); + p1.addName().addFamily("Family1"); + Entry entry = b.addEntry(); + p1.getId().setValue("1"); + entry.setResource(p1); + + Patient p2 = new Patient(); + p2.addName().addFamily("Family2"); + entry = b.addEntry(); + p2.getId().setValue("2"); + entry.setResource(p2); + + Entry deletedEntry = b.addEntry(); + deletedEntry.getTransaction().getMethodElement().setDeletedResourceId(new IdDt("Patient/3")); + deletedEntry.setDeleted(nowInstant); + + String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(b); + ourLog.info(bundleString); + + HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/"); + httpPost.addHeader("Accept", Constants.CT_ATOM_XML + "; pretty=true"); + httpPost.setEntity(new StringEntity(bundleString, ContentType.create(Constants.CT_ATOM_XML, "UTF-8"))); + HttpResponse status = ourClient.execute(httpPost); + String responseContent = IOUtils.toString(status.getEntity().getContent()); IOUtils.closeQuietly(status.getEntity().getContent()); + + assertEquals(200, status.getStatusLine().getStatusCode()); + + ourLog.info(responseContent); + + Bundle bundle = ourCtx.newXmlParser().parseResource(Bundle.class, responseContent); + assertEquals(3, bundle.size()); + + BundleEntry entry0 = bundle.getEntries().get(0); + assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getResource().getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getLinkSelf().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/1", entry0.getLinkAlternate().getValue()); + + BundleEntry entry1 = bundle.getEntries().get(1); + assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getResource().getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getLinkSelf().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/2", entry1.getLinkAlternate().getValue()); + + BundleEntry entry2 = bundle.getEntries().get(2); + assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getResource().getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getLinkSelf().getValue()); + assertEquals(nowInstant.getValueAsString(), entry2.getDeletedAt().getValueAsString()); +} + + + @Test + public void testTransactionWithOperationOutcome() throws Exception { + ourReturnOperationOutcome = true; + + Bundle b = new Bundle(); + InstantDt nowInstant = InstantDt.withCurrentTime(); + + Patient p1 = new Patient(); + p1.addName().addFamily("Family1"); + BundleEntry entry = b.addEntry(); + p1.getId().setValue("1"); + entry.setResource(p1); + + Patient p2 = new Patient(); + p2.addName().addFamily("Family2"); + entry = b.addEntry(); + p2.getId().setValue("2"); + entry.setResource(p2); + + BundleEntry deletedEntry = b.addEntry(); + deletedEntry.setDeletedResourceId(new IdDt("Patient/3")); + deletedEntry.setDeleted(nowInstant); + + String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b); + ourLog.info(bundleString); + + HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/"); + httpPost.addHeader("Accept", Constants.CT_ATOM_XML + "; pretty=true"); + httpPost.setEntity(new StringEntity(bundleString, ContentType.create(Constants.CT_ATOM_XML, "UTF-8"))); + HttpResponse status = ourClient.execute(httpPost); + String responseContent = IOUtils.toString(status.getEntity().getContent()); IOUtils.closeQuietly(status.getEntity().getContent()); + + assertEquals(200, status.getStatusLine().getStatusCode()); + + ourLog.info(responseContent); + + Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent); + assertEquals(4, bundle.size()); + + assertEquals(OperationOutcome.class, bundle.getEntries().get(0).getResource().getClass()); + assertEquals("OperationOutcome (no ID)", bundle.getEntries().get(0).getTitle().getValue()); + + BundleEntry entry0 = bundle.getEntries().get(1); + assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getResource().getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getLinkSelf().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/1", entry0.getLinkAlternate().getValue()); + + BundleEntry entry1 = bundle.getEntries().get(2); + assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getResource().getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getLinkSelf().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/2", entry1.getLinkAlternate().getValue()); + + BundleEntry entry2 = bundle.getEntries().get(3); + assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getResource().getId().getValue()); + assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getLinkSelf().getValue()); + assertEquals(nowInstant.getValueAsString(), entry2.getDeletedAt().getValueAsString()); +} + + @AfterClass + public static void afterClass() throws Exception { + ourServer.stop(); + } + + @BeforeClass + public static void beforeClass() throws Exception { + ourPort = PortUtil.findFreePort(); + ourServer = new Server(ourPort); + + DummyProvider patientProvider = new DummyProvider(); + RestfulServer server = new RestfulServer(); + server.setProviders(patientProvider); + + org.eclipse.jetty.servlet.ServletContextHandler proxyHandler = new org.eclipse.jetty.servlet.ServletContextHandler(); + proxyHandler.setContextPath("/"); + + ServletHolder handler = new ServletHolder(); + handler.setServlet(server); + proxyHandler.addServlet(handler, "/*"); + + ourServer.setHandler(proxyHandler); + ourServer.start(); + + PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS); + HttpClientBuilder builder = HttpClientBuilder.create(); + builder.setConnectionManager(connectionManager); + ourClient = builder.build(); + + } + + + + /** + * Created by dsotnikov on 2/25/2014. + */ + public static class DummyProvider { + + @Transaction + public List transaction(@TransactionParam Bundle theResources) { + int index=1; + for (IResource next : theResources.toListOfResources()) { + String newId = "8"+Integer.toString(index); + if (next.getResourceMetadata().containsKey(ResourceMetadataKeyEnum.DELETED_AT)) { + newId = next.getId().getIdPart(); + } + next.setId(new IdDt("Patient", newId, "9"+Integer.toString(index))); + index++; + } + + List retVal = theResources.toListOfResources(); + if (ourReturnOperationOutcome) { + retVal = new ArrayList(); + OperationOutcome oo = new OperationOutcome(); + oo.addIssue().setDetails("AAAAA"); + retVal.add(oo); + retVal.addAll(theResources.toListOfResources()); + } + + return retVal; + } + + + } + +} diff --git a/hapi-fhir-structures-dstu2/src/test/resources/bundle-example.json b/hapi-fhir-structures-dstu2/src/test/resources/bundle-example.json index 40a17b8d446..ded751e3e91 100644 --- a/hapi-fhir-structures-dstu2/src/test/resources/bundle-example.json +++ b/hapi-fhir-structures-dstu2/src/test/resources/bundle-example.json @@ -20,10 +20,6 @@ ], "entry": [ { - "search": { - "mode": "match", - "score": 1 - }, "resource": { "resourceType": "MedicationPrescription", "id": "3123", @@ -37,15 +33,19 @@ "medication": { "reference": "Medication/example" } + }, + "search": { + "mode": "match", + "score": 1 } }, { - "search": { - "mode": "include" - }, "resource": { "resourceType": "Medication", "id": "example" + }, + "search": { + "mode": "include" } } ] diff --git a/hapi-fhir-structures-dstu2/src/test/resources/bundle-example.xml b/hapi-fhir-structures-dstu2/src/test/resources/bundle-example.xml index 7615d06b793..e8f971b72bd 100644 --- a/hapi-fhir-structures-dstu2/src/test/resources/bundle-example.xml +++ b/hapi-fhir-structures-dstu2/src/test/resources/bundle-example.xml @@ -3,7 +3,7 @@ - + @@ -16,13 +16,6 @@ - - - - - - - @@ -38,15 +31,22 @@ + + + + + + + - - - + + + \ No newline at end of file diff --git a/hapi-fhir-structures-hl7org-dstu2/.classpath b/hapi-fhir-structures-hl7org-dstu2/.classpath index 0463bd53037..306138bcb17 100644 --- a/hapi-fhir-structures-hl7org-dstu2/.classpath +++ b/hapi-fhir-structures-hl7org-dstu2/.classpath @@ -13,6 +13,7 @@ + diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/Bundle.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/Bundle.java index 93cd7dce648..e66717dd6c1 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/Bundle.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/Bundle.java @@ -40,12 +40,13 @@ import org.hl7.fhir.instance.model.annotations.Child; import org.hl7.fhir.instance.model.annotations.Description; import org.hl7.fhir.instance.model.annotations.ResourceDef; import org.hl7.fhir.instance.model.annotations.SearchParamDefinition; +import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.utilities.Utilities; /** * A container for a group of resources. */ @ResourceDef(name="Bundle", profile="http://hl7.org/fhir/Profile/Bundle") -public class Bundle extends Resource { +public class Bundle extends Resource implements IBaseBundle { public enum BundleType { /** diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/resources/bundle-example.xml b/hapi-fhir-structures-hl7org-dstu2/src/test/resources/bundle-example.xml new file mode 100644 index 00000000000..e8f971b72bd --- /dev/null +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/resources/bundle-example.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderJpaRestServerMojo.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderJpaRestServerMojo.java index f99711471b7..2d0f8a22f81 100644 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderJpaRestServerMojo.java +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderJpaRestServerMojo.java @@ -92,6 +92,9 @@ public class TinderJpaRestServerMojo extends AbstractMojo { } for (String next : keys) { if (next.startsWith("resource.")) { + if (next.endsWith(".Bundle")) { + continue; + } baseResourceNames.add(next.substring("resource.".length()).toLowerCase()); } } diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/BaseElement.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/BaseElement.java index 165378c6403..a3b945ab9fd 100644 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/BaseElement.java +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/BaseElement.java @@ -91,7 +91,7 @@ public abstract class BaseElement { return toStringConstant(myDefinition); } - private String toStringConstant(String theDefinition) { + static String toStringConstant(String theDefinition) { if (theDefinition == null) { return ""; } diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/Child.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/Child.java index aa2d5a0bd4d..9ed8955497c 100644 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/Child.java +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/Child.java @@ -129,6 +129,11 @@ public abstract class Child extends BaseElement { // } else { // retVal = (elemName + getTypeSuffix()); // } + + if (retVal.equals("ResourceDt")) { + retVal = "IResource"; + } + return retVal; } diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/SearchParameter.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/SearchParameter.java index 02927af3511..047f631d75c 100644 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/SearchParameter.java +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/model/SearchParameter.java @@ -40,7 +40,7 @@ public class SearchParameter { } public String getDescription() { - return StringUtils.defaultString(myDescription); + return BaseElement.toStringConstant(myDescription); } public String getFluentConstantName() { diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java index 9ca2e481879..0699d813341 100644 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java @@ -217,6 +217,9 @@ public abstract class BaseStructureParser { // if ("ResourceReferenceDt".equals(theNextType)) { // return "ca.uhn.fhir.model." + myVersion + ".composite." + ResourceReferenceDt.class.getSimpleName(); // } + if ("ResourceDt".equals(theNextType)) { + return IResource.class.getCanonicalName(); + } if ("Binary".equals(theNextType)) { return "ca.uhn.fhir.model." + myVersion + ".resource." + Binary.class.getSimpleName(); } diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/DatatypeGeneratorUsingSpreadsheet.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/DatatypeGeneratorUsingSpreadsheet.java index f898b6cbc16..829703f9ddf 100644 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/DatatypeGeneratorUsingSpreadsheet.java +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/DatatypeGeneratorUsingSpreadsheet.java @@ -102,6 +102,7 @@ public class DatatypeGeneratorUsingSpreadsheet extends BaseStructureSpreadsheetP } if (!version.equals("dstu")) { + retVal.add(("/dt/" + version + "/meta.xml")); retVal.add(("/dt/" + version + "/attachment.xml")); retVal.add(("/dt/" + version + "/contactpoint.xml")); retVal.add(("/dt/" + version + "/elementdefinition.xml")); diff --git a/hapi-tinder-plugin/src/main/resources/res/dstu2/bundle-spreadsheet.xml b/hapi-tinder-plugin/src/main/resources/res/dstu2/bundle-spreadsheet.xml index 611fa4987cf..bf5491f7b4a 100644 --- a/hapi-tinder-plugin/src/main/resources/res/dstu2/bundle-spreadsheet.xml +++ b/hapi-tinder-plugin/src/main/resources/res/dstu2/bundle-spreadsheet.xml @@ -9,17 +9,17 @@ Grahame Grahame 2012-03-19T11:12:07Z - 2015-01-30T09:46:08Z + 2015-02-07T02:00:02Z 14.00 - 2580 - 9870 - 5520 - 6075 + 8265 + 17700 + 0 + 0 1 False @@ -816,7 +816,7 @@ - + + ss:RefersTo="='Data Elements'!R1C1:R106C23" ss:Hidden="1"/> -
@@ -1126,7 +1126,8 @@ - + right n @@ -1218,7 +1219,8 @@ - + down @@ -1253,26 +1255,25 @@ - - !Bundle.entry.status + Bundle.entry.resource 0..1 - code - - - BundleEntryStatusResource - create | update | match | include - for search & transaction + + + Resources in this bundle - The status of a resource in the bundle. Used for search (to differentiate between resources included as a match, and resources included as an _include), for history (deleted resources), and for transactions (create/update/delete)The Resources for the entry @@ -1283,6 +1284,7 @@ + n Bundle.entry.search - + right @@ -1402,12 +1405,13 @@ - + right - Bundle.entry.transaction.operationBundle.entry.transaction.method 1..1 - TransactionOperationHTTPVerb - create | update | delete | noopGET | POST | PUT | DELETE - The operation associated with this entry in either a update history, or a transaction/ transaction responseThe HTTP verb for this entry in either a update history, or a transaction/ transaction response @@ -1438,10 +1442,10 @@ - Bundle.entry.transaction.matchBundle.entry.transaction.url - 0..11..1 uri - Search URL specifies how to match existing resourceThe URL for the transaction A search URL for this resource that specifies how the resource is matched to an existing resource when processing a transaction (see transaction documentation) @@ -1468,41 +1472,13 @@ - !Bundle.entry.transaction.modeBundle.entry.transaction.ifNoneMatch 0..1 - code - - - TransactionProcessingMode - - - - - ignore | update | delete - meaning of match URL - What action to take if a matching resource is found - - - - - - - - - - - - !Bundle.entry.deleted - - 0..1string @@ -1511,11 +1487,9 @@ - - - If this is a deleted resource (transaction/history)For managing cache currency - If this is an entry that represents a deleted resource. Only used when the bundle is a transaction or a history type. See RESTful API documentation for further informationIf the ETag values match, return a 304 Not modified status. See the read/vread interaction documentation @@ -1528,25 +1502,24 @@ - !Bundle.entry.deleted.typeBundle.entry.transaction.ifMatch - 1..10..1 - code - - - ResourceTypestring - Type of resource that was deleted + + + For managing update contention - The type of resource that was deleted (required to construct the identity)Only perform the operation if the Etag value matches. For more information, see the API section "Managing Resource Contention" @@ -1558,14 +1531,14 @@ - - !Bundle.entry.deleted.resourceId + Bundle.entry.transaction.ifModifiedSince - 1..10..1 - idstring @@ -1574,69 +1547,9 @@ - Id of resource that was deletedFor managing update contention - The id of the resource that was deleted - - This would naturally be called "id" but this is not allowed (would clash with @id on all elements0 - - - - - - - - - - !Bundle.entry.deleted.versionId - - 1..1 - - id - - - - - - - - Version id for delated resource - - - - - - - - - - - - - !Bundle.entry.deleted.instant - - 1..1 - - instant - - - - - - - - When the resource was deleted - The date/time that the resource was deletedOnly perform the operation if the last updated date matches. For more information, see the API section "Managing Resource Contention" @@ -1648,26 +1561,55 @@ - - Bundle.entry.resource + Bundle.entry.transaction.ifNoneExist + + 0..1 + + string + + + + + + + + For conditional creates + Instruct the server not to perform the create if a specified resource already exists. For further information, see "Conditional Create" + + + + + + + + + + + + Bundle.entry.transactionResponse 0..1 4 - Resource + + + + + + + + Transaction Related Information - - - - - - - - Resources in this bundle - The Resources for the entryAdditional information about how this entry should be processed as part of a transaction @@ -1675,61 +1617,30 @@ - - - - n - - - Bundle.entry.informationright - - 0..1 - 4,5 - - - - - - - - - If deleted, or a summary transaction response - Information about the resource (if deleted, or if a summary transaction response) - - - - - - - - - Bundle.entry.information.type + Bundle.entry.transactionResponse.status 1..1 - code - - - ResourceTypestring - The type of the resource + + + Status return code for entry - The type of resource (required to construct the identity - e.g. identity Patient/345 is type + id)The status code returned by processing this entry @@ -1741,44 +1652,14 @@ - - Bundle.entry.information.resourceId - - 1..1 - - id - - - - - - - - The id of the resource - The id of the resource (required to construct the identity - e.g. identity Patient/345 is type + id) - - - - - - - - - - - - Bundle.entry.information.meta + Bundle.entry.transactionResponse.location 0..1 - Metauri @@ -1787,9 +1668,39 @@ - Meta information for the resourceThe location, if the operation returns a location - The meta information for the resource. Optional - only provided if there is a need for version id, last updated, and/or tag, profile and security informationThe location header created by processing this operation + + + + + + + + + + + + Bundle.entry.transactionResponse.etag + + 0..* + + string + + + + + + + + The etag for the resource (if relevant) + The etag for the resource, it the operation for the entry produced a versioned resource @@ -3850,7 +3761,7 @@ 1 - 22 + 7 1 1 0 @@ -3867,41 +3778,13 @@ 0 - 28 - 4 + 21 + 10 False False - - R2C21:R109C21 - List - - "left,right,up,down,[xpixels];[ypixels]" - - Info - - - R2C18:R109C20 - List - - "N/A" - - - - R2C8:R109C8 - List - - "Bindings!A2..A30" - - - - R3C6:R109C7 - List - - "Y,N" - R2C5 List @@ -3909,36 +3792,64 @@ "DomainResource,Type,Resource,Structure" - R3C5:R109C5 + R3C4 + List + Invariantids + + + + R2C21:R106C21 + List + + "left,right,up,down,[xpixels],[ypixels]" + + Info + + + R2C18:R106C20 + List + + "N/A" + + + + R2C8:R106C8 + List + + "Bindings!A2..A30" + + + + R3C6:R106C7 + List + + "Y,N" + + + R3C5:R106C5 List "*,Reference(A|B),boolean,string,code,id,oid,uuid,integer,decimal,date,dateTime,time,instant,uri,base64Binary,CodeableConcept,Coding,Identifier,Period,Timing,Range,Quantity,Age,Distance,Duration,Count,Money,Ratio,HumanName,Address,ContactPoint,SampledData" - R2C3:R109C3 + R2C3:R106C3 List "0..1,1..1,0..*,1..*" - - R3C4 - List - Invariantids - - - - R2C13:R109C13,R28C14,R25C14 + R25C14,R22C13:R106C13,R2C13:R19C13 (RC1="")<>(RC="") - R2C1:R109C23 + R22C1:R106C23,R2C1:R19C23 RC3="0..0" @@ -3949,7 +3860,7 @@ - R2C1:R12C1,R30C1:R109C1,R15C1,R18C1,R20C1:R28C1 + R15C1,R2C1:R10C1,R27C1:R106C1 AND(RC<>"",R[-1]C="") @@ -3963,35 +3874,35 @@ - R2C14:R109C14,R3C3:R109C3 + R22C14:R106C14,R22C3:R106C3,R2C14:R19C14,R3C3:R19C3 (RC1="")<>(RC="") - R2C12:R109C12,R2C9:R109C9 + R22C12:R106C12,R22C9:R106C9,R2C9:R19C9,R2C12:R19C12 AND(SEARCH("|",RC5)<>0,RC<>"") - R2C12:R109C12,R2C10:R109C10 + R22C12:R106C12,R22C10:R106C10,R2C10:R19C10,R2C12:R19C12 AND(RC<>"",NOT(EXACT(LEFT(RC5,1),LOWER(LEFT(RC5,1))))) - R2C10:R109C11 + R22C10:R106C11,R2C10:R19C11 AND(RC10<>"",RC11<>"") - R2C13:R109C14 + R22C13:R106C14,R2C13:R19C14 AND(RC13<>"",RC13=RC14) @@ -4005,47 +3916,40 @@ - R3C18:R109C19 + R3C18:R106C19 AND(RC1<>"",ISERR(SEARCH("N/A",R2C)),RC="") - R2C21:R10C21,R12C21,R19C21:R23C21,R29C21:R109C21 + R12C21,R2C21:R9C21,R26C21:R106C21 AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(R[1]C1,LEN(RC1)+1)<>(RC1&"."),LEFT(R[1]C1,LEN(RC1)+2)<>("!"&RC1&".")) - R2C1:R109C23 + R22C1:R106C23,R2C1:R19C23 LEFT(RC1,1)="!" - R19C1,R16C1:R17C1 + R16C1 AND(RC<>"",R[-6]C="") - R12C1,R28C1,R15C1 + R15C1,R12C1 AND(RC<>"",R[-2]C="") - - R24C21:R27C21 - - AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(R[5]C1,LEN(RC1)+1)<>(RC1&"."),LEFT(R[5]C1,LEN(RC1)+2)<>("!"&RC1&".")) - - - R13C1 @@ -4054,54 +3958,333 @@ - R13C21:R16C21,R11C21 + R17C21 - AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(R[6]C1,LEN(RC1)+1)<>(RC1&"."),LEFT(R[6]C1,LEN(RC1)+2)<>("!"&RC1&".")) + AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(R[-4]C1,LEN(RC1)+1)<>(RC1&"."),LEFT(R[-4]C1,LEN(RC1)+2)<>("!"&RC1&".")) - R14C1 + R12C1,R26C1,R14C1 - AND(RC<>"",R[5]C="") + AND(RC<>"",#REF!="") - R18C1 + R13C21:R16C21 - AND(RC<>"",R[-3]C="") + AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(#REF!,LEN(RC1)+1)<>(RC1&"."),LEFT(#REF!,LEN(RC1)+2)<>("!"&RC1&".")) - R29C1 + R22C21:R23C21 + + AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(#REF!,LEN(RC1)+1)<>(RC1&"."),LEFT(#REF!,LEN(RC1)+2)<>("!"&RC1&".")) + + + + + R11C1 + + AND(RC<>"",#REF!="") + + + + + R17C1 + + AND(RC<>"",#REF!="") + + + + + R10C21 + + AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(#REF!,LEN(RC1)+1)<>(RC1&"."),LEFT(#REF!,LEN(RC1)+2)<>("!"&RC1&".")) + + + + + R11C21 + + AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(#REF!,LEN(RC1)+1)<>(RC1&"."),LEFT(#REF!,LEN(RC1)+2)<>("!"&RC1&".")) + + + + + R23C1:R25C1 + + AND(RC<>"",R[-9]C="") + + + + + R22C1 AND(RC<>"",R[-5]C="") - R28C21 + R21C13 - AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(R[4]C1,LEN(RC1)+1)<>(RC1&"."),LEFT(R[4]C1,LEN(RC1)+2)<>("!"&RC1&".")) + (RC1="")<>(RC="") + + + + + R21C1:R21C2,R21C4:R21C23 + + RC3="0..0" + + + + AND(RC<>"",RC1="") - R17C21:R18C21 + R21C14 - AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(R[-4]C1,LEN(RC1)+1)<>(RC1&"."),LEFT(R[-4]C1,LEN(RC1)+2)<>("!"&RC1&".")) + (RC1="")<>(RC="") + + R21C9,R21C12 + + AND(SEARCH("|",RC5)<>0,RC<>"") + + + + + R21C10,R21C12 + + AND(RC<>"",NOT(EXACT(LEFT(RC5,1),LOWER(LEFT(RC5,1))))) + + + + + R21C10:R21C11 + + AND(RC10<>"",RC11<>"") + + + + + R21C13:R21C14 + + AND(RC13<>"",RC13=RC14) + + + + + R21C1:R21C2,R21C4:R21C23 + + LEFT(RC1,1)="!" + + + + + R21C1 + + AND(RC<>"",R[-8]C="") + + + + + R24C21 + + AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(R[-7]C1,LEN(RC1)+1)<>(RC1&"."),LEFT(R[-7]C1,LEN(RC1)+2)<>("!"&RC1&".")) + + + + + R22C1 + + AND(RC<>"",R[-3]C="") + + + + + R20C1:R20C2,R20C4:R20C12,R20C15:R20C23 + + RC3="0..0" + + + + AND(RC<>"",RC1="") + + + + + R20C9,R20C12 + + AND(SEARCH("|",RC5)<>0,RC<>"") + + + + + R20C10,R20C12 + + AND(RC<>"",NOT(EXACT(LEFT(RC5,1),LOWER(LEFT(RC5,1))))) + + + + + R20C10:R20C11 + + AND(RC10<>"",RC11<>"") + + + + + R20C1:R20C2,R20C4:R20C12,R20C15:R20C23 + + LEFT(RC1,1)="!" + + + + + R20C1 + + AND(RC<>"",R[-7]C="") + + + + + R21C21,R25C21 + + AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(R[-6]C1,LEN(RC1)+1)<>(RC1&"."),LEFT(R[-6]C1,LEN(RC1)+2)<>("!"&RC1&".")) + + + + + R19C1 + + AND(RC<>"",R[-7]C="") + + + + + R19C21:R20C21 + + AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(R[-5]C1,LEN(RC1)+1)<>(RC1&"."),LEFT(R[-5]C1,LEN(RC1)+2)<>("!"&RC1&".")) + + + + + R18C1 + + AND(RC<>"",R[-5]C="") + + + + + R18C21 + + AND(RC<>"",LEFT(RC5,1)<>"@",LEFT(R[-3]C1,LEN(RC1)+1)<>(RC1&"."),LEFT(R[-3]C1,LEN(RC1)+2)<>("!"&RC1&".")) + + + + + R20C3 + + RC3="0..0" + + + + AND(RC<>"",RC1="") + + + + + R20C3 + + (RC1="")<>(RC="") + + + + + R20C3 + + LEFT(RC1,1)="!" + + + + + R21C3 + + RC3="0..0" + + + + AND(RC<>"",RC1="") + + + + + R21C3 + + (RC1="")<>(RC="") + + + + + R21C3 + + LEFT(RC1,1)="!" + + + + + R20C13 + + (RC1="")<>(RC="") + + + + + R20C13:R20C14 + + RC3="0..0" + + + + AND(RC<>"",RC1="") + + + + + R20C14 + + (RC1="")<>(RC="") + + + + + R20C13:R20C14 + + AND(RC13<>"",RC13=RC14) + + + + + R20C13:R20C14 + + LEFT(RC1,1)="!" + + + -
@@ -4223,45 +4406,27 @@ Bundle entry.transaction when (and only when) a transaction - not(f:entry/f:transaction) or (f:type/@value = 'transaction') or (f:type/@value = 'transaction-response') or (f:type/@value = 'history') + not(f:entry/f:transaction) or (f:type/@value = 'transaction') or (f:type/@value = 'history') 4 - entry.contents + entry.transactionResponse error - Bundle.entry - Cannot have both resource and information + Bundle + entry.transactionResponse when (and only when) a transaction-response - not(f:resource) or not(f:information) + not(f:entry/f:transactionResponse) or (f:type/@value = 'transaction-response') 5 - entry.information + entry.resource error - Bundle - entry.information only when a transaction or history + Bundle.entry + must be a resource unless there's a transaction or transaction response - not(f:entry/f:information) or (f:type/@value = 'transaction') or (f:type/@value = 'transaction-response') or (f:type/@value = 'history') - - - - - - - - - - - - - - - - - - + f:resource or f:transaction or f:transactionResponse @@ -4629,49 +4794,49 @@ 0 - 2 - 4 + 5 + 1 False False - R2C3:R50C3 + R2C3:R48C3 List "error,warning" - R2C4:R50C4 + R2C4:R48C4 List - 'Data Elements'!R2C1:R109C1 + 'Data Elements'!R2C1:R106C1 - R2C1:R50C7 + R2C1:R48C7 AND(RC1="",RC<>"") - R2C1:R50C1 + R2C1:R48C1 AND(RC<>"",R[-1]C="") - R2C2:R50C2,R2C4:R50C5,R2C7:R50C7 + R2C2:R48C2,R2C4:R48C5,R2C7:R48C7 (RC1<>"")<>(RC<>"") - R2C1:R50C7 + R2C1:R48C7 LEFT(RC1,1)="!" @@ -6505,7 +6670,7 @@ - + @@ -6539,29 +6704,34 @@ ss:Name="_FilterDatabase"/> - - - - - + search + xml + An example of a search response + bundle-example + bundle-example.xml - - - - - + transaction + xml + An example transaction + bundle-transaction + bundle-transaction.xml - - - - - + response + xml + Response for the example transaction + bundle-response + bundle-response.xml @@ -6917,7 +7087,8 @@ 0 - 0 + 2 + 2 False @@ -7128,11 +7299,11 @@ - - - - + HTTPVerb + HTTP verbs (in the HTTP command line) + code list + #http-verb @@ -7520,7 +7691,7 @@ 0 - 6 + 7 4 @@ -10644,7 +10815,7 @@ - R34C4:R50C5,R2C4:R30C5 + R34C4:R50C5,R2C4:R30C5,R2C3:R4C3 AND(RC1<>"",#REF!="",RC="") @@ -10692,12 +10863,676 @@ + + + + + +
+ + + + + + + + + Code The code to be sent over the wire + Id Unique number for the code. Required when System is not specified, not permitted otherwise + System The URL of the external code system from which the list is selected. Must be the same for all codes if specified. + Parent The code this code is a specialization of (if any). Content should be "#" + the Id of the parent code + Display Display value for code. Omit if the code *is* the display value (as for internal codes) + Definition Meaning of the code. Include unless meaning obvious to all users. Required if display not + v2 Mappings to v2 codes - See wiki for syntax + v3 Mappings to v3 codes - See wiki for syntax + Committee Notes Additional notes about the code. Not published + + + GET + 1 + + + GET + HTTP GET + + + + + + POST + 2 + + + POST + HTTP POST + + + + + + PUT + 3 + + + PUT + HTTP PUT + + + + + + DELETE + 4 + + + DELETE + HTTP DELETE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+