Move PreferReturnEnum back to original location to avoid regressions

This commit is contained in:
James Agnew 2019-09-19 15:48:58 -04:00
parent 6fde2879ef
commit eddb98084d
35 changed files with 175 additions and 146 deletions

View File

@ -8,7 +8,7 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Date; import java.util.Date;
import ca.uhn.fhir.rest.api.PreferHeader; import ca.uhn.fhir.rest.api.PreferReturnEnum;
import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.dstu3.model.*;
import org.junit.*; import org.junit.*;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
@ -246,7 +246,7 @@ public class GenericClientDstu3IT {
Patient pt = new Patient(); Patient pt = new Patient();
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.create().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.create().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertNull(outcome.getOperationOutcome()); assertNull(outcome.getOperationOutcome());
assertNotNull(outcome.getResource()); assertNotNull(outcome.getResource());

View File

@ -1,7 +1,6 @@
package ca.uhn.fhir.rest.api; package ca.uhn.fhir.rest.api;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.HashMap;
public class PreferHeader { public class PreferHeader {
@ -27,35 +26,4 @@ public class PreferHeader {
return this; return this;
} }
/**
* Represents values for "return" value as provided in the the <a href="https://tools.ietf.org/html/rfc7240#section-4.2">HTTP Prefer header</a>.
*/
public enum PreferReturnEnum {
REPRESENTATION("representation"), MINIMAL("minimal"), OPERATION_OUTCOME("OperationOutcome");
private static HashMap<String, PreferReturnEnum> ourValues;
private String myHeaderValue;
PreferReturnEnum(String theHeaderValue) {
myHeaderValue = theHeaderValue;
}
public String getHeaderValue() {
return myHeaderValue;
}
public static PreferReturnEnum fromHeaderValue(String theHeaderValue) {
if (ourValues == null) {
HashMap<String, PreferReturnEnum> values = new HashMap<>();
for (PreferReturnEnum next : PreferReturnEnum.values()) {
values.put(next.getHeaderValue(), next);
}
ourValues = values;
}
return ourValues.get(theHeaderValue);
}
}
} }

View File

@ -0,0 +1,34 @@
package ca.uhn.fhir.rest.api;
import java.util.HashMap;
/**
* Represents values for "return" value as provided in the the <a href="https://tools.ietf.org/html/rfc7240#section-4.2">HTTP Prefer header</a>.
*/
public enum PreferReturnEnum {
REPRESENTATION("representation"), MINIMAL("minimal"), OPERATION_OUTCOME("OperationOutcome");
private static HashMap<String, PreferReturnEnum> ourValues;
private String myHeaderValue;
PreferReturnEnum(String theHeaderValue) {
myHeaderValue = theHeaderValue;
}
public String getHeaderValue() {
return myHeaderValue;
}
public static PreferReturnEnum fromHeaderValue(String theHeaderValue) {
if (ourValues == null) {
HashMap<String, PreferReturnEnum> values = new HashMap<>();
for (PreferReturnEnum next : PreferReturnEnum.values()) {
values.put(next.getHeaderValue(), next);
}
ourValues = values;
}
return ourValues.get(theHeaderValue);
}
}

View File

@ -21,7 +21,7 @@ package ca.uhn.fhir.rest.gclient;
*/ */
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.PreferHeader; import ca.uhn.fhir.rest.api.PreferReturnEnum;
public interface ICreateTyped extends IClientExecutable<ICreateTyped, MethodOutcome> { public interface ICreateTyped extends IClientExecutable<ICreateTyped, MethodOutcome> {
@ -47,6 +47,6 @@ public interface ICreateTyped extends IClientExecutable<ICreateTyped, MethodOutc
* *
* @since HAPI 1.1 * @since HAPI 1.1
*/ */
ICreateTyped prefer(PreferHeader.PreferReturnEnum theReturn); ICreateTyped prefer(PreferReturnEnum theReturn);
} }

View File

@ -21,7 +21,7 @@ package ca.uhn.fhir.rest.gclient;
*/ */
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.PreferHeader; import ca.uhn.fhir.rest.api.PreferReturnEnum;
public interface IPatchExecutable extends IClientExecutable<IPatchExecutable, MethodOutcome>{ public interface IPatchExecutable extends IClientExecutable<IPatchExecutable, MethodOutcome>{
@ -32,6 +32,6 @@ public interface IPatchExecutable extends IClientExecutable<IPatchExecutable, Me
* *
* @since HAPI 1.1 * @since HAPI 1.1
*/ */
IPatchExecutable prefer(PreferHeader.PreferReturnEnum theReturn); IPatchExecutable prefer(PreferReturnEnum theReturn);
} }

View File

@ -21,7 +21,7 @@ package ca.uhn.fhir.rest.gclient;
*/ */
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.PreferHeader; import ca.uhn.fhir.rest.api.PreferReturnEnum;
public interface IUpdateExecutable extends IClientExecutable<IUpdateExecutable, MethodOutcome>{ public interface IUpdateExecutable extends IClientExecutable<IUpdateExecutable, MethodOutcome>{
@ -32,6 +32,6 @@ public interface IUpdateExecutable extends IClientExecutable<IUpdateExecutable,
* *
* @since HAPI 1.1 * @since HAPI 1.1
*/ */
IUpdateExecutable prefer(PreferHeader.PreferReturnEnum theReturn); IUpdateExecutable prefer(PreferReturnEnum theReturn);
} }

View File

@ -364,11 +364,11 @@ public class GenericOkHttpClientDstu2Test {
Patient p = new Patient(); Patient p = new Patient();
p.addName().addFamily("FOOFAMILY"); p.addName().addFamily("FOOFAMILY");
client.create().resource(p).prefer(PreferHeader.PreferReturnEnum.MINIMAL).execute(); client.create().resource(p).prefer(PreferReturnEnum.MINIMAL).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());
client.create().resource(p).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); client.create().resource(p).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());
} }
@ -1745,11 +1745,11 @@ public class GenericOkHttpClientDstu2Test {
p.setId(new IdDt("1")); p.setId(new IdDt("1"));
p.addName().addFamily("FOOFAMILY"); p.addName().addFamily("FOOFAMILY");
client.update().resource(p).prefer(PreferHeader.PreferReturnEnum.MINIMAL).execute(); client.update().resource(p).prefer(PreferReturnEnum.MINIMAL).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());
client.update().resource(p).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); client.update().resource(p).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());
} }

View File

