Work on transaction support for DSTU2
This commit is contained in:
parent
68bccf4f6f
commit
a81e081798
|
@ -48,6 +48,7 @@ import ca.uhn.fhir.rest.client.IRestfulClientFactory;
|
|||
import ca.uhn.fhir.rest.client.RestfulClientFactory;
|
||||
import ca.uhn.fhir.rest.client.api.IBasicClient;
|
||||
import ca.uhn.fhir.rest.client.api.IRestfulClient;
|
||||
import ca.uhn.fhir.rest.server.IVersionSpecificBundleFactory;
|
||||
import ca.uhn.fhir.util.FhirTerser;
|
||||
import ca.uhn.fhir.validation.FhirValidator;
|
||||
|
||||
|
@ -483,4 +484,8 @@ public class FhirContext {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
public IVersionSpecificBundleFactory newBundleFactory() {
|
||||
return myVersion.newBundleFactory(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.io.InputStream;
|
|||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
|
||||
|
@ -53,6 +54,6 @@ public interface IFhirVersion {
|
|||
|
||||
BaseCodingDt newCodingDt();
|
||||
|
||||
IVersionSpecificBundleFactory newBundleFactory();
|
||||
IVersionSpecificBundleFactory newBundleFactory(FhirContext theContext);
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.http.client.methods.HttpRequestBase;
|
|||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
|
@ -96,6 +97,7 @@ import ca.uhn.fhir.rest.method.TransactionMethodBinding;
|
|||
import ca.uhn.fhir.rest.method.ValidateMethodBinding;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.rest.server.EncodingEnum;
|
||||
import ca.uhn.fhir.rest.server.IVersionSpecificBundleFactory;
|
||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.NotModifiedException;
|
||||
|
@ -1062,9 +1064,19 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
myType = theType;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<IResource> invokeClient(String theResponseMimeType, Reader theResponseReader, int theResponseStatusCode, Map<String, List<String>> theHeaders) throws IOException, BaseServerResponseException {
|
||||
return new BundleResponseHandler(myType).invokeClient(theResponseMimeType, theResponseReader, theResponseStatusCode, theHeaders).toListOfResources();
|
||||
if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) {
|
||||
Class<? extends IBaseResource> bundleType = myContext.getResourceDefinition("Bundle").getImplementingClass();
|
||||
ResourceResponseHandler<IBaseResource> handler = new ResourceResponseHandler<IBaseResource>((Class<IBaseResource>) bundleType, null);
|
||||
IBaseResource response = handler.invokeClient(theResponseMimeType, theResponseReader, theResponseStatusCode, theHeaders);
|
||||
IVersionSpecificBundleFactory bundleFactory = myContext.newBundleFactory();
|
||||
bundleFactory.initializeWithBundleResource((IResource) response);
|
||||
return bundleFactory.toListOfResources();
|
||||
} else {
|
||||
return new BundleResponseHandler(myType).invokeClient(theResponseMimeType, theResponseReader, theResponseStatusCode, theHeaders).toListOfResources();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,16 +57,42 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
|||
*/
|
||||
abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvocation {
|
||||
|
||||
private final FhirContext myContext;
|
||||
private final IResource myResource;
|
||||
private final String myUrlPath;
|
||||
private final TagList myTagList;
|
||||
private final List<IResource> myResources;
|
||||
private final Bundle myBundle;
|
||||
private final BundleTypeEnum myBundleType;
|
||||
private final String myContents;
|
||||
private boolean myContentsIsBundle;
|
||||
private final FhirContext myContext;
|
||||
private Map<String, List<String>> myIfNoneExistParams;
|
||||
private String myIfNoneExistString;
|
||||
private Map<String, List<String>> myParams;
|
||||
private final BundleTypeEnum myBundleType;
|
||||
private final IResource myResource;
|
||||
private final List<IResource> myResources;
|
||||
private final TagList myTagList;
|
||||
private final String myUrlPath;
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, Bundle theBundle) {
|
||||
myContext = theContext;
|
||||
myResource = null;
|
||||
myTagList = null;
|
||||
myUrlPath = null;
|
||||
myResources = null;
|
||||
myBundle = theBundle;
|
||||
myContents = null;
|
||||
myBundleType = null;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, IResource theResource, Map<String, List<String>> theParams, String... theUrlPath) {
|
||||
myContext = theContext;
|
||||
myResource = theResource;
|
||||
myTagList = null;
|
||||
myUrlPath = StringUtils.join(theUrlPath, '/');
|
||||
myResources = null;
|
||||
myBundle = null;
|
||||
myContents = null;
|
||||
myContentsIsBundle = false;
|
||||
myParams = theParams;
|
||||
myBundleType = null;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, IResource theResource, String theUrlPath) {
|
||||
super();
|
||||
|
@ -80,6 +106,55 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca
|
|||
myBundleType = null;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, List<IResource> theResources, BundleTypeEnum theBundleType) {
|
||||
myContext = theContext;
|
||||
myResource = null;
|
||||
myTagList = null;
|
||||
myUrlPath = null;
|
||||
myResources = theResources;
|
||||
myBundle = null;
|
||||
myContents = null;
|
||||
myBundleType = theBundleType;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, Map<String, List<String>> theParams, String... theUrlPath) {
|
||||
myContext = theContext;
|
||||
myResource = null;
|
||||
myTagList = null;
|
||||
myUrlPath = StringUtils.join(theUrlPath, '/');
|
||||
myResources = null;
|
||||
myBundle = null;
|
||||
myContents = null;
|
||||
myContentsIsBundle = false;
|
||||
myParams = theParams;
|
||||
myBundleType = null;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, String theContents, boolean theIsBundle, String theUrlPath) {
|
||||
myContext = theContext;
|
||||
myResource = null;
|
||||
myTagList = null;
|
||||
myUrlPath = theUrlPath;
|
||||
myResources = null;
|
||||
myBundle = null;
|
||||
myContents = theContents;
|
||||
myContentsIsBundle = theIsBundle;
|
||||
myBundleType = null;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, String theContents, Map<String, List<String>> theParams, String... theUrlPath) {
|
||||
myContext = theContext;
|
||||
myResource = null;
|
||||
myTagList = null;
|
||||
myUrlPath = StringUtils.join(theUrlPath, '/');
|
||||
myResources = null;
|
||||
myBundle = null;
|
||||
myContents = theContents;
|
||||
myContentsIsBundle = false;
|
||||
myParams = theParams;
|
||||
myBundleType = null;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, TagList theTagList, String... theUrlPath) {
|
||||
super();
|
||||
if (theTagList == null) {
|
||||
|
@ -97,77 +172,19 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca
|
|||
myUrlPath = StringUtils.join(theUrlPath, '/');
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, List<IResource> theResources, BundleTypeEnum theBundleType) {
|
||||
myContext = theContext;
|
||||
myResource = null;
|
||||
myTagList = null;
|
||||
myUrlPath = null;
|
||||
myResources = theResources;
|
||||
myBundle = null;
|
||||
myContents = null;
|
||||
myBundleType = theBundleType;
|
||||
}
|
||||
private void addMatchHeaders(HttpRequestBase theHttpRequest, StringBuilder theUrlBase) {
|
||||
if (myIfNoneExistParams != null) {
|
||||
StringBuilder b = newHeaderBuilder(theUrlBase);
|
||||
appendExtraParamsWithQuestionMark(myIfNoneExistParams, b, b.indexOf("?") == -1);
|
||||
theHttpRequest.addHeader(Constants.HEADER_IF_NONE_EXIST, b.toString());
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, Bundle theBundle) {
|
||||
myContext = theContext;
|
||||
myResource = null;
|
||||
myTagList = null;
|
||||
myUrlPath = null;
|
||||
myResources = null;
|
||||
myBundle = theBundle;
|
||||
myContents = null;
|
||||
myBundleType = null;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, String theContents, boolean theIsBundle, String theUrlPath) {
|
||||
myContext = theContext;
|
||||
myResource = null;
|
||||
myTagList = null;
|
||||
myUrlPath = theUrlPath;
|
||||
myResources = null;
|
||||
myBundle = null;
|
||||
myContents = theContents;
|
||||
myContentsIsBundle = theIsBundle;
|
||||
myBundleType = null;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, Map<String, List<String>> theParams, String... theUrlPath) {
|
||||
myContext = theContext;
|
||||
myResource = null;
|
||||
myTagList = null;
|
||||
myUrlPath = StringUtils.join(theUrlPath, '/');
|
||||
myResources = null;
|
||||
myBundle = null;
|
||||
myContents = null;
|
||||
myContentsIsBundle = false;
|
||||
myParams = theParams;
|
||||
myBundleType = null;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, String theContents, Map<String, List<String>> theParams, String... theUrlPath) {
|
||||
myContext = theContext;
|
||||
myResource = null;
|
||||
myTagList = null;
|
||||
myUrlPath = StringUtils.join(theUrlPath, '/');
|
||||
myResources = null;
|
||||
myBundle = null;
|
||||
myContents = theContents;
|
||||
myContentsIsBundle = false;
|
||||
myParams = theParams;
|
||||
myBundleType = null;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, IResource theResource, Map<String, List<String>> theParams, String... theUrlPath) {
|
||||
myContext = theContext;
|
||||
myResource = theResource;
|
||||
myTagList = null;
|
||||
myUrlPath = StringUtils.join(theUrlPath, '/');
|
||||
myResources = null;
|
||||
myBundle = null;
|
||||
myContents = null;
|
||||
myContentsIsBundle = false;
|
||||
myParams = theParams;
|
||||
myBundleType = null;
|
||||
if (myIfNoneExistString != null) {
|
||||
StringBuilder b = newHeaderBuilder(theUrlBase);
|
||||
b.append(b.indexOf("?") == -1 ? '?' : '&');
|
||||
b.append(myIfNoneExistString.substring(myIfNoneExistString.indexOf('?') + 1));
|
||||
theHttpRequest.addHeader(Constants.HEADER_IF_NONE_EXIST, b.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -236,8 +253,8 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca
|
|||
contents = parser.encodeBundleToString(myBundle);
|
||||
contentType = encoding.getBundleContentType();
|
||||
} else if (myResources != null) {
|
||||
IVersionSpecificBundleFactory bundleFactory = myContext.getVersion().newBundleFactory();
|
||||
bundleFactory.initializeBundleFromResourceList(myContext, "", myResources, "", "", myResources.size(), myBundleType);
|
||||
IVersionSpecificBundleFactory bundleFactory = myContext.newBundleFactory();
|
||||
bundleFactory.initializeBundleFromResourceList("", myResources, "", "", myResources.size(), myBundleType);
|
||||
Bundle bundle = bundleFactory.getDstu1Bundle();
|
||||
if (bundle != null) {
|
||||
contents = parser.encodeBundleToString(bundle);
|
||||
|
@ -272,21 +289,7 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca
|
|||
return retVal;
|
||||
}
|
||||
|
||||
private void addMatchHeaders(HttpRequestBase theHttpRequest, StringBuilder theUrlBase) {
|
||||
if (myIfNoneExistParams != null) {
|
||||
StringBuilder b = newHeaderBuilder(theUrlBase);
|
||||
appendExtraParamsWithQuestionMark(myIfNoneExistParams, b, b.indexOf("?") == -1);
|
||||
theHttpRequest.addHeader(Constants.HEADER_IF_NONE_EXIST, b.toString());
|
||||
}
|
||||
|
||||
if (myIfNoneExistString != null) {
|
||||
StringBuilder b = newHeaderBuilder(theUrlBase);
|
||||
b.append(b.indexOf("?") == -1 ? '?' : '&');
|
||||
b.append(myIfNoneExistString.substring(myIfNoneExistString.indexOf('?') + 1));
|
||||
theHttpRequest.addHeader(Constants.HEADER_IF_NONE_EXIST, b.toString());
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract HttpRequestBase createRequest(StringBuilder theUrl, AbstractHttpEntity theEntity);
|
||||
private StringBuilder newHeaderBuilder(StringBuilder theUrlBase) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(theUrlBase);
|
||||
|
@ -296,11 +299,6 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca
|
|||
return b;
|
||||
}
|
||||
|
||||
protected abstract HttpRequestBase createRequest(StringBuilder theUrl, AbstractHttpEntity theEntity);
|
||||
|
||||
private Map<String, List<String>> myIfNoneExistParams;
|
||||
private String myIfNoneExistString;
|
||||
|
||||
public void setIfNoneExistParams(Map<String, List<String>> theIfNoneExist) {
|
||||
myIfNoneExistParams = theIfNoneExist;
|
||||
}
|
||||
|
|
|
@ -259,12 +259,22 @@ abstract class BaseResourceReturningMethodBinding extends BaseMethodBinding<Obje
|
|||
} else {
|
||||
resource = (IResource) resultObj;
|
||||
}
|
||||
|
||||
/*
|
||||
* We assume that the bundle we got back from the handling method
|
||||
* may not have everything populated (e.g. self links, bundle type,
|
||||
* etc) so we do that here.
|
||||
*/
|
||||
IVersionSpecificBundleFactory bundleFactory = theServer.getFhirContext().newBundleFactory();
|
||||
bundleFactory.initializeWithBundleResource(resource);
|
||||
bundleFactory.addRootPropertiesToBundle(null, theRequest.getFhirServerBase(), theRequest.getCompleteUrl(), count, getResponseBundleType());
|
||||
|
||||
RestfulServerUtils.streamResponseAsResource(theServer, response, resource, responseEncoding, prettyPrint, requestIsBrowser, narrativeMode, respondGzip, theRequest.getFhirServerBase());
|
||||
break;
|
||||
} else {
|
||||
|
||||
IBundleProvider result = (IBundleProvider) resultObj;
|
||||
IVersionSpecificBundleFactory bundleFactory = theServer.getFhirContext().getVersion().newBundleFactory();
|
||||
IVersionSpecificBundleFactory bundleFactory = theServer.getFhirContext().newBundleFactory();
|
||||
bundleFactory.initializeBundleFromBundleProvider(theServer, result, responseEncoding, theRequest.getFhirServerBase(), theRequest.getCompleteUrl(), prettyPrint, 0, count, null,
|
||||
getResponseBundleType());
|
||||
Bundle bundle = bundleFactory.getDstu1Bundle();
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.method;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
|
@ -37,15 +37,12 @@ import ca.uhn.fhir.model.dstu.valueset.RestfulOperationSystemEnum;
|
|||
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationTypeEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.parser.IParser;
|
||||
import ca.uhn.fhir.rest.annotation.Transaction;
|
||||
import ca.uhn.fhir.rest.annotation.TransactionParam;
|
||||
import ca.uhn.fhir.rest.client.BaseHttpClientInvocation;
|
||||
import ca.uhn.fhir.rest.method.SearchMethodBinding.RequestType;
|
||||
import ca.uhn.fhir.rest.method.TransactionParamBinder.ParamStyle;
|
||||
import ca.uhn.fhir.rest.server.EncodingEnum;
|
||||
import ca.uhn.fhir.rest.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
|
||||
|
|
|
@ -28,10 +28,15 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(Dstu1BundleFactory.class);
|
||||
private Bundle myBundle;
|
||||
private FhirContext myContext;
|
||||
|
||||
public Dstu1BundleFactory(FhirContext theContext) {
|
||||
myContext = theContext;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addResourcesToBundle(FhirContext theContext, List<IResource> theResult, BundleTypeEnum theBundleType, String theServerBase) {
|
||||
public void addResourcesToBundle(List<IResource> theResult, BundleTypeEnum theBundleType, String theServerBase) {
|
||||
if (myBundle == null) {
|
||||
myBundle = new Bundle();
|
||||
}
|
||||
|
@ -54,8 +59,8 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
}
|
||||
|
||||
if (theContext.getNarrativeGenerator() != null) {
|
||||
String title = theContext.getNarrativeGenerator().generateTitle(next);
|
||||
if (myContext.getNarrativeGenerator() != null) {
|
||||
String title = myContext.getNarrativeGenerator().generateTitle(next);
|
||||
ourLog.trace("Narrative generator created title: {}", title);
|
||||
if (StringUtils.isNotBlank(title)) {
|
||||
ResourceMetadataKeyEnum.TITLE.put(next, title);
|
||||
|
@ -64,7 +69,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
ourLog.trace("No narrative generator specified");
|
||||
}
|
||||
|
||||
List<BaseResourceReferenceDt> references = theContext.newTerser().getAllPopulatedChildElementsOfType(next, BaseResourceReferenceDt.class);
|
||||
List<BaseResourceReferenceDt> references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, BaseResourceReferenceDt.class);
|
||||
do {
|
||||
List<IResource> addedResourcesThisPass = new ArrayList<IResource>();
|
||||
|
||||
|
@ -79,7 +84,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
|
||||
IdDt id = nextRes.getId();
|
||||
if (id.hasResourceType() == false) {
|
||||
String resName = theContext.getResourceDefinition(nextRes).getName();
|
||||
String resName = myContext.getResourceDefinition(nextRes).getName();
|
||||
id = id.withResourceType(resName);
|
||||
}
|
||||
|
||||
|
@ -95,7 +100,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
// Linked resources may themselves have linked resources
|
||||
references = new ArrayList<BaseResourceReferenceDt>();
|
||||
for (IResource iResource : addedResourcesThisPass) {
|
||||
List<BaseResourceReferenceDt> newReferences = theContext.newTerser().getAllPopulatedChildElementsOfType(iResource, BaseResourceReferenceDt.class);
|
||||
List<BaseResourceReferenceDt> newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, BaseResourceReferenceDt.class);
|
||||
references.addAll(newReferences);
|
||||
}
|
||||
|
||||
|
@ -103,7 +108,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
|
||||
} while (references.isEmpty() == false);
|
||||
|
||||
myBundle.addResource(next, theContext, theServerBase);
|
||||
myBundle.addResource(next, myContext, theServerBase);
|
||||
|
||||
}
|
||||
|
||||
|
@ -111,8 +116,8 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
* Actually add the resources to the bundle
|
||||
*/
|
||||
for (IResource next : includedResources) {
|
||||
BundleEntry entry = myBundle.addResource(next, theContext, theServerBase);
|
||||
if (theContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) {
|
||||
BundleEntry entry = myBundle.addResource(next, myContext, theServerBase);
|
||||
if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) {
|
||||
if (entry.getSearchMode().isEmpty()) {
|
||||
entry.getSearchMode().setValueAsEnum(BundleEntrySearchModeEnum.INCLUDE);
|
||||
}
|
||||
|
@ -170,7 +175,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
}
|
||||
|
||||
addResourcesToBundle(theServer.getFhirContext(), resourceList, theBundleType, theServerBase);
|
||||
addResourcesToBundle(resourceList, theBundleType, theServerBase);
|
||||
addRootPropertiesToBundle(null, theServerBase, theCompleteUrl, theResult.size(), theBundleType);
|
||||
|
||||
myBundle.setPublished(theResult.getPublished());
|
||||
|
@ -193,7 +198,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) {
|
||||
public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theCompleteUrl, Integer theTotalResults, BundleTypeEnum theBundleType) {
|
||||
if (myBundle.getAuthorName().isEmpty()) {
|
||||
myBundle.getAuthorName().setValue(theAuthor);
|
||||
}
|
||||
|
@ -218,7 +223,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
myBundle.getType().setValueAsString(theBundleType.getCode());
|
||||
}
|
||||
|
||||
if (myBundle.getTotalResults().isEmpty()) {
|
||||
if (myBundle.getTotalResults().isEmpty() && theTotalResults != null) {
|
||||
myBundle.getTotalResults().setValue(theTotalResults);
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +239,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initializeBundleFromResourceList(FhirContext theContext, String theAuthor, List<IResource> theResult, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) {
|
||||
public void initializeBundleFromResourceList(String theAuthor, List<IResource> theResult, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) {
|
||||
myBundle = new Bundle();
|
||||
|
||||
myBundle.getAuthorName().setValue(theAuthor);
|
||||
|
@ -262,8 +267,8 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
}
|
||||
|
||||
if (theContext.getNarrativeGenerator() != null) {
|
||||
String title = theContext.getNarrativeGenerator().generateTitle(next);
|
||||
if (myContext.getNarrativeGenerator() != null) {
|
||||
String title = myContext.getNarrativeGenerator().generateTitle(next);
|
||||
ourLog.trace("Narrative generator created title: {}", title);
|
||||
if (StringUtils.isNotBlank(title)) {
|
||||
ResourceMetadataKeyEnum.TITLE.put(next, title);
|
||||
|
@ -272,7 +277,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
ourLog.trace("No narrative generator specified");
|
||||
}
|
||||
|
||||
List<BaseResourceReferenceDt> references = theContext.newTerser().getAllPopulatedChildElementsOfType(next, BaseResourceReferenceDt.class);
|
||||
List<BaseResourceReferenceDt> references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, BaseResourceReferenceDt.class);
|
||||
do {
|
||||
List<IResource> addedResourcesThisPass = new ArrayList<IResource>();
|
||||
|
||||
|
@ -287,7 +292,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
|
||||
IdDt id = nextRes.getId();
|
||||
if (id.hasResourceType() == false) {
|
||||
String resName = theContext.getResourceDefinition(nextRes).getName();
|
||||
String resName = myContext.getResourceDefinition(nextRes).getName();
|
||||
id = id.withResourceType(resName);
|
||||
}
|
||||
|
||||
|
@ -303,7 +308,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
// Linked resources may themselves have linked resources
|
||||
references = new ArrayList<BaseResourceReferenceDt>();
|
||||
for (IResource iResource : addedResourcesThisPass) {
|
||||
List<BaseResourceReferenceDt> newReferences = theContext.newTerser().getAllPopulatedChildElementsOfType(iResource, BaseResourceReferenceDt.class);
|
||||
List<BaseResourceReferenceDt> newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, BaseResourceReferenceDt.class);
|
||||
references.addAll(newReferences);
|
||||
}
|
||||
|
||||
|
@ -311,7 +316,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
|
||||
} while (references.isEmpty() == false);
|
||||
|
||||
myBundle.addResource(next, theContext, theServerBase);
|
||||
myBundle.addResource(next, myContext, theServerBase);
|
||||
|
||||
}
|
||||
|
||||
|
@ -319,8 +324,8 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
* Actually add the resources to the bundle
|
||||
*/
|
||||
for (IResource next : includedResources) {
|
||||
BundleEntry entry = myBundle.addResource(next, theContext, theServerBase);
|
||||
if (theContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) {
|
||||
BundleEntry entry = myBundle.addResource(next, myContext, theServerBase);
|
||||
if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) {
|
||||
if (entry.getSearchMode().isEmpty()) {
|
||||
entry.getSearchMode().setValueAsEnum(BundleEntrySearchModeEnum.INCLUDE);
|
||||
}
|
||||
|
@ -330,4 +335,15 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
myBundle.getTotalResults().setValue(theTotalResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeWithBundleResource(IResource theResource) {
|
||||
throw new UnsupportedOperationException("DSTU1 server doesn't support resource style bundles");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<IResource> toListOfResources() {
|
||||
return myBundle.toListOfResources();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,16 +4,15 @@ import java.util.List;
|
|||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
|
||||
public interface IVersionSpecificBundleFactory {
|
||||
|
||||
void addResourcesToBundle(FhirContext theContext, List<IResource> theResult, BundleTypeEnum theBundleType, String theServerBase);
|
||||
void addResourcesToBundle(List<IResource> theResult, BundleTypeEnum theBundleType, String theServerBase);
|
||||
|
||||
void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType);
|
||||
void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theCompleteUrl, Integer theTotalResults, BundleTypeEnum theBundleType);
|
||||
|
||||
void initializeBundleFromBundleProvider(RestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint,
|
||||
int theOffset, Integer theLimit, String theSearchId, BundleTypeEnum theBundleType);
|
||||
|
@ -22,6 +21,10 @@ public interface IVersionSpecificBundleFactory {
|
|||
|
||||
IBaseResource getResourceBundle();
|
||||
|
||||
void initializeBundleFromResourceList(FhirContext theContext, String theAuthor, List<IResource> theResult, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType);
|
||||
void initializeBundleFromResourceList(String theAuthor, List<IResource> theResult, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType);
|
||||
|
||||
void initializeWithBundleResource(IResource theResource);
|
||||
|
||||
List<IResource> toListOfResources();
|
||||
|
||||
}
|
||||
|
|
|
@ -448,7 +448,7 @@ public class RestfulServer extends HttpServlet {
|
|||
NarrativeModeEnum narrativeMode = RestfulServerUtils.determineNarrativeMode(theRequest);
|
||||
boolean respondGzip = theRequest.isRespondGzip();
|
||||
|
||||
IVersionSpecificBundleFactory bundleFactory = myFhirContext.getVersion().newBundleFactory();
|
||||
IVersionSpecificBundleFactory bundleFactory = myFhirContext.newBundleFactory();
|
||||
bundleFactory.initializeBundleFromBundleProvider(this, resultList, responseEncoding, theRequest.getFhirServerBase(), theRequest.getCompleteUrl(), prettyPrint, start, count, thePagingAction,
|
||||
null);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
</attributes>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="jst.utility" version="1.0"/>
|
||||
<installed facet="java" version="1.7"/>
|
||||
<installed facet="java" version="1.6"/>
|
||||
</faceted-project>
|
||||
|
|
|
@ -285,6 +285,7 @@ public class ResourceProviderDstu2Test {
|
|||
.forResource(Patient.class)
|
||||
.where(Patient.IDENTIFIER.exactly().systemAndIdentifier("urn:system:rpdstu2","testSearchWithInclude02"))
|
||||
.include(Patient.INCLUDE_MANAGINGORGANIZATION)
|
||||
.prettyPrint()
|
||||
.execute();
|
||||
//@formatter:on
|
||||
|
||||
|
@ -298,7 +299,7 @@ public class ResourceProviderDstu2Test {
|
|||
}
|
||||
|
||||
|
||||
// @Test TODO-reenable
|
||||
@Test
|
||||
public void testCountParam() throws Exception {
|
||||
// NB this does not get used- The paging provider has its own limits built in
|
||||
ourDaoConfig.setHardSearchLimit(100);
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.io.InputStream;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.model.api.IFhirVersion;
|
||||
|
@ -112,8 +113,8 @@ public class FhirDev implements IFhirVersion {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IVersionSpecificBundleFactory newBundleFactory() {
|
||||
return new Dstu1BundleFactory();
|
||||
public IVersionSpecificBundleFactory newBundleFactory(FhirContext theContext) {
|
||||
return new Dstu1BundleFactory(theContext);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
|
|||
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum;
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeChildChoiceDefinition;
|
||||
import ca.uhn.fhir.context.RuntimeChildCompositeDatatypeDefinition;
|
||||
|
@ -387,8 +388,8 @@ public class FhirDstu1 implements IFhirVersion {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IVersionSpecificBundleFactory newBundleFactory() {
|
||||
return new Dstu1BundleFactory();
|
||||
public IVersionSpecificBundleFactory newBundleFactory(FhirContext theContext) {
|
||||
return new Dstu1BundleFactory(theContext);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,16 +12,10 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu.composite.CodeableConceptDt;
|
||||
import ca.uhn.fhir.model.dstu.composite.CodingDt;
|
||||
import ca.uhn.fhir.model.dstu.composite.HumanNameDt;
|
||||
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
|
||||
import ca.uhn.fhir.model.dstu.resource.Composition;
|
||||
|
@ -37,7 +31,6 @@ import ca.uhn.fhir.model.dstu.valueset.NameUseEnum;
|
|||
import ca.uhn.fhir.model.dstu.valueset.PractitionerRoleEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.rest.server.IVersionSpecificBundleFactory;
|
||||
import ca.uhn.fhir.rest.server.RestfulServerUtils;
|
||||
|
||||
/**
|
||||
* Initially contributed by Alexander Kley for bug #29
|
||||
|
@ -201,8 +194,8 @@ public class ContainedResourceEncodingTest {
|
|||
List<IResource> list = new ArrayList<IResource>();
|
||||
list.add(dr);
|
||||
|
||||
IVersionSpecificBundleFactory factory = FhirVersionEnum.DSTU1.getVersionImplementation().newBundleFactory();
|
||||
factory.initializeBundleFromResourceList(ctx, "", list, "http://foo", "http://foo", 2, null);
|
||||
IVersionSpecificBundleFactory factory = ctx.newBundleFactory();
|
||||
factory.initializeBundleFromResourceList("", list, "http://foo", "http://foo", 2, null);
|
||||
Bundle bundle = factory.getDstu1Bundle();
|
||||
|
||||
IParser parser = this.ctx.newXmlParser().setPrettyPrint(true);
|
||||
|
@ -243,8 +236,8 @@ public class ContainedResourceEncodingTest {
|
|||
List<IResource> list = new ArrayList<IResource>();
|
||||
list.add(dr);
|
||||
|
||||
IVersionSpecificBundleFactory factory = FhirVersionEnum.DSTU1.getVersionImplementation().newBundleFactory();
|
||||
factory.initializeBundleFromResourceList(ctx, "", list, "http://foo", "http://foo", 2, null);
|
||||
IVersionSpecificBundleFactory factory = ctx.newBundleFactory();
|
||||
factory.initializeBundleFromResourceList("", list, "http://foo", "http://foo", 2, null);
|
||||
Bundle bundle = factory.getDstu1Bundle();
|
||||
|
||||
IParser parser = this.ctx.newXmlParser().setPrettyPrint(true);
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
package ca.uhn.fhir.rest.server;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -43,7 +38,6 @@ import org.junit.BeforeClass;
|
|||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.BundleEntry;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
@ -113,8 +107,8 @@ public class RestfulServerMethodTest {
|
|||
|
||||
p.getManagingOrganization().setResource(o);
|
||||
|
||||
IVersionSpecificBundleFactory factory = FhirVersionEnum.DSTU1.getVersionImplementation().newBundleFactory();
|
||||
factory.initializeBundleFromResourceList(ourCtx, "", resources, "http://foo", "http://foo", 2, null);
|
||||
IVersionSpecificBundleFactory factory = ourCtx.newBundleFactory();
|
||||
factory.initializeBundleFromResourceList("", resources, "http://foo", "http://foo", 2, null);
|
||||
assertEquals(2, factory.getDstu1Bundle().getEntries().size());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.io.InputStream;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.model.api.IFhirVersion;
|
||||
|
@ -112,8 +113,8 @@ public class FhirDstu2 implements IFhirVersion {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IVersionSpecificBundleFactory newBundleFactory() {
|
||||
return new Dstu2BundleFactory();
|
||||
public IVersionSpecificBundleFactory newBundleFactory(FhirContext theContext) {
|
||||
return new Dstu2BundleFactory(theContext);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.rest.server.provider.dstu2;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
@ -21,6 +21,7 @@ import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
|||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle.Link;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.SearchEntryModeEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
|
@ -40,13 +41,18 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(Dstu2BundleFactory.class);
|
||||
private Bundle myBundle;
|
||||
private FhirContext myContext;
|
||||
|
||||
public Dstu2BundleFactory(FhirContext theContext) {
|
||||
myContext = theContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourcesToBundle(FhirContext theContext, List<IResource> theResult, BundleTypeEnum theBundleType, String theServerBase) {
|
||||
public void addResourcesToBundle(List<IResource> theResult, BundleTypeEnum theBundleType, String theServerBase) {
|
||||
if (myBundle == null) {
|
||||
myBundle = new Bundle();
|
||||
}
|
||||
|
||||
|
||||
List<IResource> includedResources = new ArrayList<IResource>();
|
||||
Set<IdDt> addedResourceIds = new HashSet<IdDt>();
|
||||
|
||||
|
@ -65,8 +71,8 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
}
|
||||
|
||||
if (theContext.getNarrativeGenerator() != null) {
|
||||
String title = theContext.getNarrativeGenerator().generateTitle(next);
|
||||
if (myContext.getNarrativeGenerator() != null) {
|
||||
String title = myContext.getNarrativeGenerator().generateTitle(next);
|
||||
ourLog.trace("Narrative generator created title: {}", title);
|
||||
if (StringUtils.isNotBlank(title)) {
|
||||
ResourceMetadataKeyEnum.TITLE.put(next, title);
|
||||
|
@ -75,7 +81,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
ourLog.trace("No narrative generator specified");
|
||||
}
|
||||
|
||||
List<BaseResourceReferenceDt> references = theContext.newTerser().getAllPopulatedChildElementsOfType(next, BaseResourceReferenceDt.class);
|
||||
List<BaseResourceReferenceDt> references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, BaseResourceReferenceDt.class);
|
||||
do {
|
||||
List<IResource> addedResourcesThisPass = new ArrayList<IResource>();
|
||||
|
||||
|
@ -90,7 +96,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
|
||||
IdDt id = nextRes.getId();
|
||||
if (id.hasResourceType() == false) {
|
||||
String resName = theContext.getResourceDefinition(nextRes).getName();
|
||||
String resName = myContext.getResourceDefinition(nextRes).getName();
|
||||
id = id.withResourceType(resName);
|
||||
}
|
||||
|
||||
|
@ -106,7 +112,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
// Linked resources may themselves have linked resources
|
||||
references = new ArrayList<BaseResourceReferenceDt>();
|
||||
for (IResource iResource : addedResourcesThisPass) {
|
||||
List<BaseResourceReferenceDt> newReferences = theContext.newTerser().getAllPopulatedChildElementsOfType(iResource, BaseResourceReferenceDt.class);
|
||||
List<BaseResourceReferenceDt> newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, BaseResourceReferenceDt.class);
|
||||
references.addAll(newReferences);
|
||||
}
|
||||
|
||||
|
@ -115,7 +121,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
} while (references.isEmpty() == false);
|
||||
|
||||
Entry entry = myBundle.addEntry().setResource(next);
|
||||
|
||||
|
||||
BundleEntrySearchModeEnum searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(next);
|
||||
if (searchMode != null) {
|
||||
entry.getSearch().getModeElement().setValue(searchMode.getCode());
|
||||
|
@ -132,7 +138,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) {
|
||||
public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theCompleteUrl, Integer theTotalResults, BundleTypeEnum theBundleType) {
|
||||
|
||||
if (myBundle.getId().isEmpty()) {
|
||||
myBundle.setId(UUID.randomUUID().toString());
|
||||
|
@ -148,15 +154,15 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
myBundle.addLink().setRelation("self").setUrl(theCompleteUrl);
|
||||
}
|
||||
|
||||
if (!hasLink(Constants.LINK_FHIR_BASE, myBundle) && isNotBlank(theServerBase)) {
|
||||
myBundle.addLink().setRelation(Constants.LINK_FHIR_BASE).setUrl(theServerBase);
|
||||
if (isBlank(myBundle.getBase()) && isNotBlank(theServerBase)) {
|
||||
myBundle.setBase(theServerBase);
|
||||
}
|
||||
|
||||
if (myBundle.getTypeElement().isEmpty() && theBundleType != null) {
|
||||
myBundle.getTypeElement().setValueAsString(theBundleType.getCode());
|
||||
}
|
||||
|
||||
if (myBundle.getTotalElement().isEmpty() && theTotalResults > 0) {
|
||||
if (myBundle.getTotalElement().isEmpty() && theTotalResults != null) {
|
||||
myBundle.getTotalElement().setValue(theTotalResults);
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +176,6 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initializeBundleFromBundleProvider(RestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint, int theOffset, Integer theLimit, String theSearchId, BundleTypeEnum theBundleType) {
|
||||
int numToReturn;
|
||||
|
@ -180,7 +185,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
numToReturn = theResult.size();
|
||||
resourceList = theResult.getResources(0, numToReturn);
|
||||
RestfulServerUtils.validateResourceListNotNull(resourceList);
|
||||
|
||||
|
||||
} else {
|
||||
IPagingProvider pagingProvider = theServer.getPagingProvider();
|
||||
if (theLimit == null) {
|
||||
|
@ -192,7 +197,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
numToReturn = Math.min(numToReturn, theResult.size() - theOffset);
|
||||
resourceList = theResult.getResources(theOffset, numToReturn + theOffset);
|
||||
RestfulServerUtils.validateResourceListNotNull(resourceList);
|
||||
|
||||
|
||||
if (theSearchId != null) {
|
||||
searchId = theSearchId;
|
||||
} else {
|
||||
|
@ -202,7 +207,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (IResource next : resourceList) {
|
||||
if (next.getId() == null || next.getId().isEmpty()) {
|
||||
if (!(next instanceof BaseOperationOutcome)) {
|
||||
|
@ -210,7 +215,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) {
|
||||
for (IResource nextRes : resourceList) {
|
||||
RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(nextRes);
|
||||
|
@ -219,15 +224,15 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
addResourcesToBundle(theServer.getFhirContext(), resourceList, theBundleType, theServerBase);
|
||||
|
||||
addResourcesToBundle(resourceList, theBundleType, theServerBase);
|
||||
addRootPropertiesToBundle(null, theServerBase, theCompleteUrl, theResult.size(), theBundleType);
|
||||
|
||||
|
||||
if (theServer.getPagingProvider() != null) {
|
||||
int limit;
|
||||
limit = theLimit != null ? theLimit : theServer.getPagingProvider().getDefaultPageSize();
|
||||
limit = Math.min(limit, theServer.getPagingProvider().getMaximumPageSize());
|
||||
|
||||
|
||||
if (searchId != null) {
|
||||
if (theOffset + numToReturn < theResult.size()) {
|
||||
myBundle.addLink().setRelation(Constants.LINK_NEXT).setUrl(RestfulServerUtils.createPagingLink(theServerBase, searchId, theOffset + numToReturn, numToReturn, theResponseEncoding, thePrettyPrint));
|
||||
|
@ -250,39 +255,63 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
return myBundle;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initializeBundleFromResourceList(FhirContext theContext, String theAuthor, List<IResource> theResult, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) {
|
||||
public void initializeBundleFromResourceList(String theAuthor, List<IResource> theResources, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) {
|
||||
myBundle = new Bundle();
|
||||
|
||||
|
||||
myBundle.setId(UUID.randomUUID().toString());
|
||||
|
||||
|
||||
ResourceMetadataKeyEnum.PUBLISHED.put(myBundle, InstantDt.withCurrentTime());
|
||||
|
||||
myBundle.addLink().setRelation(Constants.LINK_FHIR_BASE).setUrl(theServerBase);
|
||||
myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theCompleteUrl);
|
||||
myBundle.getTypeElement().setValueAsString(theBundleType.getCode());
|
||||
|
||||
|
||||
if (theBundleType.equals(BundleTypeEnum.TRANSACTION)) {
|
||||
for (IResource next : theResources) {
|
||||
Entry nextEntry = myBundle.addEntry();
|
||||
|
||||
nextEntry.setResource(next);
|
||||
if (next.getId().isEmpty()) {
|
||||
nextEntry.getTransaction().setMethod(HTTPVerbEnum.POST);
|
||||
} else {
|
||||
nextEntry.getTransaction().setMethod(HTTPVerbEnum.PUT);
|
||||
if (next.getId().isAbsolute()) {
|
||||
nextEntry.getTransaction().setUrl(next.getId());
|
||||
} else {
|
||||
String resourceType = myContext.getResourceDefinition(next).getName();
|
||||
nextEntry.getTransaction().setUrl(new IdDt(theServerBase, resourceType, next.getId().getIdPart(), next.getId().getVersionIdPart()).getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addResourcesForSearch(theResources);
|
||||
}
|
||||
|
||||
myBundle.getTotalElement().setValue(theTotalResults);
|
||||
}
|
||||
|
||||
private void addResourcesForSearch(List<IResource> theResult) {
|
||||
List<IResource> includedResources = new ArrayList<IResource>();
|
||||
Set<IdDt> addedResourceIds = new HashSet<IdDt>();
|
||||
|
||||
|
||||
for (IResource next : theResult) {
|
||||
if (next.getId().isEmpty() == false) {
|
||||
addedResourceIds.add(next.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (IResource next : theResult) {
|
||||
|
||||
|
||||
Set<String> containedIds = new HashSet<String>();
|
||||
for (IResource nextContained : next.getContained().getContainedResources()) {
|
||||
if (nextContained.getId().isEmpty() == false) {
|
||||
containedIds.add(nextContained.getId().getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (theContext.getNarrativeGenerator() != null) {
|
||||
String title = theContext.getNarrativeGenerator().generateTitle(next);
|
||||
|
||||
if (myContext.getNarrativeGenerator() != null) {
|
||||
String title = myContext.getNarrativeGenerator().generateTitle(next);
|
||||
ourLog.trace("Narrative generator created title: {}", title);
|
||||
if (StringUtils.isNotBlank(title)) {
|
||||
ResourceMetadataKeyEnum.TITLE.put(next, title);
|
||||
|
@ -290,11 +319,11 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
} else {
|
||||
ourLog.trace("No narrative generator specified");
|
||||
}
|
||||
|
||||
List<BaseResourceReferenceDt> references = theContext.newTerser().getAllPopulatedChildElementsOfType(next, BaseResourceReferenceDt.class);
|
||||
|
||||
List<BaseResourceReferenceDt> references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, BaseResourceReferenceDt.class);
|
||||
do {
|
||||
List<IResource> addedResourcesThisPass = new ArrayList<IResource>();
|
||||
|
||||
|
||||
for (BaseResourceReferenceDt nextRef : references) {
|
||||
IResource nextRes = nextRef.getResource();
|
||||
if (nextRes != null) {
|
||||
|
@ -303,47 +332,67 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
|
|||
// Don't add contained IDs as top level resources
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
IdDt id = nextRes.getId();
|
||||
if (id.hasResourceType() == false) {
|
||||
String resName = theContext.getResourceDefinition(nextRes).getName();
|
||||
String resName = myContext.getResourceDefinition(nextRes).getName();
|
||||
id = id.withResourceType(resName);
|
||||
}
|
||||
|
||||
|
||||
if (!addedResourceIds.contains(id)) {
|
||||
addedResourceIds.add(id);
|
||||
addedResourcesThisPass.add(nextRes);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Linked resources may themselves have linked resources
|
||||
references = new ArrayList<BaseResourceReferenceDt>();
|
||||
for (IResource iResource : addedResourcesThisPass) {
|
||||
List<BaseResourceReferenceDt> newReferences = theContext.newTerser().getAllPopulatedChildElementsOfType(iResource, BaseResourceReferenceDt.class);
|
||||
List<BaseResourceReferenceDt> newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, BaseResourceReferenceDt.class);
|
||||
references.addAll(newReferences);
|
||||
}
|
||||
|
||||
|
||||
includedResources.addAll(addedResourcesThisPass);
|
||||
|
||||
|
||||
} while (references.isEmpty() == false);
|
||||
|
||||
|
||||
myBundle.addEntry().setResource(next);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actually add the resources to the bundle
|
||||
*/
|
||||
for (IResource next : includedResources) {
|
||||
myBundle.addEntry().setResource(next).getSearch().setMode(SearchEntryModeEnum.INCLUDE);
|
||||
}
|
||||
|
||||
myBundle.getTotalElement().setValue(theTotalResults);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void initializeWithBundleResource(IResource theBundle) {
|
||||
myBundle = (Bundle) theBundle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IResource> toListOfResources() {
|
||||
ArrayList<IResource> retVal = new ArrayList<IResource>();
|
||||
for (Entry next : myBundle.getEntry()) {
|
||||
if (next.getResource()!=null) {
|
||||
retVal.add(next.getResource());
|
||||
} else if (next.getTransactionResponse().getLocationElement().isEmpty() == false) {
|
||||
IdDt id = new IdDt(next.getTransactionResponse().getLocation());
|
||||
String resourceType = id.getResourceType();
|
||||
if (isNotBlank(resourceType)) {
|
||||
IResource res = (IResource) myContext.getResourceDefinition(resourceType).newInstance();
|
||||
res.setId(id);
|
||||
retVal.add(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,9 +7,12 @@ import static org.mockito.Mockito.*;
|
|||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.io.input.ReaderInputStream;
|
||||
import org.apache.http.HttpEntityEnclosingRequest;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.ProtocolVersion;
|
||||
import org.apache.http.client.HttpClient;
|
||||
|
@ -27,186 +30,238 @@ import org.mockito.stubbing.Answer;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.rest.server.EncodingEnum;
|
||||
|
||||
public class GenericClientTestDstu2 {
|
||||
private static FhirContext ourCtx;
|
||||
private HttpClient myHttpClient;
|
||||
private HttpResponse myHttpResponse;
|
||||
private static FhirContext ourCtx;
|
||||
private HttpClient myHttpClient;
|
||||
private HttpResponse myHttpResponse;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
ourCtx = FhirContext.forDstu2();
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
ourCtx = FhirContext.forDstu2();
|
||||
}
|
||||
@Before
|
||||
public void before() {
|
||||
myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs());
|
||||
ourCtx.getRestfulClientFactory().setHttpClient(myHttpClient);
|
||||
ourCtx.getRestfulClientFactory().setServerValidationModeEnum(ServerValidationModeEnum.NEVER);
|
||||
myHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchByString() throws Exception {
|
||||
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs());
|
||||
ourCtx.getRestfulClientFactory().setHttpClient(myHttpClient);
|
||||
ourCtx.getRestfulClientFactory().setServerValidationModeEnum(ServerValidationModeEnum.NEVER);
|
||||
myHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs());
|
||||
}
|
||||
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
|
||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
|
||||
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8"));
|
||||
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
|
||||
|
||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||
|
||||
@Test
|
||||
public void testSearchByString() throws Exception {
|
||||
String msg = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
|
||||
|
||||
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
|
||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
|
||||
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8"));
|
||||
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
|
||||
|
||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||
|
||||
//@formatter:off
|
||||
//@formatter:off
|
||||
Bundle response = client.search()
|
||||
.forResource("Patient")
|
||||
.where(Patient.NAME.matches().value("james"))
|
||||
.execute();
|
||||
//@formatter:on
|
||||
|
||||
assertEquals("http://example.com/fhir/Patient?name=james", capt.getValue().getURI().toString());
|
||||
assertEquals(Patient.class, response.getEntries().get(0).getResource().getClass());
|
||||
assertEquals("http://example.com/fhir/Patient?name=james", capt.getValue().getURI().toString());
|
||||
assertEquals(Patient.class, response.getEntries().get(0).getResource().getClass());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteConditional() throws Exception {
|
||||
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
|
||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_204_NO_CONTENT, ""));
|
||||
// when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
|
||||
when(myHttpResponse.getEntity().getContent()).then(new Answer<ReaderInputStream>() {
|
||||
@Override
|
||||
public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable {
|
||||
return new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"));
|
||||
}
|
||||
});
|
||||
@Test
|
||||
public void testTransactionWithListOfResources() throws Exception {
|
||||
|
||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||
ca.uhn.fhir.model.dstu2.resource.Bundle resp = new ca.uhn.fhir.model.dstu2.resource.Bundle();
|
||||
resp.addEntry().getTransactionResponse().setLocation("Patient/1/_history/1");
|
||||
resp.addEntry().getTransactionResponse().setLocation("Patient/2/_history/2");
|
||||
String respString = ourCtx.newJsonParser().encodeResourceToString(resp);
|
||||
|
||||
int idx = 0;
|
||||
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
|
||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
|
||||
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8"));
|
||||
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8")));
|
||||
|
||||
client.delete().resourceById(new IdDt("Patient/123")).execute();
|
||||
assertEquals("DELETE", capt.getAllValues().get(idx).getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient/123", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||
|
||||
client.delete().resourceConditionalByUrl("Patient?name=foo").execute();
|
||||
assertEquals("DELETE", capt.getAllValues().get(idx).getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
List<IResource> input = new ArrayList<IResource>();
|
||||
|
||||
client.delete().resourceConditionalByType("Patient").where(Patient.NAME.matches().value("foo")).execute();
|
||||
assertEquals("DELETE", capt.getAllValues().get(idx).getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
Patient p1 = new Patient(); // No ID
|
||||
p1.addName().addFamily("PATIENT1");
|
||||
input.add(p1);
|
||||
|
||||
}
|
||||
Patient p2 = new Patient(); // Yes ID
|
||||
p2.addName().addFamily("PATIENT2");
|
||||
p2.setId("Patient/2");
|
||||
input.add(p2);
|
||||
|
||||
@Test
|
||||
public void testCreateConditional() throws Exception {
|
||||
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
|
||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_204_NO_CONTENT, ""));
|
||||
when(myHttpResponse.getEntity().getContent()).then(new Answer<ReaderInputStream>() {
|
||||
@Override
|
||||
public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable {
|
||||
return new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"));
|
||||
}
|
||||
});
|
||||
//@formatter:off
|
||||
List<IResource> response = client.transaction()
|
||||
.withResources(input)
|
||||
.encodedJson()
|
||||
.execute();
|
||||
//@formatter:on
|
||||
|
||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||
assertEquals("http://example.com/fhir?_format=json", capt.getValue().getURI().toString());
|
||||
assertEquals(2, response.size());
|
||||
|
||||
int idx = 0;
|
||||
String requestString = IOUtils.toString(((HttpEntityEnclosingRequest) capt.getValue()).getEntity().getContent());
|
||||
ca.uhn.fhir.model.dstu2.resource.Bundle requestBundle = ourCtx.newJsonParser().parseResource(ca.uhn.fhir.model.dstu2.resource.Bundle.class, requestString);
|
||||
assertEquals(2, requestBundle.getEntry().size());
|
||||
assertEquals("POST", requestBundle.getEntry().get(0).getTransaction().getMethod());
|
||||
assertEquals("PUT", requestBundle.getEntry().get(1).getTransaction().getMethod());
|
||||
assertEquals("Patient/2", requestBundle.getEntry().get(1).getTransaction().getUrl());
|
||||
|
||||
p1 = (Patient) response.get(0);
|
||||
assertEquals(new IdDt("Patient/1/_history/1"), p1.getId().toUnqualified());
|
||||
// assertEquals("PATIENT1", p1.getName().get(0).getFamily().get(0).getValue());
|
||||
|
||||
Patient p = new Patient();
|
||||
p.addName().addFamily("FOOFAMILY");
|
||||
p2 = (Patient) response.get(1);
|
||||
assertEquals(new IdDt("Patient/2/_history/2"), p2.getId().toUnqualified());
|
||||
// assertEquals("PATIENT2", p2.getName().get(0).getFamily().get(0).getValue());
|
||||
}
|
||||
|
||||
client.create().resource(p).conditionalByUrl("Patient?name=foo").execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(idx).getURI().toString());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_IF_NONE_EXIST).getValue());
|
||||
assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
idx++;
|
||||
@Test
|
||||
public void testDeleteConditional() throws Exception {
|
||||
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
|
||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_204_NO_CONTENT, ""));
|
||||
// when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type",
|
||||
// Constants.CT_TEXT + "; charset=UTF-8"));
|
||||
when(myHttpResponse.getEntity().getContent()).then(new Answer<ReaderInputStream>() {
|
||||
@Override
|
||||
public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable {
|
||||
return new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"));
|
||||
}
|
||||
});
|
||||
|
||||
client.create().resource(p).conditional().where(Patient.NAME.matches().value("foo")).execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(idx).getURI().toString());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_IF_NONE_EXIST).getValue());
|
||||
assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
idx++;
|
||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||
|
||||
}
|
||||
int idx = 0;
|
||||
|
||||
client.delete().resourceById(new IdDt("Patient/123")).execute();
|
||||
assertEquals("DELETE", capt.getAllValues().get(idx).getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient/123", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
|
||||
@Test
|
||||
public void testUpdateConditional() throws Exception {
|
||||
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
|
||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_204_NO_CONTENT, ""));
|
||||
when(myHttpResponse.getEntity().getContent()).then(new Answer<ReaderInputStream>() {
|
||||
@Override
|
||||
public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable {
|
||||
return new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"));
|
||||
}
|
||||
});
|
||||
client.delete().resourceConditionalByUrl("Patient?name=foo").execute();
|
||||
assertEquals("DELETE", capt.getAllValues().get(idx).getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
|
||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||
client.delete().resourceConditionalByType("Patient").where(Patient.NAME.matches().value("foo")).execute();
|
||||
assertEquals("DELETE", capt.getAllValues().get(idx).getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
|
||||
int idx = 0;
|
||||
}
|
||||
|
||||
Patient p = new Patient();
|
||||
p.addName().addFamily("FOOFAMILY");
|
||||
@Test
|
||||
public void testCreateConditional() throws Exception {
|
||||
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
|
||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_204_NO_CONTENT, ""));
|
||||
when(myHttpResponse.getEntity().getContent()).then(new Answer<ReaderInputStream>() {
|
||||
@Override
|
||||
public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable {
|
||||
return new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"));
|
||||
}
|
||||
});
|
||||
|
||||
client.update().resource(p).conditionalByUrl("Patient?name=foo").execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||
|
||||
client.update().resource(ourCtx.newXmlParser().encodeResourceToString(p)).conditionalByUrl("Patient?name=foo").execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
int idx = 0;
|
||||
|
||||
client.update().resource(p).conditional().where(Patient.NAME.matches().value("foo")).and(Patient.ADDRESS.matches().value("AAA|BBB")).execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo&address=AAA%5C%7CBBB", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
Patient p = new Patient();
|
||||
p.addName().addFamily("FOOFAMILY");
|
||||
|
||||
client.update().resource(ourCtx.newXmlParser().encodeResourceToString(p)).conditional().where(Patient.NAME.matches().value("foo")).and(Patient.ADDRESS.matches().value("AAA|BBB")).execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo&address=AAA%5C%7CBBB", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
client.create().resource(p).conditionalByUrl("Patient?name=foo").execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(idx).getURI().toString());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_IF_NONE_EXIST).getValue());
|
||||
assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
idx++;
|
||||
|
||||
}
|
||||
client.create().resource(p).conditional().where(Patient.NAME.matches().value("foo")).execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(idx).getURI().toString());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_IF_NONE_EXIST).getValue());
|
||||
assertEquals("POST", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
idx++;
|
||||
|
||||
private String extractBody(ArgumentCaptor<HttpUriRequest> capt, int count) throws IOException {
|
||||
String body = IOUtils.toString(((HttpEntityEnclosingRequestBase) capt.getAllValues().get(count)).getEntity().getContent(), "UTF-8");
|
||||
return body;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateConditional() throws Exception {
|
||||
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
|
||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_204_NO_CONTENT, ""));
|
||||
when(myHttpResponse.getEntity().getContent()).then(new Answer<ReaderInputStream>() {
|
||||
@Override
|
||||
public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable {
|
||||
return new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"));
|
||||
}
|
||||
});
|
||||
|
||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||
|
||||
int idx = 0;
|
||||
|
||||
Patient p = new Patient();
|
||||
p.addName().addFamily("FOOFAMILY");
|
||||
|
||||
client.update().resource(p).conditionalByUrl("Patient?name=foo").execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
|
||||
client.update().resource(ourCtx.newXmlParser().encodeResourceToString(p)).conditionalByUrl("Patient?name=foo").execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
|
||||
client.update().resource(p).conditional().where(Patient.NAME.matches().value("foo")).and(Patient.ADDRESS.matches().value("AAA|BBB")).execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo&address=AAA%5C%7CBBB", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
|
||||
client.update().resource(ourCtx.newXmlParser().encodeResourceToString(p)).conditional().where(Patient.NAME.matches().value("foo")).and(Patient.ADDRESS.matches().value("AAA|BBB")).execute();
|
||||
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_CONTENT_TYPE).length);
|
||||
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(idx).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
|
||||
assertThat(extractBody(capt, idx), containsString("<family value=\"FOOFAMILY\"/>"));
|
||||
assertEquals("PUT", capt.getAllValues().get(idx).getRequestLine().getMethod());
|
||||
assertEquals("http://example.com/fhir/Patient?name=foo&address=AAA%5C%7CBBB", capt.getAllValues().get(idx).getURI().toString());
|
||||
idx++;
|
||||
|
||||
}
|
||||
|
||||
private String extractBody(ArgumentCaptor<HttpUriRequest> capt, int count) throws IOException {
|
||||
String body = IOUtils.toString(((HttpEntityEnclosingRequestBase) capt.getAllValues().get(count)).getEntity().getContent(), "UTF-8");
|
||||
return body;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ca.uhn.fhir.rest.server;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -42,7 +43,19 @@ public class SearchWithDstu2BundleTest {
|
|||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
ourLog.info(responseContent);
|
||||
|
||||
|
||||
//@formatter:off
|
||||
assertThat(responseContent, stringContainsInOrder("<Bundle xmlns=\"http://hl7.org/fhir\">",
|
||||
"<type value=\"searchset\"/>",
|
||||
"<base value=\"http://localhost:" + ourPort + "\"/>" ,
|
||||
"<link>" ,
|
||||
"<relation value=\"self\"/>",
|
||||
"<url value=\"http://localhost:" + ourPort + "/Patient?_format=xml&_pretty=true\"/>",
|
||||
"</link>" ,
|
||||
"<entry>" ,
|
||||
"<resource>" ,
|
||||
"<Patient xmlns=\"http://hl7.org/fhir\">"));
|
||||
// @formatter:off
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.hl7.fhir.instance.model.Profile;
|
|||
import org.hl7.fhir.instance.model.Reference;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.model.api.IFhirVersion;
|
||||
|
@ -107,7 +108,7 @@ public class FhirDstu2Hl7Org implements IFhirVersion {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IVersionSpecificBundleFactory newBundleFactory() {
|
||||
public IVersionSpecificBundleFactory newBundleFactory(FhirContext theContext) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.hl7.fhir.instance.model.IBaseResource;
|
|||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.model.api.IFhirVersion;
|
||||
|
@ -117,7 +118,7 @@ public class FhirDev implements IFhirVersion {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IVersionSpecificBundleFactory newBundleFactory() {
|
||||
public IVersionSpecificBundleFactory newBundleFactory(FhirContext theContext) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
|
|||
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum;
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeChildChoiceDefinition;
|
||||
import ca.uhn.fhir.context.RuntimeChildCompositeDatatypeDefinition;
|
||||
|
@ -386,7 +387,7 @@ public class FhirDstu1 implements IFhirVersion {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IVersionSpecificBundleFactory newBundleFactory() {
|
||||
public IVersionSpecificBundleFactory newBundleFactory(FhirContext theContext) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.io.InputStream;
|
|||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.model.api.IFhirVersion;
|
||||
|
@ -103,7 +104,7 @@ public class FhirDstu2 implements IFhirVersion {
|
|||
|
||||
|
||||
@Override
|
||||
public IVersionSpecificBundleFactory newBundleFactory() {
|
||||
public IVersionSpecificBundleFactory newBundleFactory(FhirContext theContext) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue