Work on build
This commit is contained in:
parent
54be2634cd
commit
70aa4e812d
|
@ -20,8 +20,15 @@ public class ClientExamples {
|
||||||
public void createProxy() {
|
public void createProxy() {
|
||||||
// START SNIPPET: proxy
|
// START SNIPPET: proxy
|
||||||
FhirContext ctx = new FhirContext();
|
FhirContext ctx = new FhirContext();
|
||||||
|
|
||||||
|
// Set connections to access the network via the HTTP proxy at
|
||||||
|
// example.com : 8888
|
||||||
ctx.getRestfulClientFactory().setProxy("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");
|
IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
|
||||||
// END SNIPPET: proxy
|
// END SNIPPET: proxy
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,10 @@ import ca.uhn.fhir.rest.client.IGenericClient;
|
||||||
public class HttpProxy {
|
public class HttpProxy {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
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 authUser = "username";
|
||||||
final String authPassword = "password";
|
final String authPassword = "password";
|
||||||
CredentialsProvider credsProvider = new BasicCredentialsProvider();
|
CredentialsProvider credsProvider = new BasicCredentialsProvider();
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<artifactId>hapi-fhir-android</artifactId>
|
<artifactId>hapi-fhir-android</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HAPI FHIR - Distribution Archive</name>
|
<name>HAPI FHIR - Android</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -488,7 +488,7 @@ class ModelScanner {
|
||||||
|
|
||||||
Class<?> nextElementType = determineElementType(next);
|
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
|
* Child is a resource as a direct child, as in Bundle.entry.resource
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -38,18 +38,23 @@ import java.util.Set;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.hl7.fhir.instance.model.IBase;
|
import org.hl7.fhir.instance.model.IBase;
|
||||||
import org.hl7.fhir.instance.model.IBaseResource;
|
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.IAnyResource;
|
||||||
import org.hl7.fhir.instance.model.api.IDomainResource;
|
import org.hl7.fhir.instance.model.api.IDomainResource;
|
||||||
import org.hl7.fhir.instance.model.api.IReference;
|
import org.hl7.fhir.instance.model.api.IReference;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||||
import ca.uhn.fhir.context.BaseRuntimeDeclaredChildDefinition;
|
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.ConfigurationException;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.RuntimeChildChoiceDefinition;
|
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.Bundle;
|
||||||
import ca.uhn.fhir.model.api.BundleEntry;
|
import ca.uhn.fhir.model.api.BundleEntry;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
|
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||||
import ca.uhn.fhir.model.api.TagList;
|
import ca.uhn.fhir.model.api.TagList;
|
||||||
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
|
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
|
@ -266,6 +271,57 @@ public abstract class BaseParser implements IParser {
|
||||||
return parseResource(null, theReader);
|
return parseResource(null, theReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract <T extends IBaseResource> T doParseResource(Class<T> theResourceType, Reader theReader) throws DataFormatException;
|
||||||
|
|
||||||
|
public <T extends IBaseResource> T parseResource(Class<T> theResourceType, Reader theReader) throws DataFormatException {
|
||||||
|
T retVal = doParseResource(theResourceType, theReader);
|
||||||
|
|
||||||
|
RuntimeResourceDefinition def = myContext.getResourceDefinition(retVal);
|
||||||
|
if ("Bundle".equals(def.getName())) {
|
||||||
|
List<IBase> 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<IBase> entries = entryChild.getAccessor().getValues(retVal);
|
||||||
|
if (entries != null) {
|
||||||
|
for (IBase nextEntry : entries) {
|
||||||
|
List<IBase> 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<IBase> 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
|
@Override
|
||||||
public IResource parseResource(String theMessageString) throws ConfigurationException, DataFormatException {
|
public IResource parseResource(String theMessageString) throws ConfigurationException, DataFormatException {
|
||||||
return parseResource(null, theMessageString);
|
return parseResource(null, theMessageString);
|
||||||
|
|
|
@ -277,6 +277,13 @@ public class JsonParser extends BaseParser implements IParser {
|
||||||
|
|
||||||
writeOptionalTagWithTextNode(theEventWriter, "base", determineResourceBaseUrl(theBundle.getLinkBase().getValue(), nextEntry));
|
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) {
|
if (nextEntry.getSearchMode().isEmpty() == false || nextEntry.getScore().isEmpty() == false) {
|
||||||
theEventWriter.writeStartObject("search");
|
theEventWriter.writeStartObject("search");
|
||||||
writeOptionalTagWithTextNode(theEventWriter, "mode", nextEntry.getSearchMode().getValueAsString());
|
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) {
|
if (nextEntry.getTransactionOperation().isEmpty() == false || nextEntry.getLinkSearch().isEmpty() == false) {
|
||||||
theEventWriter.writeStartObject("transaction");
|
theEventWriter.writeStartObject("transaction");
|
||||||
writeOptionalTagWithTextNode(theEventWriter, "operation", nextEntry.getTransactionOperation().getValue());
|
writeOptionalTagWithTextNode(theEventWriter, "operation", nextEntry.getTransactionOperation().getValue());
|
||||||
writeOptionalTagWithTextNode(theEventWriter, "match", nextEntry.getLinkSearch().getValue());
|
writeOptionalTagWithTextNode(theEventWriter, "url", nextEntry.getLinkSearch().getValue());
|
||||||
theEventWriter.writeEnd();
|
theEventWriter.writeEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean deleted = nextEntry.getDeletedAt() != null && nextEntry.getDeletedAt().isEmpty() == false;
|
|
||||||
if (deleted) {
|
if (deleted) {
|
||||||
theEventWriter.writeStartObject("deleted");
|
theEventWriter.writeStartObject("deleted");
|
||||||
if (nextEntry.getResource() != null) {
|
if (nextEntry.getResource() != null) {
|
||||||
|
@ -319,11 +325,6 @@ public class JsonParser extends BaseParser implements IParser {
|
||||||
//
|
//
|
||||||
// writeAuthor(nextEntry, theEventWriter);
|
// 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) {
|
if (nextEntry.getSummary().isEmpty() == false) {
|
||||||
theEventWriter.write("summary", nextEntry.getSummary().getValueAsString());
|
theEventWriter.write("summary", nextEntry.getSummary().getValueAsString());
|
||||||
|
@ -1096,7 +1097,7 @@ public class JsonParser extends BaseParser implements IParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends IBaseResource> T parseResource(Class<T> theResourceType, Reader theReader) {
|
public <T extends IBaseResource> T doParseResource(Class<T> theResourceType, Reader theReader) {
|
||||||
JsonReader reader = Json.createReader(theReader);
|
JsonReader reader = Json.createReader(theReader);
|
||||||
JsonObject object = reader.readObject();
|
JsonObject object = reader.readObject();
|
||||||
|
|
||||||
|
|
|
@ -1121,7 +1121,7 @@ class ParserState<T> {
|
||||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||||
if ("operation".equals(theLocalPart)) {
|
if ("operation".equals(theLocalPart)) {
|
||||||
push(new PrimitiveState(getPreResourceState(), myEntry.getTransactionOperation()));
|
push(new PrimitiveState(getPreResourceState(), myEntry.getTransactionOperation()));
|
||||||
} else if ("match".equals(theLocalPart)) {
|
} else if ("url".equals(theLocalPart)) {
|
||||||
push(new PrimitiveState(getPreResourceState(), myEntry.getLinkSearch()));
|
push(new PrimitiveState(getPreResourceState(), myEntry.getLinkSearch()));
|
||||||
} else {
|
} else {
|
||||||
throw new DataFormatException("Unexpected element in Bundle.entry.search: " + theLocalPart);
|
throw new DataFormatException("Unexpected element in Bundle.entry.search: " + theLocalPart);
|
||||||
|
@ -1658,6 +1658,8 @@ class ParserState<T> {
|
||||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||||
if (theLocalPart.equals("versionId")) {
|
if (theLocalPart.equals("versionId")) {
|
||||||
push(new MetaVersionElementState(getPreResourceState(), myMap));
|
push(new MetaVersionElementState(getPreResourceState(), myMap));
|
||||||
|
// } else if (theLocalPart.equals("profile")) {
|
||||||
|
//
|
||||||
} else if (theLocalPart.equals("lastUpdated")) {
|
} else if (theLocalPart.equals("lastUpdated")) {
|
||||||
InstantDt updated = new InstantDt();
|
InstantDt updated = new InstantDt();
|
||||||
push(new PrimitiveState(getPreResourceState(), updated));
|
push(new PrimitiveState(getPreResourceState(), updated));
|
||||||
|
@ -1759,10 +1761,23 @@ class ParserState<T> {
|
||||||
@Override
|
@Override
|
||||||
public void wereBack() {
|
public void wereBack() {
|
||||||
super.wereBack();
|
super.wereBack();
|
||||||
|
|
||||||
if (myEntry == null) {
|
if (myEntry == null) {
|
||||||
myObject = (T) getCurrentElement();
|
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
|
@Override
|
||||||
|
|
|
@ -81,6 +81,7 @@ import ca.uhn.fhir.model.primitive.InstantDt;
|
||||||
import ca.uhn.fhir.model.primitive.StringDt;
|
import ca.uhn.fhir.model.primitive.StringDt;
|
||||||
import ca.uhn.fhir.model.primitive.XhtmlDt;
|
import ca.uhn.fhir.model.primitive.XhtmlDt;
|
||||||
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
||||||
|
import ca.uhn.fhir.rest.method.BaseMethodBinding;
|
||||||
import ca.uhn.fhir.util.NonPrettyPrintWriterWrapper;
|
import ca.uhn.fhir.util.NonPrettyPrintWriterWrapper;
|
||||||
import ca.uhn.fhir.util.PrettyPrintWriterWrapper;
|
import ca.uhn.fhir.util.PrettyPrintWriterWrapper;
|
||||||
import ca.uhn.fhir.util.XmlUtil;
|
import ca.uhn.fhir.util.XmlUtil;
|
||||||
|
@ -385,8 +386,22 @@ public class XmlParser extends BaseParser implements IParser {
|
||||||
for (BundleEntry nextEntry : theBundle.getEntries()) {
|
for (BundleEntry nextEntry : theBundle.getEntries()) {
|
||||||
theEventWriter.writeStartElement("entry");
|
theEventWriter.writeStartElement("entry");
|
||||||
|
|
||||||
|
boolean deleted = false;
|
||||||
|
if (nextEntry.getDeletedAt() != null && nextEntry.getDeletedAt().isEmpty() == false) {
|
||||||
|
deleted = true;
|
||||||
|
}
|
||||||
|
|
||||||
writeOptionalTagWithValue(theEventWriter, "base", determineResourceBaseUrl(bundleBaseUrl, nextEntry));
|
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) {
|
if (nextEntry.getSearchMode().isEmpty() == false || nextEntry.getScore().isEmpty() == false) {
|
||||||
theEventWriter.writeStartElement("search");
|
theEventWriter.writeStartElement("search");
|
||||||
writeOptionalTagWithValue(theEventWriter, "mode", nextEntry.getSearchMode().getValueAsString());
|
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) {
|
if (nextEntry.getTransactionOperation().isEmpty() == false || nextEntry.getLinkSearch().isEmpty() == false) {
|
||||||
theEventWriter.writeStartElement("transaction");
|
theEventWriter.writeStartElement("transaction");
|
||||||
writeOptionalTagWithValue(theEventWriter, "operation", nextEntry.getTransactionOperation().getValue());
|
writeOptionalTagWithValue(theEventWriter, "operation", nextEntry.getTransactionOperation().getValue());
|
||||||
writeOptionalTagWithValue(theEventWriter, "match", nextEntry.getLinkSearch().getValue());
|
writeOptionalTagWithValue(theEventWriter, "url", nextEntry.getLinkSearch().getValue());
|
||||||
theEventWriter.writeEndElement();
|
theEventWriter.writeEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean deleted = false;
|
if (deleted) {
|
||||||
if (nextEntry.getDeletedAt() != null && nextEntry.getDeletedAt().isEmpty() == false) {
|
|
||||||
deleted = true;
|
|
||||||
theEventWriter.writeStartElement("deleted");
|
theEventWriter.writeStartElement("deleted");
|
||||||
writeOptionalTagWithValue(theEventWriter, "type", nextEntry.getId().getResourceType());
|
writeOptionalTagWithValue(theEventWriter, "type", nextEntry.getId().getResourceType());
|
||||||
writeOptionalTagWithValue(theEventWriter, "id", nextEntry.getId().getIdPart());
|
writeOptionalTagWithValue(theEventWriter, "id", nextEntry.getId().getIdPart());
|
||||||
|
@ -413,15 +426,6 @@ public class XmlParser extends BaseParser implements IParser {
|
||||||
theEventWriter.writeEndElement();
|
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
|
theEventWriter.writeEndElement(); // entry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +492,11 @@ public class XmlParser extends BaseParser implements IParser {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RESOURCE: {
|
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: {
|
case PRIMITIVE_XHTML: {
|
||||||
XhtmlDt dt = (XhtmlDt) nextValue;
|
XhtmlDt dt = (XhtmlDt) nextValue;
|
||||||
|
@ -703,7 +711,11 @@ public class XmlParser extends BaseParser implements IParser {
|
||||||
IdDt resourceId = resource.getId();
|
IdDt resourceId = resource.getId();
|
||||||
if (resourceId != null && isNotBlank(resourceId.getVersionIdPart()) || (updated != null && !updated.isEmpty())) {
|
if (resourceId != null && isNotBlank(resourceId.getVersionIdPart()) || (updated != null && !updated.isEmpty())) {
|
||||||
theEventWriter.writeStartElement("meta");
|
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) {
|
if (updated != null) {
|
||||||
writeOptionalTagWithValue(theEventWriter, "lastUpdated", updated.getValueAsString());
|
writeOptionalTagWithValue(theEventWriter, "lastUpdated", updated.getValueAsString());
|
||||||
}
|
}
|
||||||
|
@ -922,7 +934,7 @@ public class XmlParser extends BaseParser implements IParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends IBaseResource> T parseResource(Class<T> theResourceType, Reader theReader) {
|
public <T extends IBaseResource> T doParseResource(Class<T> theResourceType, Reader theReader) {
|
||||||
XMLEventReader streamReader = createStreamReader(theReader);
|
XMLEventReader streamReader = createStreamReader(theReader);
|
||||||
return parseResource(theResourceType, streamReader);
|
return parseResource(theResourceType, streamReader);
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,14 @@ public interface IRestfulClientFactory {
|
||||||
*/
|
*/
|
||||||
void setProxy(String theHost, Integer thePort);
|
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
|
* Sets the server validation mode for any clients created from this factory. Server
|
||||||
* validation involves the client requesting the server's conformance statement
|
* validation involves the client requesting the server's conformance statement
|
||||||
|
|
|
@ -23,6 +23,7 @@ package ca.uhn.fhir.rest.client;
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Proxy;
|
import java.lang.reflect.Proxy;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -32,9 +33,15 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import org.apache.http.HttpHost;
|
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.HttpClient;
|
||||||
import org.apache.http.client.config.RequestConfig;
|
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.HttpClients;
|
||||||
|
import org.apache.http.impl.client.ProxyAuthenticationStrategy;
|
||||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.ConfigurationException;
|
import ca.uhn.fhir.context.ConfigurationException;
|
||||||
|
@ -100,18 +107,35 @@ public class RestfulClientFactory implements IRestfulClientFactory {
|
||||||
.setProxy(myProxy)
|
.setProxy(myProxy)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
myHttpClient = HttpClients.custom()
|
HttpClientBuilder builder = HttpClients.custom()
|
||||||
.setConnectionManager(connectionManager)
|
.setConnectionManager(connectionManager)
|
||||||
.setDefaultRequestConfig(defaultRequestConfig)
|
.setDefaultRequestConfig(defaultRequestConfig)
|
||||||
.disableCookieManagement()
|
.disableCookieManagement();
|
||||||
.build();
|
|
||||||
|
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
|
//@formatter:on
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return myHttpClient;
|
return myHttpClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String myProxyUsername;
|
||||||
|
private String myProxyPassword;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProxyCredentials(String theUsername, String thePassword) {
|
||||||
|
myProxyUsername=theUsername;
|
||||||
|
myProxyPassword=thePassword;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServerValidationModeEnum getServerValidationModeEnum() {
|
public ServerValidationModeEnum getServerValidationModeEnum() {
|
||||||
return myServerValidationMode;
|
return myServerValidationMode;
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package org.hl7.fhir.instance.model.api;
|
||||||
|
|
||||||
|
import org.hl7.fhir.instance.model.IBaseResource;
|
||||||
|
|
||||||
|
public interface IBaseBundle extends IBaseResource {
|
||||||
|
|
||||||
|
}
|
|
@ -86,25 +86,27 @@ public class HttpProxyTest {
|
||||||
server.start();
|
server.start();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
final String authUser = "username";
|
// final String authUser = "username";
|
||||||
final String authPassword = "password";
|
// final String authPassword = "password";
|
||||||
CredentialsProvider credsProvider = new BasicCredentialsProvider();
|
// CredentialsProvider credsProvider = new BasicCredentialsProvider();
|
||||||
credsProvider.setCredentials(new AuthScope("127.0.0.1", port), new UsernamePasswordCredentials(authUser, authPassword));
|
// credsProvider.setCredentials(new AuthScope("127.0.0.1", port), new UsernamePasswordCredentials(authUser, authPassword));
|
||||||
|
//
|
||||||
HttpHost myProxy = new HttpHost("127.0.0.1", port);
|
// HttpHost myProxy = new HttpHost("127.0.0.1", port);
|
||||||
|
//
|
||||||
//@formatter:off
|
// //@formatter:off
|
||||||
HttpClientBuilder clientBuilder = HttpClientBuilder.create();
|
// HttpClientBuilder clientBuilder = HttpClientBuilder.create();
|
||||||
clientBuilder
|
// clientBuilder
|
||||||
.setProxy(myProxy)
|
// .setProxy(myProxy)
|
||||||
.setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy())
|
// .setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy())
|
||||||
.setDefaultCredentialsProvider(credsProvider)
|
// .setDefaultCredentialsProvider(credsProvider)
|
||||||
.disableCookieManagement();
|
// .disableCookieManagement();
|
||||||
CloseableHttpClient httpClient = clientBuilder.build();
|
// CloseableHttpClient httpClient = clientBuilder.build();
|
||||||
//@formatter:on
|
// //@formatter:on
|
||||||
|
// ourCtx.getRestfulClientFactory().setHttpClient(httpClient);
|
||||||
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";
|
String baseUri = "http://99.99.99.99:" + port + "/rootctx/rcp2/fhirctx/fcp2";
|
||||||
IGenericClient client = ourCtx.newRestfulGenericClient(baseUri);
|
IGenericClient client = ourCtx.newRestfulGenericClient(baseUri);
|
||||||
|
|
||||||
|
|
|
@ -62,17 +62,17 @@ public class TransactionWithBundleParamTest {
|
||||||
Patient p1 = new Patient();
|
Patient p1 = new Patient();
|
||||||
p1.addName().addFamily("Family1");
|
p1.addName().addFamily("Family1");
|
||||||
BundleEntry entry = b.addEntry();
|
BundleEntry entry = b.addEntry();
|
||||||
entry.getId().setValue("1");
|
p1.getId().setValue("1");
|
||||||
entry.setResource(p1);
|
entry.setResource(p1);
|
||||||
|
|
||||||
Patient p2 = new Patient();
|
Patient p2 = new Patient();
|
||||||
p2.addName().addFamily("Family2");
|
p2.addName().addFamily("Family2");
|
||||||
entry = b.addEntry();
|
entry = b.addEntry();
|
||||||
entry.getId().setValue("2");
|
p2.getId().setValue("2");
|
||||||
entry.setResource(p2);
|
entry.setResource(p2);
|
||||||
|
|
||||||
BundleEntry deletedEntry = b.addEntry();
|
BundleEntry deletedEntry = b.addEntry();
|
||||||
deletedEntry.setId(new IdDt("Patient/3"));
|
deletedEntry.setDeletedResourceId(new IdDt("Patient/3"));
|
||||||
deletedEntry.setDeleted(nowInstant);
|
deletedEntry.setDeleted(nowInstant);
|
||||||
|
|
||||||
String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
|
String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
|
||||||
|
@ -92,17 +92,17 @@ public class TransactionWithBundleParamTest {
|
||||||
assertEquals(3, bundle.size());
|
assertEquals(3, bundle.size());
|
||||||
|
|
||||||
BundleEntry entry0 = bundle.getEntries().get(0);
|
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/81/_history/91", entry0.getLinkSelf().getValue());
|
||||||
assertEquals("http://localhost:" + ourPort + "/Patient/1", entry0.getLinkAlternate().getValue());
|
assertEquals("http://localhost:" + ourPort + "/Patient/1", entry0.getLinkAlternate().getValue());
|
||||||
|
|
||||||
BundleEntry entry1 = bundle.getEntries().get(1);
|
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/82/_history/92", entry1.getLinkSelf().getValue());
|
||||||
assertEquals("http://localhost:" + ourPort + "/Patient/2", entry1.getLinkAlternate().getValue());
|
assertEquals("http://localhost:" + ourPort + "/Patient/2", entry1.getLinkAlternate().getValue());
|
||||||
|
|
||||||
BundleEntry entry2 = bundle.getEntries().get(2);
|
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("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getLinkSelf().getValue());
|
||||||
assertEquals(nowInstant.getValueAsString(), entry2.getDeletedAt().getValueAsString());
|
assertEquals(nowInstant.getValueAsString(), entry2.getDeletedAt().getValueAsString());
|
||||||
}
|
}
|
||||||
|
@ -118,17 +118,17 @@ public class TransactionWithBundleParamTest {
|
||||||
Patient p1 = new Patient();
|
Patient p1 = new Patient();
|
||||||
p1.addName().addFamily("Family1");
|
p1.addName().addFamily("Family1");
|
||||||
BundleEntry entry = b.addEntry();
|
BundleEntry entry = b.addEntry();
|
||||||
entry.getId().setValue("1");
|
p1.getId().setValue("1");
|
||||||
entry.setResource(p1);
|
entry.setResource(p1);
|
||||||
|
|
||||||
Patient p2 = new Patient();
|
Patient p2 = new Patient();
|
||||||
p2.addName().addFamily("Family2");
|
p2.addName().addFamily("Family2");
|
||||||
entry = b.addEntry();
|
entry = b.addEntry();
|
||||||
entry.getId().setValue("2");
|
p2.getId().setValue("2");
|
||||||
entry.setResource(p2);
|
entry.setResource(p2);
|
||||||
|
|
||||||
BundleEntry deletedEntry = b.addEntry();
|
BundleEntry deletedEntry = b.addEntry();
|
||||||
deletedEntry.setId(new IdDt("Patient/3"));
|
deletedEntry.setDeletedResourceId(new IdDt("Patient/3"));
|
||||||
deletedEntry.setDeleted(nowInstant);
|
deletedEntry.setDeleted(nowInstant);
|
||||||
|
|
||||||
String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
|
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());
|
assertEquals("OperationOutcome (no ID)", bundle.getEntries().get(0).getTitle().getValue());
|
||||||
|
|
||||||
BundleEntry entry0 = bundle.getEntries().get(1);
|
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/81/_history/91", entry0.getLinkSelf().getValue());
|
||||||
assertEquals("http://localhost:" + ourPort + "/Patient/1", entry0.getLinkAlternate().getValue());
|
assertEquals("http://localhost:" + ourPort + "/Patient/1", entry0.getLinkAlternate().getValue());
|
||||||
|
|
||||||
BundleEntry entry1 = bundle.getEntries().get(2);
|
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/82/_history/92", entry1.getLinkSelf().getValue());
|
||||||
assertEquals("http://localhost:" + ourPort + "/Patient/2", entry1.getLinkAlternate().getValue());
|
assertEquals("http://localhost:" + ourPort + "/Patient/2", entry1.getLinkAlternate().getValue());
|
||||||
|
|
||||||
BundleEntry entry2 = bundle.getEntries().get(3);
|
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("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getLinkSelf().getValue());
|
||||||
assertEquals(nowInstant.getValueAsString(), entry2.getDeletedAt().getValueAsString());
|
assertEquals(nowInstant.getValueAsString(), entry2.getDeletedAt().getValueAsString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@
|
||||||
<!--<baseResourceName>assessmentdefinition</baseResourceName>-->
|
<!--<baseResourceName>assessmentdefinition</baseResourceName>-->
|
||||||
<baseResourceName>basic</baseResourceName>
|
<baseResourceName>basic</baseResourceName>
|
||||||
<!--<baseResourceName>binary</baseResourceName>-->
|
<!--<baseResourceName>binary</baseResourceName>-->
|
||||||
<!--<baseResourceName>bundle</baseResourceName>-->
|
<baseResourceName>bundle</baseResourceName>
|
||||||
<!--<baseResourceName>careactivity</baseResourceName>-->
|
<!--<baseResourceName>careactivity</baseResourceName>-->
|
||||||
<baseResourceName>careplan</baseResourceName>
|
<baseResourceName>careplan</baseResourceName>
|
||||||
<baseResourceName>careplan2</baseResourceName>
|
<baseResourceName>careplan2</baseResourceName>
|
||||||
|
|
|
@ -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
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
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
|
||||||
-->
|
-->
|
||||||
<xs:schema xmlns="http://hl7.org/fhir" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://hl7.org/fhir" elementFormDefault="qualified" version="0.4.0">
|
<xs:schema xmlns="http://hl7.org/fhir" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://hl7.org/fhir" elementFormDefault="qualified" version="0.4.0">
|
||||||
<xs:include schemaLocation="alert.xsd"/>
|
<xs:include schemaLocation="alert.xsd"/>
|
||||||
|
@ -122,6 +122,7 @@ Copyright (c) 2011+, HL7, Inc
|
||||||
<xs:include schemaLocation="specimen.xsd"/>
|
<xs:include schemaLocation="specimen.xsd"/>
|
||||||
<xs:include schemaLocation="statusrequest.xsd"/>
|
<xs:include schemaLocation="statusrequest.xsd"/>
|
||||||
<xs:include schemaLocation="statusresponse.xsd"/>
|
<xs:include schemaLocation="statusresponse.xsd"/>
|
||||||
|
<xs:include schemaLocation="structuredefinition.xsd"/>
|
||||||
<xs:include schemaLocation="subscription.xsd"/>
|
<xs:include schemaLocation="subscription.xsd"/>
|
||||||
<xs:include schemaLocation="substance.xsd"/>
|
<xs:include schemaLocation="substance.xsd"/>
|
||||||
<xs:include schemaLocation="supply.xsd"/>
|
<xs:include schemaLocation="supply.xsd"/>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
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
|
||||||
-->
|
-->
|
||||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://hl7.org/fhir" xmlns:xhtml="http://www.w3.org/1999/xhtml" targetNamespace="http://hl7.org/fhir" elementFormDefault="qualified" version="0.4.0">
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://hl7.org/fhir" xmlns:xhtml="http://www.w3.org/1999/xhtml" targetNamespace="http://hl7.org/fhir" elementFormDefault="qualified" version="0.4.0">
|
||||||
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
|
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
|
||||||
|
@ -351,6 +351,7 @@
|
||||||
<xs:element ref="Specimen"/>
|
<xs:element ref="Specimen"/>
|
||||||
<xs:element ref="StatusRequest"/>
|
<xs:element ref="StatusRequest"/>
|
||||||
<xs:element ref="StatusResponse"/>
|
<xs:element ref="StatusResponse"/>
|
||||||
|
<xs:element ref="StructureDefinition"/>
|
||||||
<xs:element ref="Subscription"/>
|
<xs:element ref="Subscription"/>
|
||||||
<xs:element ref="Substance"/>
|
<xs:element ref="Substance"/>
|
||||||
<xs:element ref="Supply"/>
|
<xs:element ref="Supply"/>
|
||||||
|
@ -358,6 +359,7 @@
|
||||||
<xs:element ref="ValueSet"/>
|
<xs:element ref="ValueSet"/>
|
||||||
<xs:element ref="VisionClaim"/>
|
<xs:element ref="VisionClaim"/>
|
||||||
<xs:element ref="VisionPrescription"/>
|
<xs:element ref="VisionPrescription"/>
|
||||||
|
<xs:element ref="Parameters"/>
|
||||||
</xs:choice>
|
</xs:choice>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
<xs:complexType name="Extension">
|
<xs:complexType name="Extension">
|
||||||
|
@ -2301,7 +2303,7 @@ P.O. Box number, delivery hints, and similar address information.</xs:documentat
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
<xs:complexType name="DomainResource">
|
<xs:complexType name="DomainResource">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation></xs:documentation>
|
<xs:documentation>A resource that includes narrative, extensions, and contained resources.</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
<xs:complexContent>
|
<xs:complexContent>
|
||||||
<xs:extension base="Resource">
|
<xs:extension base="Resource">
|
||||||
|
@ -2330,6 +2332,41 @@ P.O. Box number, delivery hints, and similar address information.</xs:documentat
|
||||||
</xs:extension>
|
</xs:extension>
|
||||||
</xs:complexContent>
|
</xs:complexContent>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="ExtensionContext-list">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="resource">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>The context is all elements matching a particular resource element path.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:enumeration>
|
||||||
|
<xs:enumeration value="datatype">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>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).</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:enumeration>
|
||||||
|
<xs:enumeration value="mapping">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>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.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:enumeration>
|
||||||
|
<xs:enumeration value="extension">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>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.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:enumeration>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="ExtensionContext">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation></xs:documentation>
|
||||||
|
<xs:documentation>If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
<xs:complexContent>
|
||||||
|
<xs:extension base="Element">
|
||||||
|
<xs:attribute name="value" type="ExtensionContext-list" use="optional"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:complexContent>
|
||||||
|
</xs:complexType>
|
||||||
<xs:simpleType name="DataAbsentReason-list">
|
<xs:simpleType name="DataAbsentReason-list">
|
||||||
<xs:restriction base="xs:string">
|
<xs:restriction base="xs:string">
|
||||||
<xs:enumeration value="unknown">
|
<xs:enumeration value="unknown">
|
||||||
|
@ -2447,7 +2484,7 @@ P.O. Box number, delivery hints, and similar address information.</xs:documentat
|
||||||
<xs:documentation>The value is no longer available</xs:documentation>
|
<xs:documentation>The value is no longer available</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:enumeration>
|
</xs:enumeration>
|
||||||
<xs:enumeration value="nil known">
|
<xs:enumeration value="nil-known">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>The are no known applicable values in this context</xs:documentation>
|
<xs:documentation>The are no known applicable values in this context</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
|
@ -2717,7 +2754,7 @@ P.O. Box number, delivery hints, and similar address information.</xs:documentat
|
||||||
<xs:documentation>The Patient is present for the encounter, however is not currently meeting with a practitioner.</xs:documentation>
|
<xs:documentation>The Patient is present for the encounter, however is not currently meeting with a practitioner.</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:enumeration>
|
</xs:enumeration>
|
||||||
<xs:enumeration value="in progress">
|
<xs:enumeration value="in-progress">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>The Encounter has begun and the patient is present / the practitioner and the patient are meeting.</xs:documentation>
|
<xs:documentation>The Encounter has begun and the patient is present / the practitioner and the patient are meeting.</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
|
@ -2912,7 +2949,7 @@ P.O. Box number, delivery hints, and similar address information.</xs:documentat
|
||||||
<xs:documentation>The specified property of the code is in the set of codes or concepts specified in the provided value (comma separated list).</xs:documentation>
|
<xs:documentation>The specified property of the code is in the set of codes or concepts specified in the provided value (comma separated list).</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:enumeration>
|
</xs:enumeration>
|
||||||
<xs:enumeration value="not in">
|
<xs:enumeration value="not-in">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>The specified property of the code is not in the set of codes or concepts specified in the provided value (comma separated list).</xs:documentation>
|
<xs:documentation>The specified property of the code is not in the set of codes or concepts specified in the provided value (comma separated list).</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
|
@ -2942,7 +2979,7 @@ P.O. Box number, delivery hints, and similar address information.</xs:documentat
|
||||||
<xs:documentation>This reference has been superseded by another reference.</xs:documentation>
|
<xs:documentation>This reference has been superseded by another reference.</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:enumeration>
|
</xs:enumeration>
|
||||||
<xs:enumeration value="entered in error">
|
<xs:enumeration value="entered-in-error">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>This reference was created in error.</xs:documentation>
|
<xs:documentation>This reference was created in error.</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
|
@ -3727,6 +3764,11 @@ P.O. Box number, delivery hints, and similar address information.</xs:documentat
|
||||||
<xs:documentation>This resource provides processing status, errors and notes from the processing of a resource.</xs:documentation>
|
<xs:documentation>This resource provides processing status, errors and notes from the processing of a resource.</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:enumeration>
|
</xs:enumeration>
|
||||||
|
<xs:enumeration value="StructureDefinition">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>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.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:enumeration>
|
||||||
<xs:enumeration value="Subscription">
|
<xs:enumeration value="Subscription">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>Todo.</xs:documentation>
|
<xs:documentation>Todo.</xs:documentation>
|
||||||
|
@ -4372,6 +4414,11 @@ P.O. Box number, delivery hints, and similar address information.</xs:documentat
|
||||||
<xs:documentation>This resource provides processing status, errors and notes from the processing of a resource.</xs:documentation>
|
<xs:documentation>This resource provides processing status, errors and notes from the processing of a resource.</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:enumeration>
|
</xs:enumeration>
|
||||||
|
<xs:enumeration value="StructureDefinition">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>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.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:enumeration>
|
||||||
<xs:enumeration value="Subscription">
|
<xs:enumeration value="Subscription">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>Todo.</xs:documentation>
|
<xs:documentation>Todo.</xs:documentation>
|
||||||
|
@ -4442,7 +4489,7 @@ P.O. Box number, delivery hints, and similar address information.</xs:documentat
|
||||||
<xs:documentation>The composition or document has been modified subsequent to being released as "final", and is complete and verified by an authorized person.</xs:documentation>
|
<xs:documentation>The composition or document has been modified subsequent to being released as "final", and is complete and verified by an authorized person.</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:enumeration>
|
</xs:enumeration>
|
||||||
<xs:enumeration value="entered in error">
|
<xs:enumeration value="entered-in-error">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>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.</xs:documentation>
|
<xs:documentation>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.</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -94,14 +94,6 @@ public class JsonParserTest {
|
||||||
" }],\n" +
|
" }],\n" +
|
||||||
" \"entry\" : [{\n" +
|
" \"entry\" : [{\n" +
|
||||||
" \"base\" : \"http://foo/fhirBase2\",\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" +
|
" \"resource\" : {\n" +
|
||||||
" \"resourceType\" : \"Patient\",\n" +
|
" \"resourceType\" : \"Patient\",\n" +
|
||||||
" \"id\" : \"1\",\n" +
|
" \"id\" : \"1\",\n" +
|
||||||
|
@ -110,7 +102,15 @@ public class JsonParserTest {
|
||||||
" \"lastUpdated\" : \"2001-02-22T11:22:33-05:00\"\n" +
|
" \"lastUpdated\" : \"2001-02-22T11:22:33-05:00\"\n" +
|
||||||
" },\n" +
|
" },\n" +
|
||||||
" \"birthDate\" : \"2012-01-02\"\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" +
|
" }]\n" +
|
||||||
"}";
|
"}";
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
@ -201,6 +201,48 @@ public class JsonParserTest {
|
||||||
assertEquals(exp, act);
|
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
|
@Test
|
||||||
public void testParseAndEncodeNewExtensionFormat() {
|
public void testParseAndEncodeNewExtensionFormat() {
|
||||||
|
|
|
@ -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
|
@Test
|
||||||
public void testEncodeAndParseBundleWithoutResourceIds() {
|
public void testEncodeAndParseBundleWithoutResourceIds() {
|
||||||
Organization org = new Organization();
|
Organization org = new Organization();
|
||||||
|
@ -144,14 +176,6 @@ public class XmlParserTest {
|
||||||
" </link>\n" +
|
" </link>\n" +
|
||||||
" <entry>\n" +
|
" <entry>\n" +
|
||||||
" <base value=\"http://foo/fhirBase2\"/>\n" +
|
" <base value=\"http://foo/fhirBase2\"/>\n" +
|
||||||
" <search>\n" +
|
|
||||||
" <mode value=\"match\"/>\n" +
|
|
||||||
" <score value=\"0.123\"/>\n" +
|
|
||||||
" </search>\n" +
|
|
||||||
" <transaction>\n" +
|
|
||||||
" <operation value=\"create\"/>\n" +
|
|
||||||
" <match value=\"http://foo/Patient?identifier=value\"/>\n" +
|
|
||||||
" </transaction>\n" +
|
|
||||||
" <resource>\n" +
|
" <resource>\n" +
|
||||||
" <Patient xmlns=\"http://hl7.org/fhir\">\n" +
|
" <Patient xmlns=\"http://hl7.org/fhir\">\n" +
|
||||||
" <id value=\"1\"/>\n" +
|
" <id value=\"1\"/>\n" +
|
||||||
|
@ -162,6 +186,14 @@ public class XmlParserTest {
|
||||||
" <birthDate value=\"2012-01-02\"/>\n" +
|
" <birthDate value=\"2012-01-02\"/>\n" +
|
||||||
" </Patient>\n" +
|
" </Patient>\n" +
|
||||||
" </resource>\n" +
|
" </resource>\n" +
|
||||||
|
" <search>\n" +
|
||||||
|
" <mode value=\"match\"/>\n" +
|
||||||
|
" <score value=\"0.123\"/>\n" +
|
||||||
|
" </search>\n" +
|
||||||
|
" <transaction>\n" +
|
||||||
|
" <operation value=\"create\"/>\n" +
|
||||||
|
" <url value=\"http://foo/Patient?identifier=value\"/>\n" +
|
||||||
|
" </transaction>\n" +
|
||||||
" </entry>\n" +
|
" </entry>\n" +
|
||||||
"</Bundle>";
|
"</Bundle>";
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
|
@ -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<IResource> 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<IResource> retVal = theResources.toListOfResources();
|
||||||
|
if (ourReturnOperationOutcome) {
|
||||||
|
retVal = new ArrayList<IResource>();
|
||||||
|
OperationOutcome oo = new OperationOutcome();
|
||||||
|
oo.addIssue().setDetails("AAAAA");
|
||||||
|
retVal.add(oo);
|
||||||
|
retVal.addAll(theResources.toListOfResources());
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -20,10 +20,6 @@
|
||||||
],
|
],
|
||||||
"entry": [
|
"entry": [
|
||||||
{
|
{
|
||||||
"search": {
|
|
||||||
"mode": "match",
|
|
||||||
"score": 1
|
|
||||||
},
|
|
||||||
"resource": {
|
"resource": {
|
||||||
"resourceType": "MedicationPrescription",
|
"resourceType": "MedicationPrescription",
|
||||||
"id": "3123",
|
"id": "3123",
|
||||||
|
@ -37,15 +33,19 @@
|
||||||
"medication": {
|
"medication": {
|
||||||
"reference": "Medication/example"
|
"reference": "Medication/example"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"mode": "match",
|
||||||
|
"score": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"search": {
|
|
||||||
"mode": "include"
|
|
||||||
},
|
|
||||||
"resource": {
|
"resource": {
|
||||||
"resourceType": "Medication",
|
"resourceType": "Medication",
|
||||||
"id": "example"
|
"id": "example"
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"mode": "include"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<meta>
|
<meta>
|
||||||
<versionId value="1"/>
|
<versionId value="1"/>
|
||||||
<lastUpdated value="2014-08-18T01:43:30Z"/>
|
<lastUpdated value="2014-08-18T01:43:30Z"/>
|
||||||
</meta>
|
</meta>
|
||||||
<type value="searchset"/>
|
<type value="searchset"/>
|
||||||
<base value="http://example.com/base"/>
|
<base value="http://example.com/base"/>
|
||||||
<total value="3"/>
|
<total value="3"/>
|
||||||
|
@ -16,13 +16,6 @@
|
||||||
<url value="https://example.com/base/MedicationPrescription?patient=347&_include=MedicationPrescription.medication"/>
|
<url value="https://example.com/base/MedicationPrescription?patient=347&_include=MedicationPrescription.medication"/>
|
||||||
</link>
|
</link>
|
||||||
<entry>
|
<entry>
|
||||||
<search>
|
|
||||||
<mode value="match"/>
|
|
||||||
<score value="1"/>
|
|
||||||
</search>
|
|
||||||
<transaction>
|
|
||||||
<match value="http://foo?search"/>
|
|
||||||
</transaction>
|
|
||||||
<resource>
|
<resource>
|
||||||
<MedicationPrescription>
|
<MedicationPrescription>
|
||||||
<id value="3123"/>
|
<id value="3123"/>
|
||||||
|
@ -38,15 +31,22 @@
|
||||||
</medication>
|
</medication>
|
||||||
</MedicationPrescription>
|
</MedicationPrescription>
|
||||||
</resource>
|
</resource>
|
||||||
|
<search>
|
||||||
|
<mode value="match"/>
|
||||||
|
<score value="1"/>
|
||||||
|
</search>
|
||||||
|
<transaction>
|
||||||
|
<url value="http://foo?search"/>
|
||||||
|
</transaction>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<search>
|
|
||||||
<mode value="include"/>
|
|
||||||
</search>
|
|
||||||
<resource>
|
<resource>
|
||||||
<Medication>
|
<Medication>
|
||||||
<id value="example"/>
|
<id value="example"/>
|
||||||
</Medication>
|
</Medication>
|
||||||
</resource>
|
</resource>
|
||||||
|
<search>
|
||||||
|
<mode value="include"/>
|
||||||
|
</search>
|
||||||
</entry>
|
</entry>
|
||||||
</Bundle>
|
</Bundle>
|
|
@ -13,6 +13,7 @@
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" path="src/main/resources"/>
|
<classpathentry kind="src" path="src/main/resources"/>
|
||||||
|
<classpathentry kind="src" path="src/test/resources"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
|
|
@ -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.Description;
|
||||||
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
import org.hl7.fhir.instance.model.annotations.ResourceDef;
|
||||||
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
import org.hl7.fhir.instance.model.annotations.SearchParamDefinition;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
/**
|
/**
|
||||||
* A container for a group of resources.
|
* A container for a group of resources.
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="Bundle", profile="http://hl7.org/fhir/Profile/Bundle")
|
@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 {
|
public enum BundleType {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
<Bundle xmlns="http://hl7.org/fhir">
|
||||||
|
<id value="example"/>
|
||||||
|
<meta>
|
||||||
|
<versionId value="1"/>
|
||||||
|
<lastUpdated value="2014-08-18T01:43:30Z"/>
|
||||||
|
</meta>
|
||||||
|
<type value="searchset"/>
|
||||||
|
<base value="http://example.com/base"/>
|
||||||
|
<total value="3"/>
|
||||||
|
<link>
|
||||||
|
<relation value="next"/>
|
||||||
|
<url value="https://example.com/base/MedicationPrescription?patient=347&searchId=ff15fd40-ff71-4b48-b366-09c706bed9d0&page=2"/>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<relation value="self"/>
|
||||||
|
<url value="https://example.com/base/MedicationPrescription?patient=347&_include=MedicationPrescription.medication"/>
|
||||||
|
</link>
|
||||||
|
<entry>
|
||||||
|
<resource>
|
||||||
|
<MedicationPrescription>
|
||||||
|
<id value="3123"/>
|
||||||
|
<meta>
|
||||||
|
<versionId value="1"/>
|
||||||
|
<lastUpdated value="2014-08-16T05:31:17Z"/>
|
||||||
|
</meta>
|
||||||
|
<patient>
|
||||||
|
<reference value="Patient/347"/>
|
||||||
|
</patient>
|
||||||
|
<medication>
|
||||||
|
<reference value="Medication/example"/>
|
||||||
|
</medication>
|
||||||
|
</MedicationPrescription>
|
||||||
|
</resource>
|
||||||
|
<search>
|
||||||
|
<mode value="match"/>
|
||||||
|
<score value="1"/>
|
||||||
|
</search>
|
||||||
|
<transaction>
|
||||||
|
<url value="http://foo?search"/>
|
||||||
|
</transaction>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<resource>
|
||||||
|
<Medication>
|
||||||
|
<id value="example"/>
|
||||||
|
</Medication>
|
||||||
|
</resource>
|
||||||
|
<search>
|
||||||
|
<mode value="include"/>
|
||||||
|
</search>
|
||||||
|
</entry>
|
||||||
|
</Bundle>
|
|
@ -92,6 +92,9 @@ public class TinderJpaRestServerMojo extends AbstractMojo {
|
||||||
}
|
}
|
||||||
for (String next : keys) {
|
for (String next : keys) {
|
||||||
if (next.startsWith("resource.")) {
|
if (next.startsWith("resource.")) {
|
||||||
|
if (next.endsWith(".Bundle")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
baseResourceNames.add(next.substring("resource.".length()).toLowerCase());
|
baseResourceNames.add(next.substring("resource.".length()).toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ public abstract class BaseElement {
|
||||||
return toStringConstant(myDefinition);
|
return toStringConstant(myDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toStringConstant(String theDefinition) {
|
static String toStringConstant(String theDefinition) {
|
||||||
if (theDefinition == null) {
|
if (theDefinition == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,11 @@ public abstract class Child extends BaseElement {
|
||||||
// } else {
|
// } else {
|
||||||
// retVal = (elemName + getTypeSuffix());
|
// retVal = (elemName + getTypeSuffix());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if (retVal.equals("ResourceDt")) {
|
||||||
|
retVal = "IResource";
|
||||||
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SearchParameter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return StringUtils.defaultString(myDescription);
|
return BaseElement.toStringConstant(myDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFluentConstantName() {
|
public String getFluentConstantName() {
|
||||||
|
|
|
@ -217,6 +217,9 @@ public abstract class BaseStructureParser {
|
||||||
// if ("ResourceReferenceDt".equals(theNextType)) {
|
// if ("ResourceReferenceDt".equals(theNextType)) {
|
||||||
// return "ca.uhn.fhir.model." + myVersion + ".composite." + ResourceReferenceDt.class.getSimpleName();
|
// return "ca.uhn.fhir.model." + myVersion + ".composite." + ResourceReferenceDt.class.getSimpleName();
|
||||||
// }
|
// }
|
||||||
|
if ("ResourceDt".equals(theNextType)) {
|
||||||
|
return IResource.class.getCanonicalName();
|
||||||
|
}
|
||||||
if ("Binary".equals(theNextType)) {
|
if ("Binary".equals(theNextType)) {
|
||||||
return "ca.uhn.fhir.model." + myVersion + ".resource." + Binary.class.getSimpleName();
|
return "ca.uhn.fhir.model." + myVersion + ".resource." + Binary.class.getSimpleName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,7 @@ public class DatatypeGeneratorUsingSpreadsheet extends BaseStructureSpreadsheetP
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!version.equals("dstu")) {
|
if (!version.equals("dstu")) {
|
||||||
|
retVal.add(("/dt/" + version + "/meta.xml"));
|
||||||
retVal.add(("/dt/" + version + "/attachment.xml"));
|
retVal.add(("/dt/" + version + "/attachment.xml"));
|
||||||
retVal.add(("/dt/" + version + "/contactpoint.xml"));
|
retVal.add(("/dt/" + version + "/contactpoint.xml"));
|
||||||
retVal.add(("/dt/" + version + "/elementdefinition.xml"));
|
retVal.add(("/dt/" + version + "/elementdefinition.xml"));
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,7 +15,8 @@ import ca.uhn.fhir.rest.annotation.*;
|
||||||
import ca.uhn.fhir.rest.param.*;
|
import ca.uhn.fhir.rest.param.*;
|
||||||
import ca.uhn.fhir.rest.api.SortSpec;
|
import ca.uhn.fhir.rest.api.SortSpec;
|
||||||
import ca.uhn.fhir.model.dstu.resource.Binary;
|
import ca.uhn.fhir.model.dstu.resource.Binary;
|
||||||
|
// import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||||
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
|
|
||||||
public class ${className}ResourceProvider extends JpaResourceProvider<${className}> {
|
public class ${className}ResourceProvider extends JpaResourceProvider<${className}> {
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,10 @@ import ${import};
|
||||||
*/
|
*/
|
||||||
@ResourceDef(name="${elementName}", profile="${profile}", id="${id}")
|
@ResourceDef(name="${elementName}", profile="${profile}", id="${id}")
|
||||||
public class ${className} extends ca.uhn.fhir.model.${version}.resource.BaseResource
|
public class ${className} extends ca.uhn.fhir.model.${version}.resource.BaseResource
|
||||||
implements #{if}( ${className}=="OperationOutcome" || ${className}=="Conformance" || ${className}=="SecurityEvent" ) ca.uhn.fhir.model.base.resource.Base${className} #{else} IResource #{end}
|
implements #{if}( ${className}=="OperationOutcome" || ${className}=="Conformance" || ${className}=="SecurityEvent" ) ca.uhn.fhir.model.base.resource.Base${className} #{else} IResource #{end}
|
||||||
|
#if ( ${className} == "Bundle" )
|
||||||
|
, org.hl7.fhir.instance.model.api.IBaseBundle
|
||||||
|
#end
|
||||||
{
|
{
|
||||||
|
|
||||||
#foreach ( $param in $searchParams )
|
#foreach ( $param in $searchParams )
|
||||||
|
|
|
@ -51,7 +51,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#foreach ( $child in $childElements )
|
#foreach ( $child in $childElements )
|
||||||
#if ( $child.primitive && $child.repeatable == false )
|
#if ( $child.referenceType == 'IResource' )
|
||||||
|
/**
|
||||||
|
* Gets the value(s) for <b>${child.elementName}</b> ($esc.html(${child.shortName})).
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* $esc.html(${child.definition})
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public ${child.referenceType} get${child.methodName}() {
|
||||||
|
return ${child.variableName};
|
||||||
|
}
|
||||||
|
|
||||||
|
#elseif ( $child.primitive && $child.repeatable == false )
|
||||||
/**
|
/**
|
||||||
* Gets the value(s) for <b>${child.elementName}</b> ($esc.html(${child.shortName})).
|
* Gets the value(s) for <b>${child.elementName}</b> ($esc.html(${child.shortName})).
|
||||||
* creating it if it does
|
* creating it if it does
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
1
pom.xml
1
pom.xml
|
@ -714,6 +714,7 @@
|
||||||
<module>hapi-fhir-structures-dstu2</module>
|
<module>hapi-fhir-structures-dstu2</module>
|
||||||
<module>hapi-fhir-structures-dev</module>
|
<module>hapi-fhir-structures-dev</module>
|
||||||
<module>hapi-fhir-jpaserver-base</module>
|
<module>hapi-fhir-jpaserver-base</module>
|
||||||
|
<module>hapi-fhir-jpaserver-example</module>
|
||||||
<module>restful-server-example</module>
|
<module>restful-server-example</module>
|
||||||
<module>restful-server-example-test</module>
|
<module>restful-server-example-test</module>
|
||||||
<module>hapi-fhir-testpage-overlay</module>
|
<module>hapi-fhir-testpage-overlay</module>
|
||||||
|
|
Loading…
Reference in New Issue