@ -533,7 +533,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
private class CreateInternal extends BaseSearch<ICreateTyped, ICreateWithQueryTyped, MethodOutcome> implements ICreate, ICreateTyped, ICreateWithQuery, ICreateWithQueryTyped { private class CreateInternal extends BaseSearch<ICreateTyped, ICreateWithQueryTyped, MethodOutcome> implements ICreate, ICreateTyped, ICreateWithQuery, ICreateWithQueryTyped {
private boolean myConditional; private boolean myConditional;
private PreferHeader.PreferReturnEnum myPrefer; private PreferReturnEnum myPrefer;
private IBaseResource myResource; private IBaseResource myResource;
private String myResourceBody; private String myResourceBody;
private String mySearchUrl; private String mySearchUrl;
@ -580,7 +580,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
} }
@Override @Override
public ICreateTyped prefer(PreferHeader.PreferReturnEnum theReturn) { public ICreateTyped prefer(PreferReturnEnum theReturn) {
myPrefer = theReturn; myPrefer = theReturn;
return this; return this;
} }
@ -1380,13 +1380,13 @@ public class GenericClient extends BaseClient implements IGenericClient {
} }
private final class OutcomeResponseHandler implements IClientResponseHandler<MethodOutcome> { private final class OutcomeResponseHandler implements IClientResponseHandler<MethodOutcome> {
private PreferHeader.PreferReturnEnum myPrefer; private PreferReturnEnum myPrefer;
private OutcomeResponseHandler() { private OutcomeResponseHandler() {
super(); super();
} }
private OutcomeResponseHandler(PreferHeader.PreferReturnEnum thePrefer) { private OutcomeResponseHandler(PreferReturnEnum thePrefer) {
this(); this();
myPrefer = thePrefer; myPrefer = thePrefer;
} }
@ -1396,7 +1396,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
MethodOutcome response = MethodUtil.process2xxResponse(myContext, theResponseStatusCode, theResponseMimeType, theResponseInputStream, theHeaders); MethodOutcome response = MethodUtil.process2xxResponse(myContext, theResponseStatusCode, theResponseMimeType, theResponseInputStream, theHeaders);
response.setCreatedUsingStatusCode(theResponseStatusCode); response.setCreatedUsingStatusCode(theResponseStatusCode);
if (myPrefer == PreferHeader.PreferReturnEnum.REPRESENTATION) { if (myPrefer == PreferReturnEnum.REPRESENTATION) {
if (response.getResource() == null) { if (response.getResource() == null) {
if (response.getId() != null && isNotBlank(response.getId().getValue()) && response.getId().hasBaseUrl()) { if (response.getId() != null && isNotBlank(response.getId().getValue()) && response.getId().hasBaseUrl()) {
ourLog.info("Server did not return resource for Prefer-representation, going to fetch: {}", response.getId().getValue()); ourLog.info("Server did not return resource for Prefer-representation, going to fetch: {}", response.getId().getValue());
@ -1418,7 +1418,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
private IIdType myId; private IIdType myId;
private String myPatchBody; private String myPatchBody;
private PatchTypeEnum myPatchType; private PatchTypeEnum myPatchType;
private PreferHeader.PreferReturnEnum myPrefer; private PreferReturnEnum myPrefer;
private String myResourceType; private String myResourceType;
private String mySearchUrl; private String mySearchUrl;
@ -1476,7 +1476,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
} }
@Override @Override
public IPatchExecutable prefer(PreferHeader.PreferReturnEnum theReturn) { public IPatchExecutable prefer(PreferReturnEnum theReturn) {
myPrefer = theReturn; myPrefer = theReturn;
return this; return this;
} }
@ -2048,7 +2048,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
private boolean myConditional; private boolean myConditional;
private IIdType myId; private IIdType myId;
private PreferHeader.PreferReturnEnum myPrefer; private PreferReturnEnum myPrefer;
private IBaseResource myResource; private IBaseResource myResource;
private String myResourceBody; private String myResourceBody;
private String mySearchUrl; private String mySearchUrl;
@ -2102,7 +2102,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
} }
@Override @Override
public IUpdateExecutable prefer(PreferHeader.PreferReturnEnum theReturn) { public IUpdateExecutable prefer(PreferReturnEnum theReturn) {
myPrefer = theReturn; myPrefer = theReturn;
return this; return this;
} }
@ -2282,7 +2282,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
params.get(parameterName).add(parameterValue); params.get(parameterName).add(parameterValue);
} }
private static void addPreferHeader(PreferHeader.PreferReturnEnum thePrefer, BaseHttpClientInvocation theInvocation) { private static void addPreferHeader(PreferReturnEnum thePrefer, BaseHttpClientInvocation theInvocation) {
if (thePrefer != null) { if (thePrefer != null) {
theInvocation.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + '=' + thePrefer.getHeaderValue()); theInvocation.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + '=' + thePrefer.getHeaderValue());
} }

View File

@ -112,8 +112,8 @@ public abstract class AbstractJaxRsPageProvider extends AbstractJaxRsProvider im
} }
@Override @Override
public PreferHeader.PreferReturnEnum getDefaultPreferReturn() { public PreferReturnEnum getDefaultPreferReturn() {
return PreferHeader.PreferReturnEnum.REPRESENTATION; return PreferReturnEnum.REPRESENTATION;
} }
} }

View File

