This commit is contained in:
Jens Kristian Villadsen 2016-11-15 13:42:07 +01:00
commit f710094c93
60 changed files with 3455 additions and 2245 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -18,37 +18,37 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client-okhttp</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jaxrsserver-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
@ -59,7 +59,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jaxrsserver-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -29,7 +29,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
@ -40,25 +40,25 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client-okhttp</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -41,7 +41,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>
@ -56,7 +56,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>
@ -67,7 +67,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -59,7 +59,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>
@ -74,7 +74,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>
@ -85,7 +85,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -24,38 +24,15 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.instance.model.api.IBaseConformance;
import org.hl7.fhir.instance.model.api.IBaseDatatype;
import org.hl7.fhir.instance.model.api.IBaseMetaType;
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
import org.hl7.fhir.instance.model.api.IBaseParameters;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.instance.model.api.*;
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.IRuntimeDatatypeDefinition;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.*;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.api.Include;
@ -68,82 +45,13 @@ import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.model.primitive.UriDt;
import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.PatchTypeEnum;
import ca.uhn.fhir.rest.api.PreferReturnEnum;
import ca.uhn.fhir.rest.api.SortOrderEnum;
import ca.uhn.fhir.rest.api.SortSpec;
import ca.uhn.fhir.rest.api.SummaryEnum;
import ca.uhn.fhir.rest.api.*;
import ca.uhn.fhir.rest.client.api.IHttpClient;
import ca.uhn.fhir.rest.client.api.IHttpRequest;
import ca.uhn.fhir.rest.client.exceptions.NonFhirResponseException;
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.gclient.IClientExecutable;
import ca.uhn.fhir.rest.gclient.ICreate;
import ca.uhn.fhir.rest.gclient.ICreateTyped;
import ca.uhn.fhir.rest.gclient.ICreateWithQuery;
import ca.uhn.fhir.rest.gclient.ICreateWithQueryTyped;
import ca.uhn.fhir.rest.gclient.ICriterion;
import ca.uhn.fhir.rest.gclient.ICriterionInternal;
import ca.uhn.fhir.rest.gclient.IDelete;
import ca.uhn.fhir.rest.gclient.IDeleteTyped;
import ca.uhn.fhir.rest.gclient.IDeleteWithQuery;
import ca.uhn.fhir.rest.gclient.IDeleteWithQueryTyped;
import ca.uhn.fhir.rest.gclient.IFetchConformanceTyped;
import ca.uhn.fhir.rest.gclient.IFetchConformanceUntyped;
import ca.uhn.fhir.rest.gclient.IGetPage;
import ca.uhn.fhir.rest.gclient.IGetPageTyped;
import ca.uhn.fhir.rest.gclient.IGetPageUntyped;
import ca.uhn.fhir.rest.gclient.IGetTags;
import ca.uhn.fhir.rest.gclient.IHistory;
import ca.uhn.fhir.rest.gclient.IHistoryTyped;
import ca.uhn.fhir.rest.gclient.IHistoryUntyped;
import ca.uhn.fhir.rest.gclient.IMeta;
import ca.uhn.fhir.rest.gclient.IMetaAddOrDeleteSourced;
import ca.uhn.fhir.rest.gclient.IMetaAddOrDeleteUnsourced;
import ca.uhn.fhir.rest.gclient.IMetaGetUnsourced;
import ca.uhn.fhir.rest.gclient.IOperation;
import ca.uhn.fhir.rest.gclient.IOperationUnnamed;
import ca.uhn.fhir.rest.gclient.IOperationUntyped;
import ca.uhn.fhir.rest.gclient.IOperationUntypedWithInput;
import ca.uhn.fhir.rest.gclient.IOperationUntypedWithInputAndPartialOutput;
import ca.uhn.fhir.rest.gclient.IParam;
import ca.uhn.fhir.rest.gclient.IPatch;
import ca.uhn.fhir.rest.gclient.IPatchExecutable;
import ca.uhn.fhir.rest.gclient.IPatchTyped;
import ca.uhn.fhir.rest.gclient.IPatchWithQuery;
import ca.uhn.fhir.rest.gclient.IPatchWithQueryTyped;
import ca.uhn.fhir.rest.gclient.IQuery;
import ca.uhn.fhir.rest.gclient.IRead;
import ca.uhn.fhir.rest.gclient.IReadExecutable;
import ca.uhn.fhir.rest.gclient.IReadIfNoneMatch;
import ca.uhn.fhir.rest.gclient.IReadTyped;
import ca.uhn.fhir.rest.gclient.ISort;
import ca.uhn.fhir.rest.gclient.ITransaction;
import ca.uhn.fhir.rest.gclient.ITransactionTyped;
import ca.uhn.fhir.rest.gclient.IUntypedQuery;
import ca.uhn.fhir.rest.gclient.IUpdate;
import ca.uhn.fhir.rest.gclient.IUpdateExecutable;
import ca.uhn.fhir.rest.gclient.IUpdateTyped;
import ca.uhn.fhir.rest.gclient.IUpdateWithQuery;
import ca.uhn.fhir.rest.gclient.IUpdateWithQueryTyped;
import ca.uhn.fhir.rest.gclient.IValidate;
import ca.uhn.fhir.rest.gclient.IValidateUntyped;
import ca.uhn.fhir.rest.method.DeleteMethodBinding;
import ca.uhn.fhir.rest.method.HistoryMethodBinding;
import ca.uhn.fhir.rest.method.HttpDeleteClientInvocation;
import ca.uhn.fhir.rest.method.HttpGetClientInvocation;
import ca.uhn.fhir.rest.method.HttpSimpleGetClientInvocation;
import ca.uhn.fhir.rest.method.IClientResponseHandler;
import ca.uhn.fhir.rest.method.MethodUtil;
import ca.uhn.fhir.rest.method.OperationMethodBinding;
import ca.uhn.fhir.rest.method.ReadMethodBinding;
import ca.uhn.fhir.rest.method.SearchMethodBinding;
import ca.uhn.fhir.rest.method.SearchStyleEnum;
import ca.uhn.fhir.rest.method.SortParameter;
import ca.uhn.fhir.rest.method.TransactionMethodBinding;
import ca.uhn.fhir.rest.method.ValidateMethodBindingDstu1;
import ca.uhn.fhir.rest.method.ValidateMethodBindingDstu2Plus;
import ca.uhn.fhir.rest.gclient.*;
import ca.uhn.fhir.rest.method.*;
import ca.uhn.fhir.rest.param.DateParam;
import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.TokenParam;
@ -532,26 +440,6 @@ public class GenericClient extends BaseClient implements IGenericClient {
return new PatchInternal();
}
@Override
public MethodOutcome patch(IdDt theIdDt, IBaseResource theResource) {
BaseHttpClientInvocation invocation = MethodUtil.createUpdateInvocation(theResource, null, theIdDt, myContext);
if (isKeepResponses()) {
myLastRequest = invocation.asHttpRequest(getServerBase(), createExtraParams(), getEncoding(), isPrettyPrint());
}
RuntimeResourceDefinition def = myContext.getResourceDefinition(theResource);
final String resourceName = def.getName();
OutcomeResponseHandler binding = new OutcomeResponseHandler(resourceName);
MethodOutcome resp = invokeClient(myContext, binding, invocation, myLogRequestAndResponse);
return resp;
}
@Override
public MethodOutcome patch(String theId, IBaseResource theResource) {
return update(new IdDt(theId), theResource);
}
@Override
public IUpdate update() {
return new UpdateInternal();
@ -1900,7 +1788,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
private List<Include> myInclude = new ArrayList<Include>();
private DateRangeParam myLastUpdated;
private Integer myParamLimit;
private List<String> myProfile = new ArrayList<String>();
private List<Collection<String>> myProfiles = new ArrayList<Collection<String>>();
private String myResourceId;
private String myResourceName;
private Class<? extends IBaseResource> myResourceType;
@ -1981,8 +1869,15 @@ public class GenericClient extends BaseClient implements IGenericClient {
addParam(params, Constants.PARAM_SECURITY, next.getValueAsQueryToken(myContext));
}
for (String next : myProfile) {
addParam(params, Constants.PARAM_PROFILE, next);
for (Collection<String> profileUris : myProfiles) {
StringBuilder builder = new StringBuilder();
for (Iterator<String> profileItr = profileUris.iterator(); profileItr.hasNext();) {
builder.append(profileItr.next());
if (profileItr.hasNext()) {
builder.append(',');
}
}
addParam(params, Constants.PARAM_PROFILE, builder.toString());
}
for (Include next : myInclude) {
@ -2144,7 +2039,14 @@ public class GenericClient extends BaseClient implements IGenericClient {
@Override
public IQuery<Object> withProfile(String theProfileUri) {
Validate.notBlank(theProfileUri, "theProfileUri must not be null or empty");
myProfile.add(theProfileUri);
myProfiles.add(Collections.singletonList(theProfileUri));
return this;
}
@Override
public IQuery<Object> withAnyProfile(Collection<String> theProfileUris) {
Validate.notEmpty(theProfileUris, "theProfileUris must not be null or empty");
myProfiles.add(theProfileUris);
return this;
}
@ -2342,16 +2244,15 @@ public class GenericClient extends BaseClient implements IGenericClient {
}
private class PatchInternal extends BaseClientExecutable<IPatchExecutable, MethodOutcome> implements IPatch, IPatchTyped, IPatchExecutable, IPatchWithQuery, IPatchWithQueryTyped {
private class PatchInternal extends BaseClientExecutable<IPatchExecutable, MethodOutcome> implements IPatch, IPatchWithBody, IPatchExecutable, IPatchWithQuery, IPatchWithQueryTyped {
private CriterionList myCriterionList;
private IIdType myId;
private PreferReturnEnum myPrefer;
private IBaseResource myResource;
private String myResourceBody;
private String mySearchUrl;
private PatchTypeEnum myPatchType;
private String myPatchBody;
private String mySearchUrl;
private String myResourceType;
@Override
public IPatchWithQueryTyped and(ICriterion<?> theCriterion) {
@ -2360,27 +2261,22 @@ public class GenericClient extends BaseClient implements IGenericClient {
}
@Override
public IPatchWithQuery conditional() {
public IPatchWithQuery conditional(String theResourceType) {
Validate.notBlank(theResourceType, "theResourceType must not be null");
myResourceType = theResourceType;
myCriterionList = new CriterionList();
return this;
}
// TODO: This is not longer used.. Deprecate it or just remove it?
@Override
public IPatchTyped conditionalByUrl(String theSearchUrl) {
public IPatchWithBody conditionalByUrl(String theSearchUrl) {
mySearchUrl = validateAndEscapeConditionalUrl(theSearchUrl);
return this;
}
@Override
public MethodOutcome execute() {
if (myResource == null) {
myResource = parseResourceBody(myResourceBody);
}
// If an explicit encoding is chosen, we will re-serialize to ensure the right encoding
if (getParamEncoding() != null) {
myResourceBody = null;
}
if (myPatchType == null) {
throw new InvalidRequestException("No patch type supplied, cannot invoke server");
@ -2389,21 +2285,21 @@ public class GenericClient extends BaseClient implements IGenericClient {
throw new InvalidRequestException("No patch body supplied, cannot invoke server");
}
if (myId == null) {
myId = myResource.getIdElement();
BaseHttpClientInvocation invocation;
if (isNotBlank(mySearchUrl)) {
invocation = MethodUtil.createPatchInvocation(myContext, mySearchUrl, myPatchType, myPatchBody);
} else if (myCriterionList != null) {
invocation = MethodUtil.createPatchInvocation(myContext, myPatchType, myPatchBody, myResourceType, myCriterionList.toParamList());
} else {
if (myId == null || myId.hasIdPart() == false) {
throw new InvalidRequestException("No ID supplied for resource to patch, can not invoke server");
}
invocation = MethodUtil.createPatchInvocation(myContext, myId, myPatchType, myPatchBody);
}
if (myId == null || myId.hasIdPart() == false) {
throw new InvalidRequestException("No ID supplied for resource to update, can not invoke server");
}
BaseHttpClientInvocation invocation = MethodUtil.createPatchInvocation(myContext, myId, myPatchType, myPatchBody);
addPreferHeader(myPrefer, invocation);
RuntimeResourceDefinition def = myContext.getResourceDefinition(myResource);
final String resourceName = def.getName();
OutcomeResponseHandler binding = new OutcomeResponseHandler(resourceName, myPrefer);
OutcomeResponseHandler binding = new OutcomeResponseHandler(null, myPrefer);
Map<String, List<String>> params = new HashMap<String, List<String>>();
return invoke(params, binding, invocation);
@ -2416,19 +2312,6 @@ public class GenericClient extends BaseClient implements IGenericClient {
return this;
}
@Override
public IPatchTyped resource(IBaseResource theResource) {
Validate.notNull(theResource, "Resource can not be null");
myResource = theResource;
return this;
}
@Override
public IPatchTyped resource(String theResourceBody) {
Validate.notBlank(theResourceBody, "Body can not be null or blank");
myResourceBody = theResourceBody;
return this;
}
@Override
public IPatchWithQueryTyped where(ICriterion<?> theCriterion) {
@ -2461,15 +2344,28 @@ public class GenericClient extends BaseClient implements IGenericClient {
}
@Override
public IPatchTyped patchType(PatchTypeEnum patchType) {
myPatchType = patchType;
public IPatchWithBody withBody(String thePatchBody) {
Validate.notBlank(thePatchBody, "thePatchBody must not be blank");
myPatchBody = thePatchBody;
EncodingEnum encoding = MethodUtil.detectEncodingNoDefault(thePatchBody);
if (encoding == EncodingEnum.XML) {
myPatchType = PatchTypeEnum.XML_PATCH;
} else if (encoding == EncodingEnum.JSON) {
myPatchType = PatchTypeEnum.JSON_PATCH;
} else {
throw new IllegalArgumentException("Unable to determine encoding of patch");
}
return this;
}
@Override
public IPatchTyped patchBody(String patchBody) {
myPatchBody = patchBody;
return this;
public IPatchWithQuery conditional(Class<? extends IBaseResource> theClass) {
Validate.notNull(theClass, "theClass must not be null");
String resourceType = myContext.getResourceDefinition(theClass).getName();
return conditional(resourceType);
}
}

View File

@ -29,7 +29,6 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.resource.BaseConformance;
import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.UriDt;
@ -38,20 +37,7 @@ import ca.uhn.fhir.rest.client.api.IRestfulClient;
import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException;
import ca.uhn.fhir.rest.client.exceptions.FhirClientInappropriateForServerException;
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.gclient.ICreate;
import ca.uhn.fhir.rest.gclient.IDelete;
import ca.uhn.fhir.rest.gclient.IFetchConformanceUntyped;
import ca.uhn.fhir.rest.gclient.IGetPage;
import ca.uhn.fhir.rest.gclient.IGetTags;
import ca.uhn.fhir.rest.gclient.IHistory;
import ca.uhn.fhir.rest.gclient.IMeta;
import ca.uhn.fhir.rest.gclient.IOperation;
import ca.uhn.fhir.rest.gclient.IPatch;
import ca.uhn.fhir.rest.gclient.IRead;
import ca.uhn.fhir.rest.gclient.ITransaction;
import ca.uhn.fhir.rest.gclient.IUntypedQuery;
import ca.uhn.fhir.rest.gclient.IUpdate;
import ca.uhn.fhir.rest.gclient.IValidate;
import ca.uhn.fhir.rest.gclient.*;
public interface IGenericClient extends IRestfulClient {
@ -254,35 +240,11 @@ public interface IGenericClient extends IRestfulClient {
@Override
void registerInterceptor(IClientInterceptor theInterceptor);
/**
* Fluent method for the "patch" operation, which performs a logical patch on a server resource
*/
IPatch patch();
/**
* Implementation of the "instance patch" method.
*
* @param theId
* The ID to update
* @param theResource
* The new resource body
* @return An outcome containing the results and possibly the new version ID
*/
MethodOutcome patch(IdDt theId, IBaseResource theResource);
/**
* Implementation of the "instance update" method.
*
* @param theId
* The ID to update
* @param theResource
* The new resource body
* @return An outcome containing the results and possibly the new version ID
*/
MethodOutcome patch(String theId, IBaseResource theResource);
/**
* Search for resources matching a given set of criteria. Searching is a very powerful
* feature in FHIR with many features for specifying exactly what should be seaerched for

View File

@ -27,6 +27,7 @@ import java.util.Date;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.rest.gclient.DateClientParam.IDateSpecifier;
import ca.uhn.fhir.rest.param.ParamPrefixEnum;
/**
@ -65,10 +66,11 @@ public class DateClientParam extends BaseClientParam implements IParam {
return new DateWithPrefix(ParamPrefixEnum.EQUAL);
}
private class Criterion implements ICriterion<DateClientParam>, ICriterionInternal {
private class Criterion implements IDateCriterion, ICriterionInternal {
private String myValue;
private ParamPrefixEnum myPrefix;
private Criterion orCriterion;
public Criterion(ParamPrefixEnum thePrefix, String theValue) {
myPrefix = thePrefix;
@ -83,7 +85,16 @@ public class DateClientParam extends BaseClientParam implements IParam {
@Override
public String getParameterValue(FhirContext theContext) {
StringBuilder b = new StringBuilder();
if (orCriterion != null) {
String orValue = orCriterion.getParameterValue(theContext);
if (isNotBlank(orValue)) {
b.append(orValue);
}
}
if (isNotBlank(myValue)) {
if (b.length() > 0) {
b.append(',');
}
if (myPrefix != null && myPrefix != ParamPrefixEnum.EQUAL) {
b.append(myPrefix.getValueForContext(theContext));
}
@ -92,69 +103,115 @@ public class DateClientParam extends BaseClientParam implements IParam {
return b.toString();
}
@Override
public IDateSpecifier orAfter() {
return new DateWithPrefix(ParamPrefixEnum.GREATERTHAN, this);
}
@Override
public IDateSpecifier orAfterOrEquals() {
return new DateWithPrefix(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, this);
}
@Override
public IDateSpecifier orBefore() {
return new DateWithPrefix(ParamPrefixEnum.LESSTHAN, this);
}
@Override
public IDateSpecifier orBeforeOrEquals() {
return new DateWithPrefix(ParamPrefixEnum.LESSTHAN_OR_EQUALS, this);
}
@Override
public IDateSpecifier orExactly() {
return new DateWithPrefix(ParamPrefixEnum.EQUAL, this);
}
}
private class DateWithPrefix implements IDateSpecifier {
private ParamPrefixEnum myPrefix;
private Criterion previous = null;
public DateWithPrefix(ParamPrefixEnum thePrefix, Criterion previous) {
myPrefix = thePrefix;
this.previous = previous;
}
public DateWithPrefix(ParamPrefixEnum thePrefix) {
myPrefix = thePrefix;
}
@Override
public ICriterion<DateClientParam> day(Date theValue) {
public IDateCriterion day(Date theValue) {
DateTimeDt dt = new DateTimeDt(theValue);
dt.setPrecision(TemporalPrecisionEnum.DAY);
String valueAsString = dt.getValueAsString();
return new Criterion(myPrefix, valueAsString);
return constructCriterion(dt);
}
@Override
public ICriterion<DateClientParam> day(String theValue) {
public IDateCriterion day(String theValue) {
DateTimeDt dt = new DateTimeDt(theValue);
dt.setPrecision(TemporalPrecisionEnum.DAY);
String valueAsString = dt.getValueAsString();
return new Criterion(myPrefix , valueAsString);
return constructCriterion(dt);
}
@Override
public ICriterion<DateClientParam> now() {
public IDateCriterion now() {
DateTimeDt dt = DateTimeDt.withCurrentTime();
dt.setPrecision(TemporalPrecisionEnum.SECOND);
String valueAsString = dt.getValueAsString();
return new Criterion(myPrefix , valueAsString);
return constructCriterion(dt);
}
@Override
public ICriterion<DateClientParam> second(Date theValue) {
public IDateCriterion second(Date theValue) {
DateTimeDt dt = new DateTimeDt(theValue);
dt.setPrecision(TemporalPrecisionEnum.SECOND);
String valueAsString = dt.getValueAsString();
return new Criterion(myPrefix , valueAsString);
return constructCriterion(dt);
}
@Override
public ICriterion<DateClientParam> second(String theValue) {
public IDateCriterion second(String theValue) {
DateTimeDt dt = new DateTimeDt(theValue);
dt.setPrecision(TemporalPrecisionEnum.SECOND);
String valueAsString = dt.getValueAsString();
return new Criterion(myPrefix , valueAsString);
return constructCriterion(dt);
}
private IDateCriterion constructCriterion(DateTimeDt dt) {
String valueAsString = dt.getValueAsString();
Criterion criterion = new Criterion(myPrefix, valueAsString);
if (previous != null) {
criterion.orCriterion = previous;
}
return criterion;
}
}
public interface IDateSpecifier {
ICriterion<DateClientParam> day(Date theValue);
IDateCriterion day(Date theValue);
ICriterion<DateClientParam> day(String theValue);
IDateCriterion day(String theValue);
ICriterion<DateClientParam> now();
IDateCriterion now();
ICriterion<DateClientParam> second(Date theValue);
IDateCriterion second(Date theValue);
ICriterion<DateClientParam> second(String theValue);
IDateCriterion second(String theValue);
}
public interface IDateCriterion extends ICriterion<DateClientParam> {
IDateSpecifier orAfter();
IDateSpecifier orAfterOrEquals();
IDateSpecifier orBefore();
IDateSpecifier orBeforeOrEquals();
IDateSpecifier orExactly();
}
}

View File

@ -20,12 +20,15 @@ package ca.uhn.fhir.rest.gclient;
* #L%
*/
import org.hl7.fhir.instance.model.api.IBaseResource;
public interface IPatch {
IPatchTyped resource(IBaseResource theResource);
IPatchTyped resource(String theResourceBody);
/**
* The body of the patch document serialized in either XML or JSON which conforms to
* http://jsonpatch.com/ or http://tools.ietf.org/html/rfc5261
*
* @param thePatchBody
* The body of the patch
*/
IPatchWithBody withBody(String thePatchBody);
}

View File

@ -1,61 +0,0 @@
package ca.uhn.fhir.rest.gclient;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2016 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.instance.model.api.IIdType;
import ca.uhn.fhir.rest.api.PatchTypeEnum;
public interface IPatchTyped extends IPatchExecutable {
IPatchExecutable withId(IIdType theId);
IPatchExecutable withId(String theId);
/**
* Specifies that the update should be performed as a conditional create
* against a given search URL.
*
* @param theSearchUrl The search URL to use. The format of this URL should be of the form <code>[ResourceType]?[Parameters]</code>,
* for example: <code>Patient?name=Smith&amp;identifier=13.2.4.11.4%7C847366</code>
* @since HAPI 0.9 / FHIR DSTU 2
*/
IPatchTyped conditionalByUrl(String theSearchUrl);
/**
* @since HAPI 0.9 / FHIR DSTU 2
*/
IPatchWithQuery conditional();
/**
* Specifies the format of the patch (either XML or JSON)
* @param patchType
*/
IPatchTyped patchType(PatchTypeEnum patchType);
/**
* The body of the patch document serialized in either XML or JSON which conforms to
* http://jsonpatch.com/ or http://tools.ietf.org/html/rfc5261
* @param patchBody
*/
IPatchTyped patchBody(String patchBody);
}

View File

@ -0,0 +1,65 @@
package ca.uhn.fhir.rest.gclient;
import org.hl7.fhir.instance.model.api.IBaseResource;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2016 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.instance.model.api.IIdType;
public interface IPatchWithBody extends IPatchExecutable {
/**
* Build a conditional URL using fluent constants on resource types
*
* @param theResourceType
* The resource type to patch (e.g. "Patient.class")
*/
IPatchWithQuery conditional(Class<? extends IBaseResource> theClass);
/**
* Build a conditional URL using fluent constants on resource types
*
* @param theResourceType
* The resource type to patch (e.g. "Patient")
*/
IPatchWithQuery conditional(String theResourceType);
/**
* Specifies that the update should be performed as a conditional create
* against a given search URL.
*
* @param theSearchUrl
* The search URL to use. The format of this URL should be of the form <code>[ResourceType]?[Parameters]</code>,
* for example: <code>Patient?name=Smith&amp;identifier=13.2.4.11.4%7C847366</code>
*/
IPatchExecutable conditionalByUrl(String theSearchUrl);
/**
* The resource ID to patch
*/
IPatchExecutable withId(IIdType theId);
/**
* The resource ID to patch
*/
IPatchExecutable withId(String theId);
}

View File

@ -20,6 +20,6 @@ package ca.uhn.fhir.rest.gclient;
* #L%
*/
public interface IPatchWithQueryTyped extends IPatchTyped, IPatchWithQuery {
public interface IPatchWithQueryTyped extends IPatchWithBody, IPatchWithQuery {
}

View File

@ -1,5 +1,7 @@
package ca.uhn.fhir.rest.gclient;
import java.util.Collection;
/*
* #%L
* HAPI FHIR - Core Library
@ -81,6 +83,13 @@ public interface IQuery<T> extends IClientExecutable<IQuery<T>, T>, IBaseQuery<I
*/
IQuery<T> withProfile(String theProfileUri);
/**
* Matches any of the profiles given as argument. This would result in an OR search for resources matching one or more profiles.
* To do an AND search, make multiple calls to {@link #withProfile(String)}.
* @param theProfileUris The URIs of a given profile to search for resources which match.
*/
IQuery<T> withAnyProfile(Collection<String> theProfileUris);
/**
* Forces the query to perform the search using the given method (allowable methods are described in the
* <a href="http://www.hl7.org/fhir/search.html">FHIR Search Specification</a>)

View File

@ -45,17 +45,13 @@ public class HttpPatchClientInvocation extends BaseHttpClientInvocation {
myContentType = theContentType;
myContents = theContents;
}
//
// public HttpDeleteClientInvocation(FhirContext theContext, String theSearchUrl) {
// super(theContext);
// myUrlPath = theSearchUrl;
// }
//
// public HttpDeleteClientInvocation(FhirContext theContext, String theResourceType, Map<String, List<String>> theParams) {
// super(theContext);
// myUrlPath = theResourceType;
// myParams = theParams;
// }
public HttpPatchClientInvocation(FhirContext theContext, String theUrlPath, String theContentType, String theContents) {
super(theContext);
myUrlPath = theUrlPath;
myContentType = theContentType;
myContents = theContents;
}
@Override
public IHttpRequest asHttpRequest(String theUrlBase, Map<String, List<String>> theExtraParams, EncodingEnum theEncoding, Boolean thePrettyPrint) {

View File

@ -160,24 +160,18 @@ public class MethodUtil {
return PatchMethodBinding.createPatchInvocation(theContext, theId, thePatchType, theBody);
}
/** End Patch **/
public static HttpPatchClientInvocation createPatchInvocation(FhirContext theContext, String theUrl, PatchTypeEnum thePatchType, String theBody) {
return PatchMethodBinding.createPatchInvocation(theContext, theUrl, thePatchType, theBody);
}
public static HttpPatchClientInvocation createPatchInvocation(FhirContext theContext, PatchTypeEnum thePatchType, String theBody, String theResourceType, Map<String, List<String>> theMatchParams) {
return PatchMethodBinding.createPatchInvocation(theContext, thePatchType, theBody, theResourceType, theMatchParams);
}
public static HttpPutClientInvocation createUpdateInvocation(FhirContext theContext, IBaseResource theResource, String theResourceBody, Map<String, List<String>> theMatchParams) {
StringBuilder b = new StringBuilder();
String resourceType = theContext.getResourceDefinition(theResource).getName();
b.append(resourceType);
boolean haveQuestionMark = false;
for (Entry<String, List<String>> nextEntry : theMatchParams.entrySet()) {
for (String nextValue : nextEntry.getValue()) {
b.append(haveQuestionMark ? '&' : '?');
haveQuestionMark = true;
b.append(UrlUtil.escape(nextEntry.getKey()));
b.append('=');
b.append(UrlUtil.escape(nextValue));
}
}
StringBuilder b = createUrl(resourceType, theMatchParams);
HttpPutClientInvocation retVal;
if (StringUtils.isBlank(theResourceBody)) {
@ -191,6 +185,25 @@ public class MethodUtil {
return retVal;
}
public static StringBuilder createUrl(String theResourceType, Map<String, List<String>> theMatchParams) {
StringBuilder b = new StringBuilder();
b.append(theResourceType);
boolean haveQuestionMark = false;
for (Entry<String, List<String>> nextEntry : theMatchParams.entrySet()) {
for (String nextValue : nextEntry.getValue()) {
b.append(haveQuestionMark ? '&' : '?');
haveQuestionMark = true;
b.append(UrlUtil.escape(nextEntry.getKey()));
b.append('=');
b.append(UrlUtil.escape(nextValue));
}
}
return b;
}
public static HttpPutClientInvocation createUpdateInvocation(FhirContext theContext, IBaseResource theResource, String theResourceBody, String theMatchUrl) {
HttpPutClientInvocation retVal;
@ -354,7 +367,7 @@ public class MethodUtil {
}
/*
* Note: for the frst two here, we're using strings instead of static binding
* Note: for the first two here, we're using strings instead of static binding
* so that we don't need the java.servlet JAR on the classpath in order to use
* this class
*/

View File

@ -22,10 +22,7 @@ package ca.uhn.fhir.rest.method;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;
import java.util.ListIterator;
import java.util.Set;
import java.util.*;
import org.hl7.fhir.instance.model.api.IIdType;
@ -138,6 +135,11 @@ public class PatchMethodBinding extends BaseOutcomeReturningMethodBindingWithRes
return retVal;
}
public static HttpPatchClientInvocation createPatchInvocation(FhirContext theContext, String theUrlPath, PatchTypeEnum thePatchType, String theBody) {
HttpPatchClientInvocation retVal = new HttpPatchClientInvocation(theContext, theUrlPath, thePatchType.getContentType(), theBody);
return retVal;
}
@Override
protected void addParametersForServerRequest(RequestDetails theRequest, Object[] theParams) {
IIdType id = theRequest.getId();
@ -150,4 +152,11 @@ public class PatchMethodBinding extends BaseOutcomeReturningMethodBindingWithRes
return null;
}
public static HttpPatchClientInvocation createPatchInvocation(FhirContext theContext, PatchTypeEnum thePatchType, String theBody, String theResourceType, Map<String, List<String>> theMatchParams) {
StringBuilder urlBuilder = MethodUtil.createUrl(theResourceType, theMatchParams);
String url = urlBuilder.toString();
HttpPatchClientInvocation retVal = new HttpPatchClientInvocation(theContext, url, thePatchType.getContentType(), theBody);
return retVal;
}
}

View File

@ -111,6 +111,9 @@ class RuleImplOp extends BaseRule implements IAuthRule {
break;
case BATCH:
case TRANSACTION:
if (!(theOperation == RestOperationTypeEnum.TRANSACTION)) {
return null;
}
if (theInputResource != null && requestAppliesToTransaction(ctx, myOp, theInputResource)) {
if (getMode() == PolicyEnum.DENY) {
return new Verdict(PolicyEnum.DENY, this);

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -21,57 +21,57 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli-jpaserver</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli-jpaserver</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<type>jar</type>
<classifier>classes</classifier>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<classifier>classes</classifier>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -21,7 +21,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@ -29,33 +29,33 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<!-- This dependency includes the JPA server itself, which is packaged separately from the rest of HAPI FHIR -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<!-- This dependency is used for the "FHIR Tester" web app overlay -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<type>war</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<classifier>classes</classifier>
<scope>provided</scope>
</dependency>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
@ -38,12 +38,12 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -18,49 +18,49 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli-app</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<!-- Don't include in standard distribution -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-android</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<!-- Don't include in standard distribution -->
<scope>provided</scope>
</dependency>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -19,47 +19,47 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client-okhttp</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
@ -38,12 +38,12 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -31,7 +31,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jaxrsserver-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -23,7 +23,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
@ -34,32 +34,32 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
@ -367,7 +367,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<executions>
<execution>
<id>build_dstu1</id>
@ -419,22 +419,22 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>

View File

@ -71,19 +71,11 @@ public class FhirResourceDaoPatientDstu3 extends FhirResourceDaoDstu3<Patient>im
@Override
public IBundleProvider patientInstanceEverything(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType<Integer> theCount, DateRangeParam theLastUpdated, SortSpec theSort, StringAndListParam theContent, StringAndListParam theNarrative, RequestDetails theRequestDetails) {
// Notify interceptors
ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails, getResourceName(), null);
notifyInterceptors(RestOperationTypeEnum.EXTENDED_OPERATION_INSTANCE, requestDetails);
return doEverythingOperation(theId, theCount, theLastUpdated, theSort, theContent, theNarrative);
}
@Override
public IBundleProvider patientTypeEverything(HttpServletRequest theServletRequest, IPrimitiveType<Integer> theCount, DateRangeParam theLastUpdated, SortSpec theSort, StringAndListParam theContent, StringAndListParam theNarrative, RequestDetails theRequestDetails) {
// Notify interceptors
ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails, getResourceName(), null);
notifyInterceptors(RestOperationTypeEnum.EXTENDED_OPERATION_TYPE, requestDetails);
return doEverythingOperation(null, theCount, theLastUpdated, theSort, theContent, theNarrative);
}

View File

@ -26,6 +26,7 @@ import java.net.Socket;
import java.net.SocketTimeoutException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
@ -1641,7 +1642,56 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
}
assertEquals("Expects to retrieve the 2 patients which reference the two different organizations", expectedIds, actualIds);
}
@Test
public void testForResourcesWithProfile() {
Organization o1 = new Organization();
o1.setName("testSearchByResourceChainName01");
o1.getMeta().addProfile("http://profile1").addProfile("http://profile2");
IdDt o1id = (IdDt) ourClient.create().resource(o1).execute().getId().toUnqualifiedVersionless();
Organization o2 = new Organization();
o2.setName("testSearchByResourceChainName02");
o2.getMeta().addProfile("http://profile1").addProfile("http://profile3");
IdDt o2id = (IdDt) ourClient.create().resource(o2).execute().getId().toUnqualifiedVersionless();
//@formatter:off
Bundle actual = ourClient.search()
.forResource(Organization.class)
.withProfile("http://profile1")
.withProfile("http://profileX")
.encodedJson().prettyPrint().execute();
//@formatter:on
assertEquals("nothing matches profile x", Collections.emptyList(), actual.getEntries());
//@formatter:off
actual = ourClient.search()
.forResource(Organization.class)
.withProfile("http://profile1")
.withProfile("http://profile2")
.encodedJson().prettyPrint().execute();
//@formatter:on
Set<String> expectedIds = new HashSet<String>();
expectedIds.add(o1id.getIdPart());
Set<String> actualIds = new HashSet<String>();
for (BundleEntry ele : actual.getEntries()) {
actualIds.add(ele.getResource().getId().getIdPart());
}
assertEquals("Expects to retrieve the 1 orgination matching on Org1's profiles", expectedIds, actualIds);
//@formatter:off
actual = ourClient.search()
.forResource(Organization.class)
.withProfile("http://profile1")
.withAnyProfile(Arrays.asList("http://profile3", "http://profile2"))
.encodedJson().prettyPrint().execute();
//@formatter:on
expectedIds = new HashSet<String>();
expectedIds.add(o1id.getIdPart());
expectedIds.add(o2id.getIdPart());
actualIds = new HashSet<String>();
for (BundleEntry ele : actual.getEntries()) {
actualIds.add(ele.getResource().getId().getIdPart());
}
assertEquals("Expects to retrieve the 2 orginations, since we match on (the common profile AND (Org1's second profile OR org2's second profile))", expectedIds, actualIds);
}
@Test
public void testSearchLastUpdatedParamRp() throws InterruptedException {
String methodName = "testSearchLastUpdatedParamRp";

View File

@ -100,6 +100,7 @@ import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.dstu3.model.QuestionnaireResponse;
import org.hl7.fhir.dstu3.model.Reference;
import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.StructureDefinition;
import org.hl7.fhir.dstu3.model.Subscription;
import org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType;
import org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus;
@ -165,6 +166,16 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
}
return retVal;
}
@Test
public void testResourceSorting() throws Exception {
String input = IOUtils.toString(getClass().getResourceAsStream("/two_questionnaires.json"), StandardCharsets.UTF_8);
String respString = ourClient.transaction().withBundle(input).prettyPrint().execute();
ourLog.info(respString);
ourHttpClient.execute(new HttpGet("http://localhost:" + ourPort + "/QuestionnaireResponse?patient=QR3295&questionnaire=profile&_sort:desc=authored&_count=5&_include=QuestionnaireResponse:questionnaire&_include=QuestionnaireResponse:subject"));
// Bundle bundle =
}
/**
* See #484
@ -665,6 +676,23 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
}
}
@Test
public void testMetadataSuperParamsAreIncluded() throws IOException {
StructureDefinition p = new StructureDefinition();
p.setAbstract(true);
p.setUrl("http://example.com/foo");
IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
Bundle resp = ourClient
.search()
.forResource(StructureDefinition.class)
.where(StructureDefinition.URL.matches().value("http://example.com/foo"))
.returnBundle(Bundle.class)
.execute();
assertEquals(1, resp.getTotal());
}
@Test
public void testDeleteResourceConditional1() throws IOException {
String methodName = "testDeleteResourceConditional1";

View File

@ -0,0 +1,722 @@
{
"resourceType": "Bundle",
"id": "c52bd41e-5e0a-45fc-877a-6e245e638871",
"meta": {
"lastUpdated": "2016-11-07T16:50:40.867-05:00"
},
"type": "transaction",
"total": 8,
"entry": [
{
"fullUrl": "QuestionnaireResponse/QR3301",
"resource": {
"resourceType": "QuestionnaireResponse",
"id": "QR3301",
"meta": {
"versionId": "1",
"lastUpdated": "2016-11-04T17:22:43.970-04:00"
},
"questionnaire": {
"reference": "Questionnaire/profile"
},
"subject": {
"reference": "Patient/PT3295"
},
"authored": "2016-11-04T17:21:06-04:00",
"group": {
"group": [
{
"linkId": "basic",
"question": [
{
"linkId": "schoolType",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/schooltype",
"code": "PT"
}
}
]
},
{
"linkId": "workType",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/worktype",
"code": "PT"
}
}
]
}
]
}
]
}
},
"request": {
"method": "PUT", "url": "QuestionnaireResponse/QR3301"
}
},
{
"fullUrl": "QuestionnaireResponse/QR3300",
"resource": {
"resourceType": "QuestionnaireResponse",
"id": "QR3300",
"meta": {
"versionId": "1",
"lastUpdated": "2016-11-04T17:22:43.970-04:00"
},
"questionnaire": {
"reference": "Questionnaire/profile"
},
"subject": {
"reference": "Patient/PT3295"
},
"authored": "2016-11-04T17:21:51-04:00",
"group": {
"group": [
{
"linkId": "basic",
"question": [
{
"linkId": "schoolType",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/schooltype",
"code": "PT"
}
}
]
},
{
"linkId": "workType",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/worktype",
"code": "PT"
}
}
]
}
]
},
{
"linkId": "painArea",
"question": [
{
"linkId": "name",
"answer": [
{
"valueString": "RIGHT THIGH"
}
]
},
{
"linkId": "painLocations",
"answer": [
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "209570001"
}
}
]
},
{
"linkId": "painQualities",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/painquality",
"code": "ACHING"
}
},
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/painquality",
"code": "FREEZING"
}
}
]
},
{
"linkId": "painTriggers",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/paintriggers",
"code": "ANXIETY"
}
},
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/paintriggers",
"code": "CERTAIN_FOODS"
}
}
]
}
]
}
]
}
},
"request": {
"method": "PUT", "url": "QuestionnaireResponse/QR3300"
}
},
{
"fullUrl": "QuestionnaireResponse/QR3299",
"resource": {
"resourceType": "QuestionnaireResponse",
"id": "PT3299",
"meta": {
"versionId": "1",
"lastUpdated": "2016-11-04T17:22:43.970-04:00"
},
"questionnaire": {
"reference": "Questionnaire/profile"
},
"subject": {
"reference": "Patient/PT3295"
},
"authored": "2016-11-04T17:22:07-04:00",
"group": {
"group": [
{
"linkId": "basic",
"question": [
{
"linkId": "schoolType",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/schooltype",
"code": "PT"
}
}
]
},
{
"linkId": "workType",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/worktype",
"code": "PT"
}
}
]
}
]
},
{
"linkId": "painArea",
"question": [
{
"linkId": "name",
"answer": [
{
"valueString": "AREA 2233"
}
]
},
{
"linkId": "painLocations",
"answer": [
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "302553009"
}
},
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "51185008"
}
},
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "368107006"
}
}
]
},
{
"linkId": "painQualities",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/painquality",
"code": "SHOOTING"
}
},
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/painquality",
"code": "SPLITTING"
}
}
]
},
{
"linkId": "painTriggers",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/paintriggers",
"code": "TOO_MUCH_DOWNTIME"
}
},
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/paintriggers",
"code": "TOO_MUCH_PHYSICAL_ACTIVITY"
}
}
]
}
]
},
{
"linkId": "painArea",
"question": [
{
"linkId": "name",
"answer": [
{
"valueString": "RIGHT THIGH"
}
]
},
{
"linkId": "painLocations",
"answer": [
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "209570001"
}
}
]
},
{
"linkId": "painQualities",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/painquality",
"code": "ACHING"
}
},
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/painquality",
"code": "FREEZING"
}
}
]
},
{
"linkId": "painTriggers",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/paintriggers",
"code": "ANXIETY"
}
},
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/paintriggers",
"code": "CERTAIN_FOODS"
}
}
]
}
]
}
]
}
},
"request": {
"method": "PUT", "url": "QuestionnaireResponse/QR3299"
}
},
{
"fullUrl": "QuestionnaireResponse/QR3298",
"resource": {
"resourceType": "QuestionnaireResponse",
"id": "PT3298",
"meta": {
"versionId": "1",
"lastUpdated": "2016-11-04T17:22:43.970-04:00"
},
"questionnaire": {
"reference": "Questionnaire/profile"
},
"subject": {
"reference": "Patient/PT3295"
},
"authored": "2016-11-04T17:22:26-04:00",
"group": {
"group": [
{
"linkId": "basic",
"question": [
{
"linkId": "schoolType",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/schooltype",
"code": "PT"
}
}
]
},
{
"linkId": "workType",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/worktype",
"code": "PT"
}
}
]
}
]
},
{
"linkId": "painArea",
"question": [
{
"linkId": "name",
"answer": [
{
"valueString": "RIGHT THIGH"
}
]
},
{
"linkId": "painLocations",
"answer": [
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "209570001"
}
}
]
},
{
"linkId": "painQualities",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/painquality",
"code": "ACHING"
}
},
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/painquality",
"code": "FREEZING"
}
}
]
},
{
"linkId": "painTriggers",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/paintriggers",
"code": "ANXIETY"
}
},
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/paintriggers",
"code": "CERTAIN_FOODS"
}
}
]
}
]
},
{
"linkId": "painArea",
"question": [
{
"linkId": "name",
"answer": [
{
"valueString": "AREA 2233"
}
]
},
{
"linkId": "painLocations",
"answer": [
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "302553009"
}
},
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "51185008"
}
},
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "368107006"
}
}
]
},
{
"linkId": "painQualities",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/painquality",
"code": "SHOOTING"
}
},
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/painquality",
"code": "SPLITTING"
}
}
]
},
{
"linkId": "painTriggers",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/paintriggers",
"code": "TOO_MUCH_DOWNTIME"
}
},
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/paintriggers",
"code": "TOO_MUCH_PHYSICAL_ACTIVITY"
}
}
]
}
]
}
]
}
},
"request": {
"method": "PUT", "url": "QuestionnaireResponse/QR3298"
}
},
{
"fullUrl": "QuestionnaireResponse/QR3297",
"resource": {
"resourceType": "QuestionnaireResponse",
"id": "PT3297",
"meta": {
"versionId": "1",
"lastUpdated": "2016-11-04T17:22:43.970-04:00"
},
"questionnaire": {
"reference": "Questionnaire/profile"
},
"subject": {
"reference": "Patient/PT3295"
},
"authored": "2016-11-04T17:22:41-04:00",
"group": {
"group": [
{
"linkId": "basic",
"question": [
{
"linkId": "inflammationLocations",
"answer": [
{
"valueCoding": {
"system": "http://snomed.info/sct",
"code": "210659002"
}
}
]
},
{
"linkId": "schoolType",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/schooltype",
"code": "PT"
}
}
]
},
{
"linkId": "workType",
"answer": [
{
"valueCoding": {
"system": "http://ehealthinnovation.org/icc/ns/worktype",
"code": "PT"
}
}
]
}
]
}
]
}
},
"request": {
"method": "PUT", "url": "QuestionnaireResponse/PT3297"
}
},
{
"fullUrl": "https://example.com/icc-server/fhir/Questionnaire/profile",
"resource": {
"resourceType": "Questionnaire",
"id": "profile",
"meta": {
"versionId": "1",
"lastUpdated": "2016-10-28T10:06:59.083-04:00"
},
"group": {
"group": [
{
"linkId": "basic",
"question": [
{
"linkId": "schoolType",
"type": "choice",
"required": true,
"options": {
"reference": "ValueSet/schooltype"
}
},
{
"linkId": "workType",
"type": "choice",
"required": true,
"options": {
"reference": "ValueSet/worktype"
}
},
{
"linkId": "inflammationLocations",
"type": "choice",
"required": false,
"repeats": true,
"options": {
"reference": "ValueSet/painLocation"
}
}
]
},
{
"linkId": "painArea",
"required": true,
"repeats": true,
"question": [
{
"linkId": "name",
"type": "string",
"required": false,
"repeats": false
},
{
"linkId": "painLocations",
"type": "choice",
"required": true,
"repeats": true,
"options": {
"reference": "ValueSet/painLocation"
}
},
{
"linkId": "painQualities",
"type": "open-choice",
"required": true,
"repeats": true,
"options": {
"reference": "ValueSet/painQuality"
}
},
{
"linkId": "painTriggers",
"type": "open-choice",
"required": true,
"repeats": true,
"options": {
"reference": "ValueSet/painTriggers"
}
}
]
}
]
}
},
"request": {
"method": "PUT", "url": "Questionnaire/profile"
}
},
{
"fullUrl": "https://example.com/icc-server/fhir/Patient/PT3295",
"resource": {
"resourceType": "Patient",
"id": "PT3295",
"meta": {
"versionId": "5",
"lastUpdated": "2016-11-07T16:12:56.970-05:00"
},
"name": [
{
"use": "nickname",
"given": [
"akib"
]
},
{
"use": "anonymous"
}
],
"telecom": [
{
"system": "email"
}
],
"gender": "male",
"birthDate": "2013",
"photo": [
{
"contentType": "image/jpeg",
"url": "https://example.com/icc-server/api/users/1431/avatar?version=2"
}
]
},
"request": {
"method": "PUT", "url": "Patient/PT3295"
}
}
]
}

View File

@ -10,7 +10,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -35,40 +35,40 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<!-- At least one "structures" JAR must also be included -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<!-- This dependency includes the JPA server itself, which is packaged separately from the rest of HAPI FHIR -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<!-- This dependency is used for the "FHIR Tester" web app overlay -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<type>war</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<classifier>classes</classifier>
<scope>provided</scope>
</dependency>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -18,34 +18,34 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<type>war</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<classifier>classes</classifier>
<scope>provided</scope>
</dependency>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -19,37 +19,37 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -17,7 +17,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<!--
@ -170,7 +170,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<executions>
<execution>
<goals>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -17,13 +17,13 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<scope>test</scope>
</dependency>
@ -179,7 +179,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<executions>
<execution>
<id>generate</id>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -18,12 +18,12 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<scope>test</scope>
</dependency>

View File

@ -29,6 +29,8 @@ import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicStatusLine;
import org.hl7.fhir.dstu3.model.*;
@ -118,6 +120,246 @@ public class GenericClientDstu3Test {
return capt;
}
@Test
public void testPatchJsonByIdString() throws Exception {
OperationOutcome conf = new OperationOutcome();
conf.getText().setDivAsString("OK!");
final String respString = ourCtx.newJsonParser().encodeResourceToString(conf);
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()).then(new Answer<InputStream>() {
@Override
public InputStream answer(InvocationOnMock theInvocation) throws Throwable {
return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8"));
}
});
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
int idx = 0;
String patch = "[ { \"op\":\"replace\", \"path\":\"/active\", \"value\":false } ]";
MethodOutcome outcome = client
.patch()
.withBody(patch)
.withId("Patient/123")
.execute();
assertEquals("http://example.com/fhir/Patient/123", UrlUtil.unescape(capt.getAllValues().get(idx).getURI().toString()));
assertEquals("PATCH", capt.getAllValues().get(0).getRequestLine().getMethod());
assertEquals(patch, extractBodyAsString(capt));
assertEquals(Constants.CT_JSON_PATCH, capt.getAllValues().get(idx).getFirstHeader("Content-Type").getValue().replaceAll(";.*", ""));
idx++;
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
assertThat(oo.getText().getDivAsString(), containsString("OK!"));
}
@Test
public void testPatchJsonByIdType() throws Exception {
OperationOutcome conf = new OperationOutcome();
conf.getText().setDivAsString("OK!");
final String respString = ourCtx.newJsonParser().encodeResourceToString(conf);
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()).then(new Answer<InputStream>() {
@Override
public InputStream answer(InvocationOnMock theInvocation) throws Throwable {
return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8"));
}
});
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
int idx = 0;
String patch = "[ { \"op\":\"replace\", \"path\":\"/active\", \"value\":false } ]";
MethodOutcome outcome = client
.patch()
.withBody(patch)
.withId(new IdType("http://localhost/fhir/Patient/123/_history/234"))
.execute();
assertEquals("http://example.com/fhir/Patient/123", UrlUtil.unescape(capt.getAllValues().get(idx).getURI().toString()));
assertEquals("PATCH", capt.getAllValues().get(0).getRequestLine().getMethod());
assertEquals(patch, extractBodyAsString(capt));
assertEquals(Constants.CT_JSON_PATCH, capt.getAllValues().get(idx).getFirstHeader("Content-Type").getValue().replaceAll(";.*", ""));
idx++;
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
assertThat(oo.getText().getDivAsString(), containsString("OK!"));
}
@Test
public void testPatchJsonByConditionalString() throws Exception {
OperationOutcome conf = new OperationOutcome();
conf.getText().setDivAsString("OK!");
final String respString = ourCtx.newJsonParser().encodeResourceToString(conf);
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()).then(new Answer<InputStream>() {
@Override
public InputStream answer(InvocationOnMock theInvocation) throws Throwable {
return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8"));
}
});
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
int idx = 0;
String patch = "[ { \"op\":\"replace\", \"path\":\"/active\", \"value\":false } ]";
MethodOutcome outcome = client
.patch()
.withBody(patch)
.conditionalByUrl("Patient?foo=bar")
.execute();
assertEquals("http://example.com/fhir/Patient?foo=bar", UrlUtil.unescape(capt.getAllValues().get(idx).getURI().toString()));
assertEquals("PATCH", capt.getAllValues().get(0).getRequestLine().getMethod());
assertEquals(patch, extractBodyAsString(capt));
assertEquals(Constants.CT_JSON_PATCH, capt.getAllValues().get(idx).getFirstHeader("Content-Type").getValue().replaceAll(";.*", ""));
idx++;
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
assertThat(oo.getText().getDivAsString(), containsString("OK!"));
}
@Test
public void testPatchJsonByConditionalParam() throws Exception {
OperationOutcome conf = new OperationOutcome();
conf.getText().setDivAsString("OK!");
final String respString = ourCtx.newJsonParser().encodeResourceToString(conf);
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()).then(new Answer<InputStream>() {
@Override
public InputStream answer(InvocationOnMock theInvocation) throws Throwable {
return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8"));
}
});
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
int idx = 0;
String patch = "[ { \"op\":\"replace\", \"path\":\"/active\", \"value\":false } ]";
MethodOutcome outcome = client
.patch()
.withBody(patch)
.conditional("Patient").where(Patient.NAME.matches().value("TEST"))
.and(Patient.FAMILY.matches().value("TEST2"))
.execute();
assertEquals("http://example.com/fhir/Patient?name=TEST&family=TEST2", UrlUtil.unescape(capt.getAllValues().get(idx).getURI().toString()));
assertEquals("PATCH", capt.getAllValues().get(0).getRequestLine().getMethod());
assertEquals(patch, extractBodyAsString(capt));
assertEquals(Constants.CT_JSON_PATCH, capt.getAllValues().get(idx).getFirstHeader("Content-Type").getValue().replaceAll(";.*", ""));
idx++;
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
assertThat(oo.getText().getDivAsString(), containsString("OK!"));
}
@Test
public void testPatchJsonByConditionalParamResourceType() throws Exception {
OperationOutcome conf = new OperationOutcome();
conf.getText().setDivAsString("OK!");
final String respString = ourCtx.newJsonParser().encodeResourceToString(conf);
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()).then(new Answer<InputStream>() {
@Override
public InputStream answer(InvocationOnMock theInvocation) throws Throwable {
return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8"));
}
});
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
int idx = 0;
String patch = "[ { \"op\":\"replace\", \"path\":\"/active\", \"value\":false } ]";
MethodOutcome outcome = client
.patch()
.withBody(patch)
.conditional(Patient.class).where(Patient.NAME.matches().value("TEST"))
.and(Patient.FAMILY.matches().value("TEST2"))
.execute();
assertEquals("http://example.com/fhir/Patient?name=TEST&family=TEST2", UrlUtil.unescape(capt.getAllValues().get(idx).getURI().toString()));
assertEquals("PATCH", capt.getAllValues().get(0).getRequestLine().getMethod());
assertEquals(patch, extractBodyAsString(capt));
assertEquals(Constants.CT_JSON_PATCH, capt.getAllValues().get(idx).getFirstHeader("Content-Type").getValue().replaceAll(";.*", ""));
idx++;
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
assertThat(oo.getText().getDivAsString(), containsString("OK!"));
}
@Test
public void testPatchXmlByIdString() throws Exception {
OperationOutcome conf = new OperationOutcome();
conf.getText().setDivAsString("OK!");
final String respString = ourCtx.newJsonParser().encodeResourceToString(conf);
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()).then(new Answer<InputStream>() {
@Override
public InputStream answer(InvocationOnMock theInvocation) throws Throwable {
return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8"));
}
});
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
int idx = 0;
String patch = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><diff xmlns:fhir=\"http://hl7.org/fhir\"><replace sel=\"fhir:Patient/fhir:active/@value\">false</replace></diff>";
MethodOutcome outcome = client
.patch()
.withBody(patch)
.withId("Patient/123")
.execute();
assertEquals("http://example.com/fhir/Patient/123", UrlUtil.unescape(capt.getAllValues().get(idx).getURI().toString()));
assertEquals("PATCH", capt.getAllValues().get(0).getRequestLine().getMethod());
assertEquals(patch, extractBodyAsString(capt));
assertEquals(Constants.CT_XML_PATCH, capt.getAllValues().get(idx).getFirstHeader("Content-Type").getValue().replaceAll(";.*", ""));
idx++;
OperationOutcome oo = (OperationOutcome) outcome.getOperationOutcome();
assertThat(oo.getText().getDivAsString(), containsString("OK!"));
}
@Test
public void testPatchInvalid() throws Exception {
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
try {
client
.patch()
.withBody("AA")
.withId("Patient/123")
.execute();
} catch (IllegalArgumentException e) {
assertEquals("Unable to determine encoding of patch", e.getMessage());
}
}
@Test
public void testAcceptHeaderWithEncodingSpecified() throws Exception {
final 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\"}]}}]}";

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -18,12 +18,12 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<scope>test</scope>
</dependency>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -27,28 +27,28 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<!--<dependency> <groupId>ca.uhn.hapi.fhir</groupId> <artifactId>hapi-fhir-structures-dev</artifactId> <version>0.9</version> </dependency> -->
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -17,7 +17,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>

View File

@ -61,7 +61,7 @@
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the unit is present, the system SHALL also be present</sch:assert>
</sch:rule>
<sch:rule context="//f:ValueSet/f:compose/f:include">
<sch:assert test="(not(exists(f:concept) or exists(f:filter)) or exists(f:system)">vsd-2: A value set with concepts or filters SHALL include a system</sch:assert>
<sch:assert test="not(exists(f:concept) or exists(f:filter)) or exists(f:system)">vsd-2: A value set with concepts or filters SHALL include a system</sch:assert>
<sch:assert test="not(exists(f:concept)) or not(exists(f:filter))">vsd-3: Cannot have both concept and filter</sch:assert>
<sch:assert test="exists(f:valueSet) or exists(f:system)">vsd-1: A value set include/exclude SHALL have a value set or a system</sch:assert>
</sch:rule>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -19,7 +19,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<!--
Because Tinder is a part of the HAPI FHIR build process (it generates
@ -31,32 +31,32 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>1.5</version>
<version>2.1</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.5</version>
<version>2.1</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>1.5</version>
<version>2.1</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>1.5</version>
<version>2.1</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>1.5</version>
<version>2.1</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>

View File

@ -7,6 +7,8 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.TreeSet;
@ -29,6 +31,7 @@ import org.apache.velocity.tools.generic.EscapeTool;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.tinder.parser.BaseStructureSpreadsheetParser;
import ca.uhn.fhir.tinder.parser.ResourceGeneratorUsingModel;
import ca.uhn.fhir.tinder.parser.ResourceGeneratorUsingSpreadsheet;
@Mojo(name = "generate-jparest-server", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
@ -137,7 +140,7 @@ public class TinderJpaRestServerMojo extends AbstractMojo {
File packageDirectoryBase = new File(targetDirectory, packageBase.replace(".", File.separatorChar + ""));
packageDirectoryBase.mkdirs();
ResourceGeneratorUsingSpreadsheet gen = new ResourceGeneratorUsingSpreadsheet(version, baseDir);
ResourceGeneratorUsingModel gen = new ResourceGeneratorUsingModel(version, baseDir);
gen.setBaseResourceNames(baseResourceNames);
try {
@ -236,7 +239,7 @@ public class TinderJpaRestServerMojo extends AbstractMojo {
mojo.version = "dstu3";
mojo.packageBase = "ca.uhn.test";
mojo.configPackageBase = "ca.uhn.test";
// mojo.baseResourceNames = new ArrayList<String>(Collections.singletonList("observation"));
mojo.baseResourceNames = new ArrayList<String>(Arrays.asList("structuredefinition", "observation"));
mojo.targetDirectory = new File("target/generated/valuesets");
mojo.targetResourceDirectory = new File("target/generated/valuesets");
mojo.targetResourceSpringBeansFile = "tmp_beans.xml";

View File

@ -56,7 +56,7 @@ public abstract class BaseRootType extends BaseElement {
return retVal;
}
public void addSearchParameter(String theVersion, SearchParameter theParam) {
public void addSearchParameter(SearchParameter theParam) {
getSearchParameters();
mySearchParameters.add(theParam);

View File

@ -32,6 +32,7 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IResource;
@ -66,11 +67,24 @@ public abstract class BaseStructureParser {
protected List<BaseRootType> myResources = new ArrayList<BaseRootType>();
private String myVersion;
private boolean myIsRi;
private FhirContext myCtx;
public BaseStructureParser(String theVersion, String theBaseDir) {
myVersion = theVersion;
myBaseDir = theBaseDir;
myIsRi = myVersion.equals("dstu3");
if (myVersion.equals("dstu3")) {
myCtx = FhirContext.forDstu3();
} else if (myVersion.equals("dstu2")) {
myCtx = FhirContext.forDstu2();
} else if (myVersion.equals("dstu")) {
myCtx = FhirContext.forDstu1();
}
}
public FhirContext getCtx() {
return myCtx;
}
public String getVersion() {
@ -175,7 +189,7 @@ public abstract class BaseStructureParser {
}
protected abstract String getTemplate();
protected abstract File getTemplateFile();
protected boolean isSpreadsheet(String theFileName) {
@ -228,7 +242,7 @@ public abstract class BaseStructureParser {
// not found
}
}
try {
return Class.forName("org.hl7.fhir.dstu3.model." + unqualifiedTypeName).getName();
} catch (ClassNotFoundException e) {
@ -447,7 +461,7 @@ public abstract class BaseStructureParser {
if (determineVersionEnum().isRi()) {
packageSuffix = "." + myVersion;
}
VelocityContext ctx = new VelocityContext();
ctx.put("includeDescriptionAnnotations", true);
ctx.put("packageBase", thePackageBase);
@ -489,8 +503,7 @@ public abstract class BaseStructureParser {
v.setProperty("cp.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
v.setProperty("runtime.references.strict", Boolean.TRUE);
InputStream templateIs =
getTemplateFile() != null
InputStream templateIs = getTemplateFile() != null
? new FileInputStream(getTemplateFile())
: ResourceGeneratorUsingSpreadsheet.class.getResourceAsStream(getTemplate());
InputStreamReader templateReader = new InputStreamReader(templateIs);
@ -573,7 +586,7 @@ public abstract class BaseStructureParser {
myNameToDatatypeClass.put("boundCode", BoundCodeDt.class.getName());
myNameToDatatypeClass.put("boundCodeableConcept", ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt.class.getName());
}
try {
File versionFile = new File(theResourceOutputDirectory, "fhirversion.properties");
OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(versionFile, false), "UTF-8");
@ -584,7 +597,7 @@ public abstract class BaseStructureParser {
if (determineVersionEnum().isRi()) {
packageSuffix = "." + myVersion;
}
VelocityContext ctx = new VelocityContext();
ctx.put("nameToResourceClass", myNameToResourceClass);
ctx.put("nameToDatatypeClass", myNameToDatatypeClass);

View File

@ -317,7 +317,7 @@ public abstract class BaseStructureSpreadsheetParser extends BaseStructureParser
if (sp.getType().equals("composite")) {
compositeParams.add(sp);
} else {
theResource.addSearchParameter(getVersion(), sp);
theResource.addSearchParameter(sp);
}
}
@ -397,7 +397,7 @@ public abstract class BaseStructureSpreadsheetParser extends BaseStructureParser
for (SearchParameter part1 : compositeOf.get(0)) {
for (SearchParameter part2 : compositeOf.get(1)) {
SearchParameter composite = new SearchParameter(getVersion(), theResource.getName());
theResource.addSearchParameter(getVersion(), composite);
theResource.addSearchParameter(composite);
composite.setName(part1.getName() + "-" + part2.getName());
composite.setDescription(nextCompositeParam.getDescription());
composite.setPath(nextCompositeParam.getPath());

View File

@ -159,7 +159,7 @@ public class ProfileParser extends BaseStructureParser {
param.setType(nextParam.getType().getValue());
param.setDescription(nextParam.getDocumentation().getValue());
retVal.addSearchParameter(getVersion(), param);
retVal.addSearchParameter(param);
}
addResource(retVal);

View File

@ -0,0 +1,107 @@
package ca.uhn.fhir.tinder.parser;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang.WordUtils;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.tinder.model.Resource;
import ca.uhn.fhir.tinder.model.SearchParameter;
public class ResourceGeneratorUsingModel extends BaseStructureParser {
private String myFilenameSuffix;
private String myTemplate;
private File myTemplateFile;
private Collection<String> myResourceNames;
public ResourceGeneratorUsingModel(String theVersion, String theBaseDir) {
super(theVersion, theBaseDir);
}
@Override
protected String getFilenameSuffix() {
return myFilenameSuffix;
}
@Override
protected String getTemplate() {
return myTemplate;
}
@Override
protected File getTemplateFile() {
return myTemplateFile;
}
public void setFilenameSuffix(String theFilenameSuffix) {
myFilenameSuffix = theFilenameSuffix;
}
public void setTemplate(String theTemplate) {
myTemplate = theTemplate;
}
public void setTemplateFile(File theTemplateFile) {
myTemplateFile = theTemplateFile;
}
public void setBaseResourceNames(List<String> theBaseResourceNames) {
myResourceNames = theBaseResourceNames;
}
public void parse() {
for (String nextResourceName : myResourceNames) {
RuntimeResourceDefinition def = getCtx().getResourceDefinition(nextResourceName);
Resource resource = new Resource();
resource.setName(def.getName());
resource.setElementName(def.getName());
addResource(resource);
for (RuntimeSearchParam nextSearchParam : def.getSearchParams()) {
SearchParameter param = new SearchParameter(getVersion(), def.getName());
param.setName(nextSearchParam.getName());
param.setDescription(nextSearchParam.getDescription());
param.setCompositeOf(toCompositeOfStrings(nextSearchParam.getCompositeOf()));
param.setCompositeTypes(toCompositeOfTypes(nextSearchParam.getCompositeOf()));
param.setPath(nextSearchParam.getPath());
param.setType(nextSearchParam.getParamType().getCode());
resource.addSearchParameter(param);
}
}
}
private List<String> toCompositeOfStrings(List<RuntimeSearchParam> theCompositeOf) {
if (theCompositeOf == null) {
return null;
}
ArrayList<String> retVal = new ArrayList<String>();
for (RuntimeSearchParam next : theCompositeOf) {
retVal.add(next.getName());
}
return retVal;
}
private List<String> toCompositeOfTypes(List<RuntimeSearchParam> theCompositeOf) {
if (theCompositeOf == null) {
return null;
}
ArrayList<String> retVal = new ArrayList<String>();
for (RuntimeSearchParam next : theCompositeOf) {
String type = next.getParamType().getCode();
type = WordUtils.capitalize(type);
retVal.add(type);
}
return retVal;
}
}

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -17,12 +17,12 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
@ -45,7 +45,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<executions>
<execution>
<id>custom-structs</id>
@ -139,7 +139,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
@ -183,17 +183,17 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<!--
<dependency>

11
pom.xml
View File

@ -11,9 +11,9 @@
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<packaging>pom</packaging>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<name>HAPI-FHIR</name>
<url>https://github.com/jamesagnew/hapi-fhir</url>
<url>https://hapifhir.io</url>
<organization>
<name>University Health Network</name>
@ -499,17 +499,17 @@
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-api</artifactId>
<version>1.9.4</version>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.9.4</version>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9.4</version>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
@ -928,6 +928,7 @@
<skipDeploy>true</skipDeploy>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding>
<relativizeDecorationLinks>false</relativizeDecorationLinks>
</configuration>
<dependencies>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -17,12 +17,12 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -33,27 +33,27 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<!-- At least one "structures" JAR must also be included -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
<!-- This dependency is used for the "FHIR Tester" web app overlay -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<type>war</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
<classifier>classes</classifier>
<scope>provided</scope>
</dependency>

View File

@ -6,7 +6,20 @@
<title>HAPI FHIR Changelog</title>
</properties>
<body>
<release version="2.1" date="TBD">
<release version="2.2" date="TBD">
<action type="fix">
Fix issue in AuthorizationIntetceptor where
transactions are blocked even when they
should not be
</action>
<action type="fix">
Fix regression in HAPI FHIR 2.1 JPA
server where some search parameters on
metadata resources did not appear
(e.g. "StructureDefinition.url"). Thanks
to David Hay for reporting!
</action>
<release version="2.1" date="2016-11-11">
<action type="add">
STU3 structure definitions have been updated to the
STU3 latest definitions (1.7.0 - SVN 10129). In
@ -260,6 +273,10 @@
Remove an unneccesary database flush
from JPA persistence operations
</action>
<action type="add" issue="470">
Add method to fluent client to allow OR search across several
profiles. Thanks to Thomas Andersen for the pull request!
</action>
</release>
<release version="2.0" date="2016-08-30">
<action type="fix">

View File

@ -12,13 +12,32 @@
the <a href="https://groups.google.com/d/forum/hapi-fhir">HAPI FHIR Google Group</a>.
This group is a great resource, with lots of helpful people who can assist. The
HAPI FHIR developers are regular contributors to this group.
</p>
<p>
Please do not email us at our personal email addressees with questions about how to use HAPI!
We are much more likely to respond if you post your question in the group, since there are
a fixed number of hours in the day and we prefer to help in a place that benefits
everyone. Also, please do not post a question on the <a href="https://github.com/jamesagnew/hapi-fhir/issues">GitHub Issue Tracker</a>
unless you are sure it is actually a bug. If you're not sure whether you have a question or a bug,
please post your question on the Google Group.
</p>
<p>
If you have questions which are about FHIR itself (e.g. which resource should
I use for a specific purpose, how to I model my data, etc.) you might want
to also consider posting on <a href="http://stackoverflow.com/questions/tagged/hl7_fhir">Stackoverflow</a>,
as there are a number of FHIR experts who aren't HAPI/Java users who monitor
that site.
I use for a specific purpose, how to I model my data, etc.)
there are two great resources that can help you:
<ul>
<li>
The <a href="https://chat.fhir.org/">chat.fhir.org</a> server offers a live chat that is
very popular with people using FHIR. That community extends far beyond just HAPI users, so
there is a large pool of people who might have answers to your questions.
</li>
<li>
You might want
to also consider posting on <a href="http://stackoverflow.com/questions/tagged/hl7_fhir">Stackoverflow</a>,
as there are a number of FHIR experts who aren't HAPI/Java users who monitor
that site.
</li>
</ul>
</p>
</answer>
</faq>

View File

@ -136,6 +136,7 @@
<item name="Google Group (Ask Questions)" href="https://groups.google.com/d/forum/hapi-fhir" />
<item name="Issue Tracker (Report Bugs/Request Features)" href="https://github.com/jamesagnew/hapi-fhir/issues" />
<item name="Frequently Asked Questions (FAQ)" href="./hapi-fhir-faq.html" />
<item name="FHIR.org Chat (Live Chat with FHIR Implementors)" href="https://chat.fhir.org/" />
</menu>
<menu name="Test Server">

View File

@ -3,7 +3,7 @@
<properties>
<title>The Open Source HL7 API for Java</title>
<author email="jamesagnew@users.sourceforge.net">James Agnew</author>
<author email="jamesagnew@gmail.com">James Agnew</author>
</properties>
<body>
@ -60,6 +60,55 @@
</section>
<section name="Announcements">
<p>
<b>November 11, 2016 - HAPI FHIR 2.1 Released</b> -
The next release of HAPI has now been uploaded to the Maven repos and
GitHub's releases section.
</p>
<p>
This release brings several primary changes:
<ul>
<li>
STU3 definitions have been updated to the
latest definitions (FHIR 1.7.0 - SVN 10129)
</li>
<li>
Add support for FHIR Patch operation (thanks to
Peter Girard of McKesson for his help on this!)
</li>
<li>
Android library has been streamlined to use the
OkHttp client by default (no more fighting with
out-of-date Apache HttpClient. Thanks to Matt Clarke of Orion Health
for his help on this!)
</li>
<li>
The STU3 client now supports both the Conformance resource
(which is going away) and the new CapabilityStatement
(which replaces it). This should allow for a bridge
while servers are migrated to the new resource type
being returned by the <![CDATA[<code>/metadata</code>]]> endpoint.
</li>
</ul>
</p>
<p>
This release also brings a number of bugfixes and also quite a few enhancements.
As always, the <a href="./changes-report.html">changelog</a> has the full list
of changes in this version. Among the enhancements in this release are:
</p>
<p>
As always, we welcome new contributions and contributors! Please feel free to get
in touch if you are interested in getting involved with HAPI but don't know
where to start.
</p>
<p>
- <a href="https://github.com/jamesagnew/">James Agnew</a>
</p>
<br/><br/>
<p>
<b>August 30, 2016 - HAPI FHIR 2.0 Released</b> -
The next release of HAPI has now been uploaded to the Maven repos and
@ -104,6 +153,8 @@
<p>
- <a href="https://github.com/jamesagnew/">James Agnew</a>
</p>
<!--
<br/><br/>
<p>
<b>July 7, 2016 - HAPI FHIR 1.6 Released</b> -
@ -156,7 +207,7 @@
<p>
- <a href="https://github.com/jamesagnew/">James Agnew</a>
</p>
-->
<!--
<p>
<b>April 20, 2016 - HAPI FHIR 1.5 Released</b> -