@ -370,8 +370,8 @@ implements IRestfulServer<JaxRsRequest>, IResourceProvider {
} }
@Override @Override
public PreferHeader.PreferReturnEnum getDefaultPreferReturn() { public PreferReturnEnum getDefaultPreferReturn() {
return PreferHeader.PreferReturnEnum.REPRESENTATION; return PreferReturnEnum.REPRESENTATION;
} }
/** /**

View File

@ -301,12 +301,12 @@ public class GenericJaxRsClientDstu2Test {
Patient p = new Patient(); Patient p = new Patient();
p.addName().addFamily("FOOFAMILY"); p.addName().addFamily("FOOFAMILY");
client.create().resource(p).prefer(PreferHeader.PreferReturnEnum.MINIMAL).execute(); client.create().resource(p).prefer(PreferReturnEnum.MINIMAL).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());
client.create().resource(p).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); client.create().resource(p).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());
@ -1937,12 +1937,12 @@ public class GenericJaxRsClientDstu2Test {
p.setId(new IdDt("1")); p.setId(new IdDt("1"));
p.addName().addFamily("FOOFAMILY"); p.addName().addFamily("FOOFAMILY");
client.update().resource(p).prefer(PreferHeader.PreferReturnEnum.MINIMAL).execute(); client.update().resource(p).prefer(PreferReturnEnum.MINIMAL).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());
client.update().resource(p).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); client.update().resource(p).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());

View File

@ -321,12 +321,12 @@ public class GenericJaxRsClientDstu3Test {
Patient p = new Patient(); Patient p = new Patient();
p.addName().setFamily("FOOFAMILY"); p.addName().setFamily("FOOFAMILY");
client.create().resource(p).prefer(PreferHeader.PreferReturnEnum.MINIMAL).execute(); client.create().resource(p).prefer(PreferReturnEnum.MINIMAL).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());
client.create().resource(p).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); client.create().resource(p).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());
@ -1990,12 +1990,12 @@ public class GenericJaxRsClientDstu3Test {
p.setId(new IdType("1")); p.setId(new IdType("1"));
p.addName().setFamily("FOOFAMILY"); p.addName().setFamily("FOOFAMILY");
client.update().resource(p).prefer(PreferHeader.PreferReturnEnum.MINIMAL).execute(); client.update().resource(p).prefer(PreferReturnEnum.MINIMAL).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());
client.update().resource(p).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); client.update().resource(p).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size()); assertEquals(1, ourRequestHeaders.get(Constants.HEADER_PREFER).size());
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, ourRequestHeaders.get(Constants.HEADER_PREFER).get(0).getValue());

View File

@ -135,7 +135,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
client.setEncoding(EncodingEnum.JSON); client.setEncoding(EncodingEnum.JSON);
MethodOutcome response = client.create().resource(toCreate).conditional() MethodOutcome response = client.create().resource(toCreate).conditional()
.where(Patient.IDENTIFIER.exactly().identifier("2")).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); .where(Patient.IDENTIFIER.exactly().identifier("2")).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals("myIdentifier", patientCaptor.getValue().getIdentifier().get(0).getValue()); assertEquals("myIdentifier", patientCaptor.getValue().getIdentifier().get(0).getValue());
IBaseResource resource = response.getResource(); IBaseResource resource = response.getResource();
@ -158,7 +158,7 @@ public class AbstractJaxRsResourceProviderDstu3Test {
when(mock.create(patientCaptor.capture(), isNull(String.class))).thenReturn(outcome); when(mock.create(patientCaptor.capture(), isNull(String.class))).thenReturn(outcome);
client.setEncoding(EncodingEnum.JSON); client.setEncoding(EncodingEnum.JSON);
final MethodOutcome response = client.create().resource(toCreate).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION) final MethodOutcome response = client.create().resource(toCreate).prefer(PreferReturnEnum.REPRESENTATION)
.execute(); .execute();
IBaseResource resource = response.getResource(); IBaseResource resource = response.getResource();
compareResultId(1, resource); compareResultId(1, resource);

View File

@ -131,7 +131,7 @@ public class AbstractJaxRsResourceProviderTest {
client.setEncoding(EncodingEnum.JSON); client.setEncoding(EncodingEnum.JSON);
MethodOutcome response = client.create().resource(toCreate).conditional() MethodOutcome response = client.create().resource(toCreate).conditional()
.where(Patient.IDENTIFIER.exactly().identifier("2")).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); .where(Patient.IDENTIFIER.exactly().identifier("2")).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals("myIdentifier", patientCaptor.getValue().getIdentifierFirstRep().getValue()); assertEquals("myIdentifier", patientCaptor.getValue().getIdentifierFirstRep().getValue());
IResource resource = (IResource) response.getResource(); IResource resource = (IResource) response.getResource();
@ -154,7 +154,7 @@ public class AbstractJaxRsResourceProviderTest {
when(mock.create(patientCaptor.capture(), isNull(String.class))).thenReturn(outcome); when(mock.create(patientCaptor.capture(), isNull(String.class))).thenReturn(outcome);
client.setEncoding(EncodingEnum.JSON); client.setEncoding(EncodingEnum.JSON);
final MethodOutcome response = client.create().resource(toCreate).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION) final MethodOutcome response = client.create().resource(toCreate).prefer(PreferReturnEnum.REPRESENTATION)
.execute(); .execute();
IResource resource = (IResource) response.getResource(); IResource resource = (IResource) response.getResource();
compareResultId(1, resource); compareResultId(1, resource);

View File

@ -138,7 +138,7 @@ public class JaxRsPatientProviderDstu3Test {
existing.setId((IdType) null); existing.setId((IdType) null);
existing.getName().add(new HumanName().setFamily("Created Patient 54")); existing.getName().add(new HumanName().setFamily("Created Patient 54"));
client.setEncoding(EncodingEnum.JSON); client.setEncoding(EncodingEnum.JSON);
final MethodOutcome results = client.create().resource(existing).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); final MethodOutcome results = client.create().resource(existing).prefer(PreferReturnEnum.REPRESENTATION).execute();
System.out.println(results.getId()); System.out.println(results.getId());
final Patient patient = (Patient) results.getResource(); final Patient patient = (Patient) results.getResource();
System.out.println(patient); System.out.println(patient);
@ -154,7 +154,7 @@ public class JaxRsPatientProviderDstu3Test {
existing.setId((IdType) null); existing.setId((IdType) null);
existing.getName().add(new HumanName().setFamily("Created Patient 54")); existing.getName().add(new HumanName().setFamily("Created Patient 54"));
client.setEncoding(EncodingEnum.XML); client.setEncoding(EncodingEnum.XML);
final MethodOutcome results = client.create().resource(existing).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); final MethodOutcome results = client.create().resource(existing).prefer(PreferReturnEnum.REPRESENTATION).execute();
System.out.println(results.getId()); System.out.println(results.getId());
final Patient patient = (Patient) results.getResource(); final Patient patient = (Patient) results.getResource();
@ -187,7 +187,7 @@ public class JaxRsPatientProviderDstu3Test {
public void testDeletePatient() { public void testDeletePatient() {
final Patient existing = new Patient(); final Patient existing = new Patient();
existing.getName().add(new HumanName().setFamily("Created Patient XYZ")); existing.getName().add(new HumanName().setFamily("Created Patient XYZ"));
final MethodOutcome results = client.create().resource(existing).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); final MethodOutcome results = client.create().resource(existing).prefer(PreferReturnEnum.REPRESENTATION).execute();
System.out.println(results.getId()); System.out.println(results.getId());
final Patient patient = (Patient) results.getResource(); final Patient patient = (Patient) results.getResource();
client.delete().resourceById(patient.getIdElement()).execute(); client.delete().resourceById(patient.getIdElement()).execute();

View File

@ -5,10 +5,7 @@ import ca.uhn.fhir.jaxrs.client.JaxRsRestfulClientFactory;
import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum; import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum;
import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.*;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.PreferHeader;
import ca.uhn.fhir.rest.api.SearchStyleEnum;
import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
@ -152,7 +149,7 @@ public class JaxRsPatientProviderR4Test {
existing.setId((IdDt) null); existing.setId((IdDt) null);
existing.getNameFirstRep().setFamily("Created Patient 54"); existing.getNameFirstRep().setFamily("Created Patient 54");
client.setEncoding(EncodingEnum.JSON); client.setEncoding(EncodingEnum.JSON);
final MethodOutcome results = client.create().resource(existing).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); final MethodOutcome results = client.create().resource(existing).prefer(PreferReturnEnum.REPRESENTATION).execute();
System.out.println(results.getId()); System.out.println(results.getId());
final Patient patient = (Patient) results.getResource(); final Patient patient = (Patient) results.getResource();
System.out.println(patient); System.out.println(patient);
@ -167,7 +164,7 @@ public class JaxRsPatientProviderR4Test {
existing.setId((IdDt) null); existing.setId((IdDt) null);
existing.getNameFirstRep().setFamily("Created Patient 54"); existing.getNameFirstRep().setFamily("Created Patient 54");
client.setEncoding(EncodingEnum.XML); client.setEncoding(EncodingEnum.XML);
final MethodOutcome results = client.create().resource(existing).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); final MethodOutcome results = client.create().resource(existing).prefer(PreferReturnEnum.REPRESENTATION).execute();
System.out.println(results.getId()); System.out.println(results.getId());
final Patient patient = (Patient) results.getResource(); final Patient patient = (Patient) results.getResource();
@ -199,7 +196,7 @@ public class JaxRsPatientProviderR4Test {
public void testDeletePatient() { public void testDeletePatient() {
final Patient existing = new Patient(); final Patient existing = new Patient();
existing.getNameFirstRep().setFamily("Created Patient XYZ"); existing.getNameFirstRep().setFamily("Created Patient XYZ");
final MethodOutcome results = client.create().resource(existing).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); final MethodOutcome results = client.create().resource(existing).prefer(PreferReturnEnum.REPRESENTATION).execute();
System.out.println(results.getId()); System.out.println(results.getId());
final Patient patient = (Patient) results.getResource(); final Patient patient = (Patient) results.getResource();
client.delete().resource(patient).execute(); client.delete().resource(patient).execute();

View File

@ -149,7 +149,7 @@ public class JaxRsPatientProviderTest {
existing.setId((IdDt) null); existing.setId((IdDt) null);
existing.getNameFirstRep().addFamily("Created Patient 54"); existing.getNameFirstRep().addFamily("Created Patient 54");
client.setEncoding(EncodingEnum.JSON); client.setEncoding(EncodingEnum.JSON);
final MethodOutcome results = client.create().resource(existing).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); final MethodOutcome results = client.create().resource(existing).prefer(PreferReturnEnum.REPRESENTATION).execute();
System.out.println(results.getId()); System.out.println(results.getId());
final Patient patient = (Patient) results.getResource(); final Patient patient = (Patient) results.getResource();
System.out.println(patient); System.out.println(patient);
@ -164,7 +164,7 @@ public class JaxRsPatientProviderTest {
existing.setId((IdDt) null); existing.setId((IdDt) null);
existing.getNameFirstRep().addFamily("Created Patient 54"); existing.getNameFirstRep().addFamily("Created Patient 54");
client.setEncoding(EncodingEnum.XML); client.setEncoding(EncodingEnum.XML);
final MethodOutcome results = client.create().resource(existing).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); final MethodOutcome results = client.create().resource(existing).prefer(PreferReturnEnum.REPRESENTATION).execute();
System.out.println(results.getId()); System.out.println(results.getId());
final Patient patient = (Patient) results.getResource(); final Patient patient = (Patient) results.getResource();
@ -196,7 +196,7 @@ public class JaxRsPatientProviderTest {
public void testDeletePatient() { public void testDeletePatient() {
final Patient existing = new Patient(); final Patient existing = new Patient();
existing.getNameFirstRep().addFamily("Created Patient XYZ"); existing.getNameFirstRep().addFamily("Created Patient XYZ");
final MethodOutcome results = client.create().resource(existing).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); final MethodOutcome results = client.create().resource(existing).prefer(PreferReturnEnum.REPRESENTATION).execute();
System.out.println(results.getId()); System.out.println(results.getId());
final Patient patient = (Patient) results.getResource(); final Patient patient = (Patient) results.getResource();
client.delete().resourceById(patient.getId()).execute(); client.delete().resourceById(patient.getId()).execute();

View File

@ -64,7 +64,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate; import org.springframework.transaction.support.TransactionTemplate;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
@ -185,9 +184,9 @@ public class TransactionProcessor<BUNDLE extends IBaseBundle, BUNDLEENTRY> {
if (theRequestDetails != null) { if (theRequestDetails != null) {
if (outcome.getResource() != null) { if (outcome.getResource() != null) {
String prefer = theRequestDetails.getHeader(Constants.HEADER_PREFER); String prefer = theRequestDetails.getHeader(Constants.HEADER_PREFER);
PreferHeader.PreferReturnEnum preferReturn = RestfulServerUtils.parsePreferHeader(null, prefer).getReturn(); PreferReturnEnum preferReturn = RestfulServerUtils.parsePreferHeader(null, prefer).getReturn();
if (preferReturn != null) { if (preferReturn != null) {
if (preferReturn == PreferHeader.PreferReturnEnum.REPRESENTATION) { if (preferReturn == PreferReturnEnum.REPRESENTATION) {
outcome.fireResourceViewCallbacks(); outcome.fireResourceViewCallbacks();
myVersionAdapter.setResource(newEntry, outcome.getResource()); myVersionAdapter.setResource(newEntry, outcome.getResource());
} }

View File

@ -4,7 +4,7 @@ import ca.uhn.fhir.jpa.config.BaseConfig;
import ca.uhn.fhir.jpa.config.TestR4Config; import ca.uhn.fhir.jpa.config.TestR4Config;
import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.PreferHeader; import ca.uhn.fhir.rest.api.PreferReturnEnum;
import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.client.interceptor.CapturingInterceptor; import ca.uhn.fhir.rest.client.interceptor.CapturingInterceptor;
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException; import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
@ -349,7 +349,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
Patient patient = new Patient(); Patient patient = new Patient();
patient.setActive(true); patient.setActive(true);
IIdType id = ourClient.create().resource(patient).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute().getId().toUnqualifiedVersionless(); IIdType id = ourClient.create().resource(patient).prefer(PreferReturnEnum.REPRESENTATION).execute().getId().toUnqualifiedVersionless();
DelegatingConsentService consentService = new DelegatingConsentService(); DelegatingConsentService consentService = new DelegatingConsentService();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL); myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);

View File

@ -683,7 +683,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
.create() .create()
.resource(p) .resource(p)
.conditionalByUrl("Patient?identifier=foo|bar") .conditionalByUrl("Patient?identifier=foo|bar")
.prefer(PreferHeader.PreferReturnEnum.REPRESENTATION) .prefer(PreferReturnEnum.REPRESENTATION)
.execute(); .execute();
assertEquals(id.getIdPart(), outcome.getId().getIdPart()); assertEquals(id.getIdPart(), outcome.getId().getIdPart());

View File

@ -1,7 +1,7 @@
package ca.uhn.fhir.rest.api.server; package ca.uhn.fhir.rest.api.server;
import ca.uhn.fhir.context.api.BundleInclusionRule; import ca.uhn.fhir.context.api.BundleInclusionRule;
import ca.uhn.fhir.rest.api.PreferHeader; import ca.uhn.fhir.rest.api.PreferReturnEnum;
import ca.uhn.fhir.rest.server.IPagingProvider; import ca.uhn.fhir.rest.server.IPagingProvider;
import ca.uhn.fhir.rest.server.IRestfulServerDefaults; import ca.uhn.fhir.rest.server.IRestfulServerDefaults;
@ -31,6 +31,6 @@ public interface IRestfulServer<T extends RequestDetails> extends IRestfulServer
BundleInclusionRule getBundleInclusionRule(); BundleInclusionRule getBundleInclusionRule();
PreferHeader.PreferReturnEnum getDefaultPreferReturn(); PreferReturnEnum getDefaultPreferReturn();
} }

View File

@ -98,9 +98,9 @@ public class RestfulServer extends HttpServlet implements IRestfulServer<Servlet
*/ */
public static final String SERVLET_CONTEXT_ATTRIBUTE = "ca.uhn.fhir.rest.server.RestfulServer.servlet_context"; public static final String SERVLET_CONTEXT_ATTRIBUTE = "ca.uhn.fhir.rest.server.RestfulServer.servlet_context";
/** /**
* Default value for {@link #setDefaultPreferReturn(PreferHeader.PreferReturnEnum)} * Default value for {@link #setDefaultPreferReturn(PreferReturnEnum)}
*/ */
public static final PreferHeader.PreferReturnEnum DEFAULT_PREFER_RETURN = PreferHeader.PreferReturnEnum.REPRESENTATION; public static final PreferReturnEnum DEFAULT_PREFER_RETURN = PreferReturnEnum.REPRESENTATION;
private static final ExceptionHandlingInterceptor DEFAULT_EXCEPTION_HANDLER = new ExceptionHandlingInterceptor(); private static final ExceptionHandlingInterceptor DEFAULT_EXCEPTION_HANDLER = new ExceptionHandlingInterceptor();
private static final Logger ourLog = LoggerFactory.getLogger(RestfulServer.class); private static final Logger ourLog = LoggerFactory.getLogger(RestfulServer.class);
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -131,7 +131,7 @@ public class RestfulServer extends HttpServlet implements IRestfulServer<Servlet
private boolean myStarted; private boolean myStarted;
private boolean myUncompressIncomingContents = true; private boolean myUncompressIncomingContents = true;
private ITenantIdentificationStrategy myTenantIdentificationStrategy; private ITenantIdentificationStrategy myTenantIdentificationStrategy;
private PreferHeader.PreferReturnEnum myDefaultPreferReturn = DEFAULT_PREFER_RETURN; private PreferReturnEnum myDefaultPreferReturn = DEFAULT_PREFER_RETURN;
private ElementsSupportEnum myElementsSupport = ElementsSupportEnum.EXTENDED; private ElementsSupportEnum myElementsSupport = ElementsSupportEnum.EXTENDED;
/** /**
@ -1770,13 +1770,13 @@ public class RestfulServer extends HttpServlet implements IRestfulServer<Servlet
* <code>Prefer</code> header. * <code>Prefer</code> header.
* <p> * <p>
* This setting changes the default behaviour if no Prefer header is supplied by the client. * This setting changes the default behaviour if no Prefer header is supplied by the client.
* The default is {@link PreferHeader.PreferReturnEnum#REPRESENTATION} * The default is {@link PreferReturnEnum#REPRESENTATION}
* </p> * </p>
* *
* @see <a href="http://hl7.org/fhir/http.html#ops">HL7 FHIR Specification</a> section on the Prefer header * @see <a href="http://hl7.org/fhir/http.html#ops">HL7 FHIR Specification</a> section on the Prefer header
*/ */
@Override @Override
public PreferHeader.PreferReturnEnum getDefaultPreferReturn() { public PreferReturnEnum getDefaultPreferReturn() {
return myDefaultPreferReturn; return myDefaultPreferReturn;
} }
@ -1786,12 +1786,12 @@ public class RestfulServer extends HttpServlet implements IRestfulServer<Servlet
* <code>Prefer</code> header. * <code>Prefer</code> header.
* <p> * <p>
* This setting changes the default behaviour if no Prefer header is supplied by the client. * This setting changes the default behaviour if no Prefer header is supplied by the client.
* The default is {@link PreferHeader.PreferReturnEnum#REPRESENTATION} * The default is {@link PreferReturnEnum#REPRESENTATION}
* </p> * </p>
* *
* @see <a href="http://hl7.org/fhir/http.html#ops">HL7 FHIR Specification</a> section on the Prefer header * @see <a href="http://hl7.org/fhir/http.html#ops">HL7 FHIR Specification</a> section on the Prefer header
*/ */
public void setDefaultPreferReturn(PreferHeader.PreferReturnEnum theDefaultPreferReturn) { public void setDefaultPreferReturn(PreferReturnEnum theDefaultPreferReturn) {
Validate.notNull(theDefaultPreferReturn, "theDefaultPreferReturn must not be null"); Validate.notNull(theDefaultPreferReturn, "theDefaultPreferReturn must not be null");
myDefaultPreferReturn = theDefaultPreferReturn; myDefaultPreferReturn = theDefaultPreferReturn;
} }

View File

@ -704,7 +704,7 @@ public class RestfulServerUtils {
value = value.substring(1, value.length() - 1); value = value.substring(1, value.length() - 1);
} }
retVal.setReturn(PreferHeader.PreferReturnEnum.fromHeaderValue(value)); retVal.setReturn(PreferReturnEnum.fromHeaderValue(value));
} else if (key.equals(Constants.HEADER_PREFER_RESPOND_ASYNC)) { } else if (key.equals(Constants.HEADER_PREFER_RESPOND_ASYNC)) {

View File

@ -184,8 +184,8 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
if (allowPrefer) { if (allowPrefer) {
String prefer = theRequest.getHeader(Constants.HEADER_PREFER); String prefer = theRequest.getHeader(Constants.HEADER_PREFER);
PreferHeader preferReturn = RestfulServerUtils.parsePreferHeader(theServer, prefer); PreferHeader preferReturn = RestfulServerUtils.parsePreferHeader(theServer, prefer);
PreferHeader.PreferReturnEnum returnEnum = preferReturn.getReturn(); PreferReturnEnum returnEnum = preferReturn.getReturn();
returnEnum = defaultIfNull(returnEnum, PreferHeader.PreferReturnEnum.REPRESENTATION); returnEnum = defaultIfNull(returnEnum, PreferReturnEnum.REPRESENTATION);
switch (returnEnum) { switch (returnEnum) {
case REPRESENTATION: case REPRESENTATION:

View File

@ -1,6 +1,7 @@
package ca.uhn.fhir.rest.server; package ca.uhn.fhir.rest.server;
import ca.uhn.fhir.rest.api.PreferHeader; import ca.uhn.fhir.rest.api.PreferHeader;
import ca.uhn.fhir.rest.api.PreferReturnEnum;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -10,14 +11,14 @@ public class RestfulServerUtilsTest{
@Test @Test
public void testParsePreferReturn() { public void testParsePreferReturn() {
PreferHeader header = RestfulServerUtils.parsePreferHeader(null,"return=representation"); PreferHeader header = RestfulServerUtils.parsePreferHeader(null,"return=representation");
assertEquals(PreferHeader.PreferReturnEnum.REPRESENTATION, header.getReturn()); assertEquals(PreferReturnEnum.REPRESENTATION, header.getReturn());
assertFalse(header.getRespondAsync()); assertFalse(header.getRespondAsync());
} }
@Test @Test
public void testParsePreferReturnAndAsync() { public void testParsePreferReturnAndAsync() {
PreferHeader header = RestfulServerUtils.parsePreferHeader(null,"return=OperationOutcome; respond-async"); PreferHeader header = RestfulServerUtils.parsePreferHeader(null,"return=OperationOutcome; respond-async");
assertEquals(PreferHeader.PreferReturnEnum.OPERATION_OUTCOME, header.getReturn()); assertEquals(PreferReturnEnum.OPERATION_OUTCOME, header.getReturn());
assertTrue(header.getRespondAsync()); assertTrue(header.getRespondAsync());
} }

View File

@ -557,7 +557,7 @@ public class GenericClientDstu2_1Test {
Patient pt = new Patient(); Patient pt = new Patient();
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.create().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.create().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(2, myAnswerCount); assertEquals(2, myAnswerCount);
assertNotNull(outcome.getOperationOutcome()); assertNotNull(outcome.getOperationOutcome());
@ -603,7 +603,7 @@ public class GenericClientDstu2_1Test {
Patient pt = new Patient(); Patient pt = new Patient();
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.create().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.create().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, myAnswerCount); assertEquals(1, myAnswerCount);
assertNull(outcome.getOperationOutcome()); assertNull(outcome.getOperationOutcome());
@ -1029,7 +1029,7 @@ public class GenericClientDstu2_1Test {
client client
.update() .update()
.resource(bundle) .resource(bundle)
.prefer(PreferHeader.PreferReturnEnum.REPRESENTATION) .prefer(PreferReturnEnum.REPRESENTATION)
.encodedJson() .encodedJson()
.execute(); .execute();
@ -1074,7 +1074,7 @@ public class GenericClientDstu2_1Test {
client client
.update() .update()
.resource(bundle) .resource(bundle)
.prefer(PreferHeader.PreferReturnEnum.REPRESENTATION) .prefer(PreferReturnEnum.REPRESENTATION)
.encodedXml() .encodedXml()
.execute(); .execute();
@ -1713,7 +1713,7 @@ public class GenericClientDstu2_1Test {
pt.setId("Patient/222"); pt.setId("Patient/222");
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.update().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.update().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(2, myAnswerCount); assertEquals(2, myAnswerCount);
assertNotNull(outcome.getOperationOutcome()); assertNotNull(outcome.getOperationOutcome());
@ -1758,7 +1758,7 @@ public class GenericClientDstu2_1Test {
pt.setId("Patient/222"); pt.setId("Patient/222");
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.update().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.update().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, myAnswerCount); assertEquals(1, myAnswerCount);
assertNull(outcome.getOperationOutcome()); assertNull(outcome.getOperationOutcome());

View File

@ -416,12 +416,12 @@ public class GenericClientDstu2Test {
Patient p = new Patient(); Patient p = new Patient();
p.addName().addFamily("FOOFAMILY"); p.addName().addFamily("FOOFAMILY");
client.create().resource(p).prefer(PreferHeader.PreferReturnEnum.MINIMAL).execute(); client.create().resource(p).prefer(PreferReturnEnum.MINIMAL).execute();
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER).length); assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER).length);
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER)[0].getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER)[0].getValue());
idx++; idx++;
client.create().resource(p).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); client.create().resource(p).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER).length); assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER).length);
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER)[0].getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER)[0].getValue());
idx++; idx++;
@ -2475,12 +2475,12 @@ public class GenericClientDstu2Test {
p.setId(new IdDt("1")); p.setId(new IdDt("1"));
p.addName().addFamily("FOOFAMILY"); p.addName().addFamily("FOOFAMILY");
client.update().resource(p).prefer(PreferHeader.PreferReturnEnum.MINIMAL).execute(); client.update().resource(p).prefer(PreferReturnEnum.MINIMAL).execute();
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER).length); assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER).length);
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER)[0].getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_MINIMAL, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER)[0].getValue());
idx++; idx++;
client.update().resource(p).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); client.update().resource(p).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER).length); assertEquals(1, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER).length);
assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER)[0].getValue()); assertEquals(Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION, capt.getAllValues().get(idx).getHeaders(Constants.HEADER_PREFER)[0].getValue());
idx++; idx++;

View File

@ -544,7 +544,7 @@ public class GenericClientDstu3Test {
Patient pt = new Patient(); Patient pt = new Patient();
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.create().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.create().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(2, myAnswerCount); assertEquals(2, myAnswerCount);
assertNotNull(outcome.getOperationOutcome()); assertNotNull(outcome.getOperationOutcome());
@ -590,7 +590,7 @@ public class GenericClientDstu3Test {
Patient pt = new Patient(); Patient pt = new Patient();
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.create().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.create().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, myAnswerCount); assertEquals(1, myAnswerCount);
assertNull(outcome.getOperationOutcome()); assertNull(outcome.getOperationOutcome());
@ -965,7 +965,7 @@ public class GenericClientDstu3Test {
client client
.update() .update()
.resource(bundle) .resource(bundle)
.prefer(PreferHeader.PreferReturnEnum.REPRESENTATION) .prefer(PreferReturnEnum.REPRESENTATION)
.encodedJson() .encodedJson()
.execute(); .execute();
@ -1010,7 +1010,7 @@ public class GenericClientDstu3Test {
client client
.update() .update()
.resource(bundle) .resource(bundle)
.prefer(PreferHeader.PreferReturnEnum.REPRESENTATION) .prefer(PreferReturnEnum.REPRESENTATION)
.encodedXml() .encodedXml()
.execute(); .execute();
@ -1679,7 +1679,7 @@ public class GenericClientDstu3Test {
pt.setId("Patient/222"); pt.setId("Patient/222");
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.update().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.update().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(2, myAnswerCount); assertEquals(2, myAnswerCount);
assertNotNull(outcome.getOperationOutcome()); assertNotNull(outcome.getOperationOutcome());
@ -1724,7 +1724,7 @@ public class GenericClientDstu3Test {
pt.setId("Patient/222"); pt.setId("Patient/222");
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.update().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.update().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, myAnswerCount); assertEquals(1, myAnswerCount);
assertNull(outcome.getOperationOutcome()); assertNull(outcome.getOperationOutcome());

View File

@ -342,7 +342,7 @@ public class GenericClientR4Test {
Patient pt = new Patient(); Patient pt = new Patient();
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.create().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.create().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(2, myAnswerCount); assertEquals(2, myAnswerCount);
assertNotNull(outcome.getOperationOutcome()); assertNotNull(outcome.getOperationOutcome());
@ -388,7 +388,7 @@ public class GenericClientR4Test {
Patient pt = new Patient(); Patient pt = new Patient();
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.create().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.create().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, myAnswerCount); assertEquals(1, myAnswerCount);
assertNull(outcome.getOperationOutcome()); assertNull(outcome.getOperationOutcome());
@ -1296,7 +1296,7 @@ public class GenericClientR4Test {
client client
.update() .update()
.resource(bundle) .resource(bundle)
.prefer(PreferHeader.PreferReturnEnum.REPRESENTATION) .prefer(PreferReturnEnum.REPRESENTATION)
.encodedJson() .encodedJson()
.execute(); .execute();
@ -1341,7 +1341,7 @@ public class GenericClientR4Test {
client client
.update() .update()
.resource(bundle) .resource(bundle)
.prefer(PreferHeader.PreferReturnEnum.REPRESENTATION) .prefer(PreferReturnEnum.REPRESENTATION)
.encodedXml() .encodedXml()
.execute(); .execute();
@ -2153,7 +2153,7 @@ public class GenericClientR4Test {
pt.setId("Patient/222"); pt.setId("Patient/222");
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.update().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.update().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(2, myAnswerCount); assertEquals(2, myAnswerCount);
assertNotNull(outcome.getOperationOutcome()); assertNotNull(outcome.getOperationOutcome());
@ -2198,7 +2198,7 @@ public class GenericClientR4Test {
pt.setId("Patient/222"); pt.setId("Patient/222");
pt.getText().setDivAsString("A PATIENT"); pt.getText().setDivAsString("A PATIENT");
MethodOutcome outcome = client.update().resource(pt).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome outcome = client.update().resource(pt).prefer(PreferReturnEnum.REPRESENTATION).execute();
assertEquals(1, myAnswerCount); assertEquals(1, myAnswerCount);
assertNull(outcome.getOperationOutcome()); assertNull(outcome.getOperationOutcome());

View File

@ -4,7 +4,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.annotation.*; import ca.uhn.fhir.rest.annotation.*;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.PreferHeader; import ca.uhn.fhir.rest.api.PreferReturnEnum;
import ca.uhn.fhir.rest.client.MyPatientWithExtensions; import ca.uhn.fhir.rest.client.MyPatientWithExtensions;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
@ -268,7 +268,7 @@ public class CreateR4Test {
HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient"); HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient");
httpPost.setEntity(new StringEntity(body, ContentType.parse("application/fhir+json; charset=utf-8"))); httpPost.setEntity(new StringEntity(body, ContentType.parse("application/fhir+json; charset=utf-8")));
ourServlet.setDefaultPreferReturn(PreferHeader.PreferReturnEnum.OPERATION_OUTCOME); ourServlet.setDefaultPreferReturn(PreferReturnEnum.OPERATION_OUTCOME);
try (CloseableHttpResponse status = ourClient.execute(httpPost)) { try (CloseableHttpResponse status = ourClient.execute(httpPost)) {
assertEquals(201, status.getStatusLine().getStatusCode()); assertEquals(201, status.getStatusLine().getStatusCode());
@ -293,7 +293,7 @@ public class CreateR4Test {
HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient"); HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient");
httpPost.setEntity(new StringEntity(body, ContentType.parse("application/fhir+json; charset=utf-8"))); httpPost.setEntity(new StringEntity(body, ContentType.parse("application/fhir+json; charset=utf-8")));
ourServlet.setDefaultPreferReturn(PreferHeader.PreferReturnEnum.MINIMAL); ourServlet.setDefaultPreferReturn(PreferReturnEnum.MINIMAL);
try (CloseableHttpResponse status = ourClient.execute(httpPost)) { try (CloseableHttpResponse status = ourClient.execute(httpPost)) {
assertEquals(201, status.getStatusLine().getStatusCode()); assertEquals(201, status.getStatusLine().getStatusCode());

View File

@ -73,7 +73,7 @@
<div class="col-sm-3 form-group"> <div class="col-sm-3 form-group">
<a type="button" id="fetch-conformance-btn" <a type="button" id="fetch-conformance-btn"
class="btn btn-primary btn-block"> class="btn btn-primary btn-block">
<span class="fa fa-dot-circle-o"></i> <i class="far fa-dot-circle"></i>
Conformance Conformance
</a> </a>
<script type="text/javascript"> <script type="text/javascript">
@ -97,7 +97,7 @@
<div class="col-sm-3"> <div class="col-sm-3">
<button type="button" id="server-history-btn" <button type="button" id="server-history-btn"
class="btn btn-primary btn-block"> class="btn btn-primary btn-block">
<span class="fa fa-calendar"></i> <i class="far fa-calendar-alt"></i>
History History
</button> </button>
</div> </div>
@ -156,7 +156,7 @@
<div class="row-fluid"> <div class="row-fluid">
<div class="col-sm-3"> <div class="col-sm-3">
<button type="button" id="transaction-btn" class="btn btn-primary btn-block"> <button type="button" id="transaction-btn" class="btn btn-primary btn-block">
<span class="fa fa-files-o"></i> <i class="fas fa-file-archive"></i>
Transaction Transaction
</button> </button>
</div> </div>

View File

@ -130,7 +130,7 @@
<h4 class="panel-title"> <h4 class="panel-title">
<th:block th:if="${#lists.isEmpty(bundle.entries)}">Bundle contains no entries</th:block> <th:block th:if="${#lists.isEmpty(bundle.entries)}">Bundle contains no entries</th:block>
<a th:unless="${#lists.isEmpty(bundle.entries)}" data-toggle="collapse" data-parent="#accordion" href="#collapseOne"> <a th:unless="${#lists.isEmpty(bundle.entries)}" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
<i id="collapseOneIcon" class="fa fa-minus-square-o"></i> <i id="collapseOneIcon" class="far fa-minus-square"></i>
<span th:if="${bundle.totalResults.empty}" th:text="'Bundle contains ' + ${#lists.size(bundle.entries)} + ' entries'"/> <span th:if="${bundle.totalResults.empty}" th:text="'Bundle contains ' + ${#lists.size(bundle.entries)} + ' entries'"/>
<span th:unless="${bundle.totalResults.empty}" th:text="'Bundle contains ' + ${#lists.size(bundle.entries)} + ' / ' + ${bundle.totalResults.value} + ' entries'"/> <span th:unless="${bundle.totalResults.empty}" th:text="'Bundle contains ' + ${#lists.size(bundle.entries)} + ' / ' + ${bundle.totalResults.value} + ' entries'"/>
</a> </a>
@ -195,8 +195,8 @@
<tr th:each="entry : ${bundle.entries}"> <tr th:each="entry : ${bundle.entries}">
<td style="white-space: nowrap;"> <td style="white-space: nowrap;">
<th:block th:if="${entry.resource} != null"> <th:block th:if="${entry.resource} != null">
<button class="btn btn-primary btn-xs" th:data1="${entry.resource.id.resourceType}" th:data2="${entry.resource.id.idPart}" th:data3="${#strings.defaultString(entry.resource.id.versionIdPart,'')}" onclick="readFromEntriesTable(this, this.getAttribute('data1'), this.getAttribute('data2'), this.getAttribute('data3'));" type="submit" name="action" value="read"><i class="fa fa-book"></i> Read</button> <button class="btn btn-primary btn-xs" th:data1="${entry.resource.id.resourceType}" th:data2="${entry.resource.id.idPart}" th:data3="${#strings.defaultString(entry.resource.id.versionIdPart,'')}" onclick="readFromEntriesTable(this, this.getAttribute('data1'), this.getAttribute('data2'), this.getAttribute('data3'));" type="submit" name="action" value="read"><i class="fas fa-book"></i> Read</button>
<button class="btn btn-primary btn-xs" th:data1="${entry.resource.id.resourceType}" th:data2="${entry.resource.id.idPart}" th:data3="${#strings.defaultString(entry.resource.id.versionIdPart,'')}" onclick="updateFromEntriesTable(this, this.getAttribute('data1'), this.getAttribute('data2'), this.getAttribute('data3'));" type="submit" name="action" value="home"><i class="fa fa-pencil"></i> Update</button> <button class="btn btn-primary btn-xs" th:data1="${entry.resource.id.resourceType}" th:data2="${entry.resource.id.idPart}" th:data3="${#strings.defaultString(entry.resource.id.versionIdPart,'')}" onclick="updateFromEntriesTable(this, this.getAttribute('data1'), this.getAttribute('data2'), this.getAttribute('data3'));" type="submit" name="action" value="home"><i class="far fa-edit"></i> Update</button>
</th:block> </th:block>
</td> </td>
<td> <td>
@ -214,13 +214,15 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
/*
$('#collapseOne').on('hidden.bs.collapse', function () { $('#collapseOne').on('hidden.bs.collapse', function () {
$("#collapseOneIcon").removeClass("fa-minus-square-o").addClass("fa-plus-square-o"); $("#collapseOneIcon").removeClass("fa-minus-square").addClass("fa-plus-square");
}); });
$('#collapseOne').on('shown.bs.collapse', function () { $('#collapseOne').on('shown.bs.collapse', function () {
$("#collapseOneIcon").removeClass("fa-plus-square-o").addClass("fa-minus-square-o"); $("#collapseOneIcon").removeClass("fa-plus-square").addClass("fa-minus-square");
}); });
*/
</script> </script>
</div> </div>
</div> </div>
@ -240,7 +242,7 @@
<h4 class="panel-title"> <h4 class="panel-title">
<th:block th:if="${#lists.isEmpty(riBundle.entry)}">Bundle contains no entries</th:block> <th:block th:if="${#lists.isEmpty(riBundle.entry)}">Bundle contains no entries</th:block>
<a th:unless="${#lists.isEmpty(riBundle.entry)}" data-toggle="collapse" data-parent="#accordion" href="#collapseOne"> <a th:unless="${#lists.isEmpty(riBundle.entry)}" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
<i id="collapseOneIcon" class="fa fa-minus-square-o"></i> <i id="collapseOneIcon" class="far fa-minus-square"></i>
<span th:if="${riBundle.totalElement.empty}" th:text="'Bundle contains ' + ${#lists.size(riBundle.entry)} + ' entries'"/> <span th:if="${riBundle.totalElement.empty}" th:text="'Bundle contains ' + ${#lists.size(riBundle.entry)} + ' entries'"/>
<span th:unless="${riBundle.totalElement.empty}" th:text="'Bundle contains ' + ${#lists.size(riBundle.entry)} + ' / ' + ${riBundle.totalElement.value} + ' entries'"/> <span th:unless="${riBundle.totalElement.empty}" th:text="'Bundle contains ' + ${#lists.size(riBundle.entry)} + ' / ' + ${riBundle.totalElement.value} + ' entries'"/>
</a> </a>
@ -307,8 +309,8 @@
<tr th:each="entry : ${riBundle.entry}"> <tr th:each="entry : ${riBundle.entry}">
<td style="white-space: nowrap;"> <td style="white-space: nowrap;">
<th:block th:if="${entry.resource} != null"> <th:block th:if="${entry.resource} != null">
<button class="btn btn-primary btn-xs" th:data1="${entry.resource.idElement.resourceType}" th:data2="${entry.resource.idElement.idPart}" th:data3="${#strings.defaultString(entry.resource.idElement.versionIdPart,'')}" onclick="readFromEntriesTable(this, this.getAttribute('data1'), this.getAttribute('data2'), this.getAttribute('data3'));" type="submit" name="action" value="read"><i class="fa fa-book"></i> Read</button> <button class="btn btn-primary btn-xs" th:data1="${entry.resource.idElement.resourceType}" th:data2="${entry.resource.idElement.idPart}" th:data3="${#strings.defaultString(entry.resource.idElement.versionIdPart,'')}" onclick="readFromEntriesTable(this, this.getAttribute('data1'), this.getAttribute('data2'), this.getAttribute('data3'));" type="submit" name="action" value="read"><i class="fas fa-book"></i> Read</button>
<button class="btn btn-primary btn-xs" th:data1="${entry.resource.idElement.resourceType}" th:data2="${entry.resource.idElement.idPart}" th:data3="${#strings.defaultString(entry.resource.idElement.versionIdPart,'')}" onclick="updateFromEntriesTable(this, this.getAttribute('data1'), this.getAttribute('data2'), this.getAttribute('data3'));" type="submit" name="action" value="home"><i class="fa fa-pencil"></i> Update</button> <button class="btn btn-primary btn-xs" th:data1="${entry.resource.idElement.resourceType}" th:data2="${entry.resource.idElement.idPart}" th:data3="${#strings.defaultString(entry.resource.idElement.versionIdPart,'')}" onclick="updateFromEntriesTable(this, this.getAttribute('data1'), this.getAttribute('data2'), this.getAttribute('data3'));" type="submit" name="action" value="home"><i class="far fa-edit"></i> Update</button>
</th:block> </th:block>
</td> </td>
<td> <td>
@ -328,13 +330,15 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
/*
$('#collapseOne').on('hidden.bs.collapse', function () { $('#collapseOne').on('hidden.bs.collapse', function () {
$("#collapseOneIcon").removeClass("fa-minus-square-o").addClass("fa-plus-square-o"); $("#collapseOneIcon").removeClass("fa-minus-square").addClass("fa-plus-square");
}); });
$('#collapseOne').on('shown.bs.collapse', function () { $('#collapseOne').on('shown.bs.collapse', function () {
$("#collapseOneIcon").removeClass("fa-plus-square-o").addClass("fa-minus-square-o"); $("#collapseOneIcon").removeClass("fa-plus-square").addClass("fa-minus-square");
}); });
*/
</script> </script>
</div> </div>
</div> </div>

View File

@ -1,4 +1,4 @@
<ul th:fragment="farright"> <ul th:fragment="farright">
<li><a href="https://github.com/jamesagnew/hapi-fhir"><span class="fa fa-book-open topbarIcon"></span>&nbsp;Source Code</a></li> <li><a href="https://github.com/jamesagnew/hapi-fhir"><i class="fab fa-github topbarIcon"></i></span>&nbsp;Source Code</a></li>
<li><a href="about"><span class="fa fa-question-circle topbarIcon"></span>&nbsp;About This Server</a></li> <li><a href="about"><span class="fa fa-question-circle topbarIcon"></span>&nbsp;About This Server</a></li>
</ul> </ul>

View File

@ -1,5 +1,6 @@
package ca.uhn.fhir.jpa.test; package ca.uhn.fhir.jpa.test;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -26,6 +27,8 @@ import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.TokenOrListParam; import ca.uhn.fhir.rest.param.TokenOrListParam;
import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.IResourceProvider;
import javax.annotation.Nonnull;
public class OverlayTestApp { public class OverlayTestApp {
private static AnnotationConfigApplicationContext ourAppCtx; private static AnnotationConfigApplicationContext ourAppCtx;
@ -156,14 +159,37 @@ public class OverlayTestApp {
@Search @Search
public List<DiagnosticReport> findDiagnosticReportsByPatient(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_CODE) TokenOrListParam theNames, public List<DiagnosticReport> findDiagnosticReportsByPatient(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_CODE) TokenOrListParam theNames,
@OptionalParam(name = DiagnosticReport.SP_DATE) DateRangeParam theDateRange, @IncludeParam(allow = { "DiagnosticReport.result" }) Set<Include> theIncludes) throws Exception { @OptionalParam(name = DiagnosticReport.SP_DATE) DateRangeParam theDateRange, @IncludeParam(allow = { "DiagnosticReport.result" }) Set<Include> theIncludes) throws Exception {
return null; return getDiagnosticReports();
} }
@Description(shortDefinition = "This is a query by issued.. blah blah foo bar blah blah") @Description(shortDefinition = "This is a query by issued.. blah blah foo bar blah blah")
@Search @Search
public List<DiagnosticReport> findDiagnosticReportsByPatientIssued(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_CODE) TokenOrListParam theNames, public List<DiagnosticReport> findDiagnosticReportsByPatientIssued(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_CODE) TokenOrListParam theNames,
@OptionalParam(name = DiagnosticReport.SP_ISSUED) DateRangeParam theDateRange, @IncludeParam(allow = { "DiagnosticReport.result" }) Set<Include> theIncludes) throws Exception { @OptionalParam(name = DiagnosticReport.SP_ISSUED) DateRangeParam theDateRange, @IncludeParam(allow = { "DiagnosticReport.result" }) Set<Include> theIncludes) throws Exception {
return null; return getDiagnosticReports();
}
@Description(shortDefinition = "This is a query by issued.. blah blah foo bar blah blah")
@Search
public List<DiagnosticReport> findDiagnosticReportsByPatientIssued() throws Exception {
return getDiagnosticReports();
}
@Nonnull
private List<DiagnosticReport> getDiagnosticReports() {
ArrayList<DiagnosticReport> retVal = new ArrayList<>();
DiagnosticReport dr = new DiagnosticReport();
dr.addResult().setReference("Observation/123");
dr.setId("DiagnosticReport/1");
retVal.add(dr);
dr = new DiagnosticReport();
dr.addResult().setReference("Observation/123");
dr.setId("DiagnosticReport/2");
retVal.add(dr);
return retVal;
} }
@Override @Override

View File

@ -3,7 +3,7 @@ package ca.uhn.fhir.tests.integration.karaf.client;
import java.io.IOException; import java.io.IOException;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.PreferHeader; import ca.uhn.fhir.rest.api.PreferReturnEnum;
import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.IGenericClient;
import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.dstu3.model.Patient;
import org.junit.Ignore; import org.junit.Ignore;
@ -56,7 +56,7 @@ public class FhirClientTest {
patient.setId("PATIENTID"); patient.setId("PATIENTID");
patient.getMeta().addProfile("http://BAR"); patient.getMeta().addProfile("http://BAR");
patient.addName().addGiven("GIVEN"); patient.addName().addGiven("GIVEN");
MethodOutcome execute = client.create().resource(patient).prefer(PreferHeader.PreferReturnEnum.REPRESENTATION).execute(); MethodOutcome execute = client.create().resource(patient).prefer(PreferReturnEnum.REPRESENTATION).execute();
ourLog.info(execute.toString()); ourLog.info(execute.toString());
} }