Once-over the repository
This commit is contained in:
parent
3aafc226a8
commit
89334ba8d1
|
@ -5,4 +5,3 @@ This page is a work in progress!
|
||||||
It serves as a place to list potential help a new volunteer could offer.
|
It serves as a place to list potential help a new volunteer could offer.
|
||||||
|
|
||||||
* Investigate adding support for FHIR's RDF (Turtle) encoding to HAPI
|
* Investigate adding support for FHIR's RDF (Turtle) encoding to HAPI
|
||||||
|
|
||||||
|
|
|
@ -43,5 +43,3 @@ Please see [Smile CDR][Link-SmileCDR] for information on commercial support.
|
||||||
[Badge-MavenCentral]: https://maven-badges.herokuapp.com/maven-central/ca.uhn.hapi.fhir/hapi-fhir-base/badge.svg
|
[Badge-MavenCentral]: https://maven-badges.herokuapp.com/maven-central/ca.uhn.hapi.fhir/hapi-fhir-base/badge.svg
|
||||||
[Badge-CodeCov]: https://codecov.io/gh/hapifhir/hapi-fhir/branch/master/graph/badge.svg?token=zHfnKfQB9X
|
[Badge-CodeCov]: https://codecov.io/gh/hapifhir/hapi-fhir/branch/master/graph/badge.svg?token=zHfnKfQB9X
|
||||||
[Badge-License]: https://img.shields.io/badge/license-apache%202.0-60C060.svg
|
[Badge-License]: https://img.shields.io/badge/license-apache%202.0-60C060.svg
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,4 @@ public class AndroidMarker {
|
||||||
public static void configureContext(FhirContext theContext) {
|
public static void configureContext(FhirContext theContext) {
|
||||||
theContext.setRestfulClientFactory(new OkHttpRestfulClientFactory(theContext));
|
theContext.setRestfulClientFactory(new OkHttpRestfulClientFactory(theContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,4 @@ public class Log {
|
||||||
System.out.println("[" + theName + "] " + theMessage);
|
System.out.println("[" + theName + "] " + theMessage);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,6 @@ public class BuiltJarDstu2IT {
|
||||||
|
|
||||||
QuantityDt dt = (QuantityDt) p2.getValue();
|
QuantityDt dt = (QuantityDt) p2.getValue();
|
||||||
dt.getComparatorElement().getValueAsEnum();
|
dt.getComparatorElement().getValueAsEnum();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,7 +161,10 @@ public class BuiltJarDstu2IT {
|
||||||
|
|
||||||
ourLog.info("File {} contains {} entries", file, names.size());
|
ourLog.info("File {} contains {} entries", file, names.size());
|
||||||
ourLog.info("Total classes {} - Total methods {}", totalClasses, totalMethods);
|
ourLog.info("Total classes {} - Total methods {}", totalClasses, totalMethods);
|
||||||
ourLog.info("Top classes {}", new ArrayList<ClassMethodCount>(topMethods).subList(Math.max(0, topMethods.size() - 10), topMethods.size()));
|
ourLog.info(
|
||||||
|
"Top classes {}",
|
||||||
|
new ArrayList<ClassMethodCount>(topMethods)
|
||||||
|
.subList(Math.max(0, topMethods.size() - 10), topMethods.size()));
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
zip.close();
|
zip.close();
|
||||||
|
@ -205,7 +207,5 @@ public class BuiltJarDstu2IT {
|
||||||
public void setMethodCount(int theMethodCount) {
|
public void setMethodCount(int theMethodCount) {
|
||||||
myMethodCount = theMethodCount;
|
myMethodCount = theMethodCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,6 @@ public class BuiltJarDstu2ShadeIT {
|
||||||
|
|
||||||
QuantityDt dt = (QuantityDt) p2.getValue();
|
QuantityDt dt = (QuantityDt) p2.getValue();
|
||||||
dt.getComparatorElement().getValueAsEnum();
|
dt.getComparatorElement().getValueAsEnum();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,7 +136,10 @@ public class BuiltJarDstu2ShadeIT {
|
||||||
|
|
||||||
ourLog.info("File {} contains {} entries", file, names.size());
|
ourLog.info("File {} contains {} entries", file, names.size());
|
||||||
ourLog.info("Total classes {} - Total methods {}", totalClasses, totalMethods);
|
ourLog.info("Total classes {} - Total methods {}", totalClasses, totalMethods);
|
||||||
ourLog.info("Top classes {}", new ArrayList<ClassMethodCount>(topMethods).subList(Math.max(0, topMethods.size() - 10), topMethods.size()));
|
ourLog.info(
|
||||||
|
"Top classes {}",
|
||||||
|
new ArrayList<ClassMethodCount>(topMethods)
|
||||||
|
.subList(Math.max(0, topMethods.size() - 10), topMethods.size()));
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
zip.close();
|
zip.close();
|
||||||
|
@ -180,7 +182,5 @@ public class BuiltJarDstu2ShadeIT {
|
||||||
public void setMethodCount(int theMethodCount) {
|
public void setMethodCount(int theMethodCount) {
|
||||||
myMethodCount = theMethodCount;
|
myMethodCount = theMethodCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
public class GenericClientDstu3IT {
|
public class GenericClientDstu3IT {
|
||||||
|
|
||||||
|
|
||||||
private static FhirContext ourCtx;
|
private static FhirContext ourCtx;
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(GenericClientDstu3IT.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(GenericClientDstu3IT.class);
|
||||||
private int myAnswerCount;
|
private int myAnswerCount;
|
||||||
|
@ -76,16 +75,16 @@ public class GenericClientDstu3IT {
|
||||||
public Response answer(InvocationOnMock theInvocation) {
|
public Response answer(InvocationOnMock theInvocation) {
|
||||||
myAnswerCount++;
|
myAnswerCount++;
|
||||||
return myHttpResponse;
|
return myHttpResponse;
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
myAnswerCount = 0;
|
myAnswerCount = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String expectedUserAgent() {
|
private String expectedUserAgent() {
|
||||||
return "HAPI-FHIR/" + VersionUtil.getVersion() + " (FHIR Client; FHIR " + FhirVersionEnum.DSTU3.getFhirVersionString() + "/DSTU3; okhttp)";
|
return "HAPI-FHIR/" + VersionUtil.getVersion() + " (FHIR Client; FHIR "
|
||||||
|
+ FhirVersionEnum.DSTU3.getFhirVersionString() + "/DSTU3; okhttp)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String extractBodyAsString(ArgumentCaptor<Request> capt) throws IOException {
|
private String extractBodyAsString(ArgumentCaptor<Request> capt) throws IOException {
|
||||||
Buffer sink = new Buffer();
|
Buffer sink = new Buffer();
|
||||||
capt.getValue().body().writeTo(sink);
|
capt.getValue().body().writeTo(sink);
|
||||||
|
@ -129,13 +128,18 @@ public class GenericClientDstu3IT {
|
||||||
assertThat(request.url().toString(), startsWith("http://example.com/fhir/Binary"));
|
assertThat(request.url().toString(), startsWith("http://example.com/fhir/Binary"));
|
||||||
validateUserAgent(capt);
|
validateUserAgent(capt);
|
||||||
|
|
||||||
assertEquals(Constants.CT_FHIR_JSON_NEW + ";charset=utf-8", request.body().contentType().toString().toLowerCase().replace(" ", ""));
|
assertEquals(
|
||||||
|
Constants.CT_FHIR_JSON_NEW + ";charset=utf-8",
|
||||||
|
request.body().contentType().toString().toLowerCase().replace(" ", ""));
|
||||||
assertEquals(Constants.HEADER_ACCEPT_VALUE_JSON_NON_LEGACY, request.header("Accept"));
|
assertEquals(Constants.HEADER_ACCEPT_VALUE_JSON_NON_LEGACY, request.header("Accept"));
|
||||||
Binary output = ourCtx.newJsonParser().parseResource(Binary.class, extractBodyAsString(capt));
|
Binary output = ourCtx.newJsonParser().parseResource(Binary.class, extractBodyAsString(capt));
|
||||||
assertEquals(Constants.CT_FHIR_JSON, output.getContentType());
|
assertEquals(Constants.CT_FHIR_JSON, output.getContentType());
|
||||||
|
|
||||||
Patient outputPt = (Patient) ourCtx.newJsonParser().parseResource(new String(output.getContent(), StandardCharsets.UTF_8));
|
Patient outputPt =
|
||||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">A PATIENT</div>", outputPt.getText().getDivAsString());
|
(Patient) ourCtx.newJsonParser().parseResource(new String(output.getContent(), StandardCharsets.UTF_8));
|
||||||
|
assertEquals(
|
||||||
|
"<div xmlns=\"http://www.w3.org/1999/xhtml\">A PATIENT</div>",
|
||||||
|
outputPt.getText().getDivAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,8 +154,7 @@ public class GenericClientDstu3IT {
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
client
|
client.search()
|
||||||
.search()
|
|
||||||
.forResource(Patient.class)
|
.forResource(Patient.class)
|
||||||
.where(Patient.FAMILY.matches().value((String) null))
|
.where(Patient.FAMILY.matches().value((String) null))
|
||||||
.and(Patient.BIRTHDATE.exactly().day((Date) null))
|
.and(Patient.BIRTHDATE.exactly().day((Date) null))
|
||||||
|
@ -160,13 +163,12 @@ public class GenericClientDstu3IT {
|
||||||
.returnBundle(Bundle.class)
|
.returnBundle(Bundle.class)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
assertEquals("http://example.com/fhir/Patient?_format=json", capt.getAllValues().get(idx).url().toString());
|
assertEquals(
|
||||||
|
"http://example.com/fhir/Patient?_format=json",
|
||||||
|
capt.getAllValues().get(idx).url().toString());
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: narratives don't work without stax
|
* TODO: narratives don't work without stax
|
||||||
*/
|
*/
|
||||||
|
@ -196,13 +198,19 @@ public class GenericClientDstu3IT {
|
||||||
Request request = capt.getAllValues().get(0);
|
Request request = capt.getAllValues().get(0);
|
||||||
ourLog.info(request.headers().toString());
|
ourLog.info(request.headers().toString());
|
||||||
|
|
||||||
assertEquals("http://example.com/fhir/Binary?_format=json", request.url().toString());
|
assertEquals(
|
||||||
|
"http://example.com/fhir/Binary?_format=json", request.url().toString());
|
||||||
validateUserAgent(capt);
|
validateUserAgent(capt);
|
||||||
|
|
||||||
assertEquals(Constants.CT_FHIR_JSON_NEW + ";charset=utf-8", request.body().contentType().toString().toLowerCase().replace(" ", ""));
|
assertEquals(
|
||||||
|
Constants.CT_FHIR_JSON_NEW + ";charset=utf-8",
|
||||||
|
request.body().contentType().toString().toLowerCase().replace(" ", ""));
|
||||||
assertEquals(Constants.HEADER_ACCEPT_VALUE_JSON_NON_LEGACY, request.header("Accept"));
|
assertEquals(Constants.HEADER_ACCEPT_VALUE_JSON_NON_LEGACY, request.header("Accept"));
|
||||||
assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, ourCtx.newJsonParser().parseResource(Binary.class, extractBodyAsString(capt)).getContent());
|
assertArrayEquals(
|
||||||
|
new byte[] {0, 1, 2, 3, 4},
|
||||||
|
ourCtx.newJsonParser()
|
||||||
|
.parseResource(Binary.class, extractBodyAsString(capt))
|
||||||
|
.getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -234,11 +242,8 @@ public class GenericClientDstu3IT {
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
// good
|
// good
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: narratives don't work without stax
|
* TODO: narratives don't work without stax
|
||||||
*/
|
*/
|
||||||
|
@ -265,19 +270,26 @@ 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(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());
|
||||||
|
|
||||||
assertEquals(1, capt.getAllValues().size());
|
assertEquals(1, capt.getAllValues().size());
|
||||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">FINAL VALUE</div>", ((Patient) outcome.getResource()).getText().getDivAsString());
|
assertEquals(
|
||||||
assertEquals("http://example.com/fhir/Patient?_format=json", capt.getAllValues().get(0).url().toString());
|
"<div xmlns=\"http://www.w3.org/1999/xhtml\">FINAL VALUE</div>",
|
||||||
|
((Patient) outcome.getResource()).getText().getDivAsString());
|
||||||
|
assertEquals(
|
||||||
|
"http://example.com/fhir/Patient?_format=json",
|
||||||
|
capt.getAllValues().get(0).url().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ArgumentCaptor<Request> prepareClientForSearchResponse() {
|
private ArgumentCaptor<Request> prepareClientForSearchResponse() {
|
||||||
final String respString = "{\"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\"}]}}]}";
|
final String respString =
|
||||||
|
"{\"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\"}]}}]}";
|
||||||
myHttpResponse = new Response.Builder()
|
myHttpResponse = new Response.Builder()
|
||||||
.request(myRequest)
|
.request(myRequest)
|
||||||
.protocol(myProtocol)
|
.protocol(myProtocol)
|
||||||
|
@ -290,7 +302,6 @@ public class GenericClientDstu3IT {
|
||||||
return capt;
|
return capt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterClassClearContext() {
|
public static void afterClassClearContext() {
|
||||||
TestUtil.randomizeLocaleAndTimezone();
|
TestUtil.randomizeLocaleAndTimezone();
|
||||||
|
|
|
@ -28,5 +28,4 @@ public interface IHapiBootOrder {
|
||||||
|
|
||||||
int SUBSCRIPTION_MATCHING_CHANNEL_HANDLER = 300;
|
int SUBSCRIPTION_MATCHING_CHANNEL_HANDLER = 300;
|
||||||
int AFTER_SUBSCRIPTION_INITIALIZED = 310;
|
int AFTER_SUBSCRIPTION_INITIALIZED = 310;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,18 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
public abstract class BaseRuntimeChildDatatypeDefinition extends BaseRuntimeDeclaredChildDefinition {
|
public abstract class BaseRuntimeChildDatatypeDefinition extends BaseRuntimeDeclaredChildDefinition {
|
||||||
Logger ourLog = LoggerFactory.getLogger(BaseRuntimeChildDatatypeDefinition.class);
|
Logger ourLog = LoggerFactory.getLogger(BaseRuntimeChildDatatypeDefinition.class);
|
||||||
|
|
||||||
|
@ -39,11 +38,18 @@ public abstract class BaseRuntimeChildDatatypeDefinition extends BaseRuntimeDecl
|
||||||
|
|
||||||
private BaseRuntimeElementDefinition<?> myElementDefinition;
|
private BaseRuntimeElementDefinition<?> myElementDefinition;
|
||||||
|
|
||||||
public BaseRuntimeChildDatatypeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class<? extends IBase> theDatatype) {
|
public BaseRuntimeChildDatatypeDefinition(
|
||||||
|
Field theField,
|
||||||
|
String theElementName,
|
||||||
|
Child theChildAnnotation,
|
||||||
|
Description theDescriptionAnnotation,
|
||||||
|
Class<? extends IBase> theDatatype) {
|
||||||
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
||||||
// should use RuntimeChildAny
|
// should use RuntimeChildAny
|
||||||
assert Modifier.isInterface(theDatatype.getModifiers()) == false : "Type of " + theDatatype + " shouldn't be here";
|
assert Modifier.isInterface(theDatatype.getModifiers()) == false
|
||||||
assert Modifier.isAbstract(theDatatype.getModifiers()) == false : "Type of " + theDatatype + " shouldn't be here";
|
: "Type of " + theDatatype + " shouldn't be here";
|
||||||
|
assert Modifier.isAbstract(theDatatype.getModifiers()) == false
|
||||||
|
: "Type of " + theDatatype + " shouldn't be here";
|
||||||
myDatatype = theDatatype;
|
myDatatype = theDatatype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +103,9 @@ public abstract class BaseRuntimeChildDatatypeDefinition extends BaseRuntimeDecl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myElementDefinition = theClassToElementDefinitions.get(getDatatype());
|
myElementDefinition = theClassToElementDefinitions.get(getDatatype());
|
||||||
if (myElementDefinition == null) {
|
if (myElementDefinition == null) {
|
||||||
myElementDefinition = theContext.getElementDefinition(getDatatype());
|
myElementDefinition = theContext.getElementDefinition(getDatatype());
|
||||||
|
@ -109,5 +117,4 @@ public abstract class BaseRuntimeChildDatatypeDefinition extends BaseRuntimeDecl
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getSimpleName() + "[" + getElementName() + "]";
|
return getClass().getSimpleName() + "[" + getElementName() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,9 @@ public abstract class BaseRuntimeChildDefinition {
|
||||||
|
|
||||||
public abstract boolean isSummary();
|
public abstract boolean isSummary();
|
||||||
|
|
||||||
abstract void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions);
|
abstract void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -99,8 +101,10 @@ public abstract class BaseRuntimeChildDefinition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseRuntimeElementDefinition<?> findResourceReferenceDefinition(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
BaseRuntimeElementDefinition<?> findResourceReferenceDefinition(
|
||||||
for (Entry<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> next : theClassToElementDefinitions.entrySet()) {
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
|
for (Entry<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> next :
|
||||||
|
theClassToElementDefinitions.entrySet()) {
|
||||||
if (IBaseReference.class.isAssignableFrom(next.getKey())) {
|
if (IBaseReference.class.isAssignableFrom(next.getKey())) {
|
||||||
return next.getValue();
|
return next.getValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,11 +46,15 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil
|
||||||
private boolean myModifier;
|
private boolean myModifier;
|
||||||
private boolean mySummary;
|
private boolean mySummary;
|
||||||
|
|
||||||
BaseRuntimeDeclaredChildDefinition(Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName) throws ConfigurationException {
|
BaseRuntimeDeclaredChildDefinition(
|
||||||
|
Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName)
|
||||||
|
throws ConfigurationException {
|
||||||
super();
|
super();
|
||||||
Validate.notNull(theField, "No field specified");
|
Validate.notNull(theField, "No field specified");
|
||||||
ValidateUtil.isGreaterThanOrEqualTo(theChildAnnotation.min(), 0, "Min must be >= 0");
|
ValidateUtil.isGreaterThanOrEqualTo(theChildAnnotation.min(), 0, "Min must be >= 0");
|
||||||
Validate.isTrue(theChildAnnotation.max() == -1 || theChildAnnotation.max() >= theChildAnnotation.min(), "Max must be >= Min (unless it is -1 / unlimited)");
|
Validate.isTrue(
|
||||||
|
theChildAnnotation.max() == -1 || theChildAnnotation.max() >= theChildAnnotation.min(),
|
||||||
|
"Max must be >= Min (unless it is -1 / unlimited)");
|
||||||
Validate.notBlank(theElementName, "Element name must not be blank");
|
Validate.notBlank(theElementName, "Element name must not be blank");
|
||||||
|
|
||||||
myField = theField;
|
myField = theField;
|
||||||
|
@ -76,7 +80,6 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil
|
||||||
myAccessor = new FieldPlainAccessor();
|
myAccessor = new FieldPlainAccessor();
|
||||||
myMutator = new FieldPlainMutator();
|
myMutator = new FieldPlainMutator();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -147,7 +150,6 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final class FieldListMutator implements IMutator {
|
protected final class FieldListMutator implements IMutator {
|
||||||
|
@ -181,10 +183,12 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil
|
||||||
public void remove(IBase theTarget, int theIndex) {
|
public void remove(IBase theTarget, int theIndex) {
|
||||||
List<IBase> existingList = (List<IBase>) getFieldValue(theTarget, myField);
|
List<IBase> existingList = (List<IBase>) getFieldValue(theTarget, myField);
|
||||||
if (existingList == null) {
|
if (existingList == null) {
|
||||||
throw new IndexOutOfBoundsException(Msg.code(2143) + "Can not remove element at index " + theIndex + " from list - List is null");
|
throw new IndexOutOfBoundsException(
|
||||||
|
Msg.code(2143) + "Can not remove element at index " + theIndex + " from list - List is null");
|
||||||
}
|
}
|
||||||
if (theIndex >= existingList.size()) {
|
if (theIndex >= existingList.size()) {
|
||||||
throw new IndexOutOfBoundsException(Msg.code(2144) + "Can not remove element at index " + theIndex + " from list - List size is " + existingList.size());
|
throw new IndexOutOfBoundsException(Msg.code(2144) + "Can not remove element at index " + theIndex
|
||||||
|
+ " from list - List size is " + existingList.size());
|
||||||
}
|
}
|
||||||
existingList.remove(theIndex);
|
existingList.remove(theIndex);
|
||||||
}
|
}
|
||||||
|
@ -219,7 +223,9 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(IBase theTarget, int theIndex) {
|
public void remove(IBase theTarget, int theIndex) {
|
||||||
throw new UnsupportedOperationException(Msg.code(2142) + "Remove by index can only be called on a list-valued field. '" + myField.getName() + "' is a single-valued field.");
|
throw new UnsupportedOperationException(
|
||||||
|
Msg.code(2142) + "Remove by index can only be called on a list-valued field. '" + myField.getName()
|
||||||
|
+ "' is a single-valued field.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,5 +244,4 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil
|
||||||
throw new ConfigurationException(Msg.code(1737) + "Failed to get value", e);
|
throw new ConfigurationException(Msg.code(1737) + "Failed to get value", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,8 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
|
|
||||||
public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> extends BaseRuntimeElementDefinition<T> {
|
public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> extends BaseRuntimeElementDefinition<T> {
|
||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseRuntimeElementCompositeDefinition.class);
|
private static final org.slf4j.Logger ourLog =
|
||||||
|
org.slf4j.LoggerFactory.getLogger(BaseRuntimeElementCompositeDefinition.class);
|
||||||
private final FhirContext myContext;
|
private final FhirContext myContext;
|
||||||
private Map<String, Integer> forcedOrder = null;
|
private Map<String, Integer> forcedOrder = null;
|
||||||
private List<BaseRuntimeChildDefinition> myChildren = new ArrayList<>();
|
private List<BaseRuntimeChildDefinition> myChildren = new ArrayList<>();
|
||||||
|
@ -80,7 +81,12 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
private volatile SealingStateEnum mySealed = SealingStateEnum.NOT_SEALED;
|
private volatile SealingStateEnum mySealed = SealingStateEnum.NOT_SEALED;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public BaseRuntimeElementCompositeDefinition(String theName, Class<? extends T> theImplementingClass, boolean theStandardType, FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
public BaseRuntimeElementCompositeDefinition(
|
||||||
|
String theName,
|
||||||
|
Class<? extends T> theImplementingClass,
|
||||||
|
boolean theStandardType,
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super(theName, theImplementingClass, theStandardType);
|
super(theName, theImplementingClass, theStandardType);
|
||||||
|
|
||||||
myContext = theContext;
|
myContext = theContext;
|
||||||
|
@ -126,7 +132,6 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void addChild(BaseRuntimeChildDefinition theNext) {
|
void addChild(BaseRuntimeChildDefinition theNext) {
|
||||||
|
@ -134,7 +139,8 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
throw new NullPointerException(Msg.code(1698));
|
throw new NullPointerException(Msg.code(1698));
|
||||||
}
|
}
|
||||||
if (theNext.getExtensionUrl() != null) {
|
if (theNext.getExtensionUrl() != null) {
|
||||||
throw new IllegalArgumentException(Msg.code(1699) + "Shouldn't haven an extension URL, use addExtension instead");
|
throw new IllegalArgumentException(
|
||||||
|
Msg.code(1699) + "Shouldn't haven an extension URL, use addExtension instead");
|
||||||
}
|
}
|
||||||
myChildren.add(theNext);
|
myChildren.add(theNext);
|
||||||
}
|
}
|
||||||
|
@ -145,11 +151,13 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
return myNameToChild.get(theName);
|
return myNameToChild.get(theName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseRuntimeChildDefinition getChildByNameOrThrowDataFormatException(String theName) throws DataFormatException {
|
public BaseRuntimeChildDefinition getChildByNameOrThrowDataFormatException(String theName)
|
||||||
|
throws DataFormatException {
|
||||||
validateSealed();
|
validateSealed();
|
||||||
BaseRuntimeChildDefinition retVal = myNameToChild.get(theName);
|
BaseRuntimeChildDefinition retVal = myNameToChild.get(theName);
|
||||||
if (retVal == null) {
|
if (retVal == null) {
|
||||||
throw new DataFormatException(Msg.code(1700) + "Unknown child name '" + theName + "' in element " + getName() + " - Valid names are: " + new TreeSet<String>(myNameToChild.keySet()));
|
throw new DataFormatException(Msg.code(1700) + "Unknown child name '" + theName + "' in element "
|
||||||
|
+ getName() + " - Valid names are: " + new TreeSet<String>(myNameToChild.keySet()));
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
@ -160,13 +168,11 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
return myChildren;
|
return myChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<BaseRuntimeChildDefinition> getChildrenAndExtension() {
|
public List<BaseRuntimeChildDefinition> getChildrenAndExtension() {
|
||||||
validateSealed();
|
validateSealed();
|
||||||
return myChildrenAndExtensions;
|
return myChildrenAndExtensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has this class been sealed
|
* Has this class been sealed
|
||||||
*/
|
*/
|
||||||
|
@ -178,12 +184,14 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
void populateScanAlso(Set<Class<? extends IBase>> theScanAlso) {
|
void populateScanAlso(Set<Class<? extends IBase>> theScanAlso) {
|
||||||
for (ScannedField next : myScannedFields) {
|
for (ScannedField next : myScannedFields) {
|
||||||
if (IBase.class.isAssignableFrom(next.getElementType())) {
|
if (IBase.class.isAssignableFrom(next.getElementType())) {
|
||||||
if (next.getElementType().isInterface() == false && Modifier.isAbstract(next.getElementType().getModifiers()) == false) {
|
if (next.getElementType().isInterface() == false
|
||||||
|
&& Modifier.isAbstract(next.getElementType().getModifiers()) == false) {
|
||||||
theScanAlso.add((Class<? extends IBase>) next.getElementType());
|
theScanAlso.add((Class<? extends IBase>) next.getElementType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Class<? extends IBase> nextChildType : next.getChoiceTypes()) {
|
for (Class<? extends IBase> nextChildType : next.getChoiceTypes()) {
|
||||||
if (nextChildType.isInterface() == false && Modifier.isAbstract(nextChildType.getModifiers()) == false) {
|
if (nextChildType.isInterface() == false
|
||||||
|
&& Modifier.isAbstract(nextChildType.getModifiers()) == false) {
|
||||||
theScanAlso.add(nextChildType);
|
theScanAlso.add(nextChildType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,17 +241,20 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
this.addExtension((RuntimeChildDeclaredExtensionDefinition) nextExt);
|
this.addExtension((RuntimeChildDeclaredExtensionDefinition) nextExt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void scanCompositeElementForChildren(Set<String> elementNames, TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToElementDef,
|
private void scanCompositeElementForChildren(
|
||||||
|
Set<String> elementNames,
|
||||||
|
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToElementDef,
|
||||||
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToExtensionDef) {
|
TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> theOrderToExtensionDef) {
|
||||||
int baseElementOrder = 0;
|
int baseElementOrder = 0;
|
||||||
|
|
||||||
for (ScannedField next : myScannedFields) {
|
for (ScannedField next : myScannedFields) {
|
||||||
if (next.isFirstFieldInNewClass()) {
|
if (next.isFirstFieldInNewClass()) {
|
||||||
baseElementOrder = theOrderToElementDef.isEmpty() ? 0 : theOrderToElementDef.lastEntry().getKey() + 1;
|
baseElementOrder = theOrderToElementDef.isEmpty()
|
||||||
|
? 0
|
||||||
|
: theOrderToElementDef.lastEntry().getKey() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Class<?> declaringClass = next.getField().getDeclaringClass();
|
Class<?> declaringClass = next.getField().getDeclaringClass();
|
||||||
|
@ -281,8 +292,12 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (order == Child.REPLACE_PARENT) {
|
if (order == Child.REPLACE_PARENT) {
|
||||||
throw new ConfigurationException(Msg.code(1701) + "Field " + nextField.getName() + "' on target type " + declaringClass.getSimpleName() + " has order() of REPLACE_PARENT (" + Child.REPLACE_PARENT
|
throw new ConfigurationException(
|
||||||
+ ") but no parent element with extension URL " + extensionAttr.url() + " could be found on type " + nextField.getDeclaringClass().getSimpleName());
|
Msg.code(1701) + "Field " + nextField.getName() + "' on target type "
|
||||||
|
+ declaringClass.getSimpleName() + " has order() of REPLACE_PARENT ("
|
||||||
|
+ Child.REPLACE_PARENT + ") but no parent element with extension URL "
|
||||||
|
+ extensionAttr.url() + " could be found on type "
|
||||||
|
+ nextField.getDeclaringClass().getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -308,16 +323,18 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (order == Child.REPLACE_PARENT) {
|
if (order == Child.REPLACE_PARENT) {
|
||||||
throw new ConfigurationException(Msg.code(1702) + "Field " + nextField.getName() + "' on target type " + declaringClass.getSimpleName() + " has order() of REPLACE_PARENT (" + Child.REPLACE_PARENT
|
throw new ConfigurationException(Msg.code(1702) + "Field " + nextField.getName()
|
||||||
+ ") but no parent element with name " + elementName + " could be found on type " + nextField.getDeclaringClass().getSimpleName());
|
+ "' on target type " + declaringClass.getSimpleName()
|
||||||
|
+ " has order() of REPLACE_PARENT (" + Child.REPLACE_PARENT
|
||||||
|
+ ") but no parent element with name " + elementName + " could be found on type "
|
||||||
|
+ nextField.getDeclaringClass().getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (order < 0 && order != Child.ORDER_UNKNOWN) {
|
if (order < 0 && order != Child.ORDER_UNKNOWN) {
|
||||||
throw new ConfigurationException(Msg.code(1703) + "Invalid order '" + order + "' on @Child for field '" + nextField.getName() + "' on target type: " + declaringClass);
|
throw new ConfigurationException(Msg.code(1703) + "Invalid order '" + order + "' on @Child for field '"
|
||||||
|
+ nextField.getName() + "' on target type: " + declaringClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (order != Child.ORDER_UNKNOWN && !orderIsReplaceParent) {
|
if (order != Child.ORDER_UNKNOWN && !orderIsReplaceParent) {
|
||||||
|
@ -339,34 +356,49 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
List<Class<? extends IBase>> choiceTypes = next.getChoiceTypes();
|
List<Class<? extends IBase>> choiceTypes = next.getChoiceTypes();
|
||||||
|
|
||||||
if (orderMap.containsKey(order)) {
|
if (orderMap.containsKey(order)) {
|
||||||
throw new ConfigurationException(Msg.code(1704) + "Detected duplicate field order '" + childAnnotation.order() + "' for element named '" + elementName + "' in type '" + declaringClass.getCanonicalName() + "' - Already had: " + orderMap.get(order).getElementName());
|
throw new ConfigurationException(Msg.code(1704) + "Detected duplicate field order '"
|
||||||
|
+ childAnnotation.order() + "' for element named '" + elementName + "' in type '"
|
||||||
|
+ declaringClass.getCanonicalName() + "' - Already had: "
|
||||||
|
+ orderMap.get(order).getElementName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elementNames.contains(elementName)) {
|
if (elementNames.contains(elementName)) {
|
||||||
throw new ConfigurationException(Msg.code(1705) + "Detected duplicate field name '" + elementName + "' in type '" + declaringClass.getCanonicalName() + "'");
|
throw new ConfigurationException(Msg.code(1705) + "Detected duplicate field name '" + elementName
|
||||||
|
+ "' in type '" + declaringClass.getCanonicalName() + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
Class<?> nextElementType = next.getElementType();
|
Class<?> nextElementType = next.getElementType();
|
||||||
|
|
||||||
BaseRuntimeDeclaredChildDefinition def;
|
BaseRuntimeDeclaredChildDefinition def;
|
||||||
if (childAnnotation.name().equals("extension") && IBaseExtension.class.isAssignableFrom(nextElementType)) {
|
if (childAnnotation.name().equals("extension") && IBaseExtension.class.isAssignableFrom(nextElementType)) {
|
||||||
def = new RuntimeChildExtension(nextField, childAnnotation.name(), childAnnotation, descriptionAnnotation);
|
def = new RuntimeChildExtension(
|
||||||
} else if (childAnnotation.name().equals("modifierExtension") && IBaseExtension.class.isAssignableFrom(nextElementType)) {
|
nextField, childAnnotation.name(), childAnnotation, descriptionAnnotation);
|
||||||
def = new RuntimeChildExtension(nextField, childAnnotation.name(), childAnnotation, descriptionAnnotation);
|
} else if (childAnnotation.name().equals("modifierExtension")
|
||||||
} else if (BaseContainedDt.class.isAssignableFrom(nextElementType) || (childAnnotation.name().equals("contained") && IBaseResource.class.isAssignableFrom(nextElementType))) {
|
&& IBaseExtension.class.isAssignableFrom(nextElementType)) {
|
||||||
|
def = new RuntimeChildExtension(
|
||||||
|
nextField, childAnnotation.name(), childAnnotation, descriptionAnnotation);
|
||||||
|
} else if (BaseContainedDt.class.isAssignableFrom(nextElementType)
|
||||||
|
|| (childAnnotation.name().equals("contained")
|
||||||
|
&& IBaseResource.class.isAssignableFrom(nextElementType))) {
|
||||||
/*
|
/*
|
||||||
* Child is contained resources
|
* Child is contained resources
|
||||||
*/
|
*/
|
||||||
def = new RuntimeChildContainedResources(nextField, childAnnotation, descriptionAnnotation, elementName);
|
def = new RuntimeChildContainedResources(
|
||||||
} else if (IAnyResource.class.isAssignableFrom(nextElementType) || IResource.class.equals(nextElementType)) {
|
nextField, childAnnotation, descriptionAnnotation, elementName);
|
||||||
|
} else if (IAnyResource.class.isAssignableFrom(nextElementType)
|
||||||
|
|| IResource.class.equals(nextElementType)) {
|
||||||
/*
|
/*
|
||||||
* Child is a resource as a direct child, as in Bundle.entry.resource
|
* Child is a resource as a direct child, as in Bundle.entry.resource
|
||||||
*/
|
*/
|
||||||
def = new RuntimeChildDirectResource(nextField, childAnnotation, descriptionAnnotation, elementName);
|
def = new RuntimeChildDirectResource(nextField, childAnnotation, descriptionAnnotation, elementName);
|
||||||
} else {
|
} else {
|
||||||
childIsChoiceType |= choiceTypes.size() > 1;
|
childIsChoiceType |= choiceTypes.size() > 1;
|
||||||
if (extensionAttr == null && childIsChoiceType && !BaseResourceReferenceDt.class.isAssignableFrom(nextElementType) && !IBaseReference.class.isAssignableFrom(nextElementType)) {
|
if (extensionAttr == null
|
||||||
def = new RuntimeChildChoiceDefinition(nextField, elementName, childAnnotation, descriptionAnnotation, choiceTypes);
|
&& childIsChoiceType
|
||||||
|
&& !BaseResourceReferenceDt.class.isAssignableFrom(nextElementType)
|
||||||
|
&& !IBaseReference.class.isAssignableFrom(nextElementType)) {
|
||||||
|
def = new RuntimeChildChoiceDefinition(
|
||||||
|
nextField, elementName, childAnnotation, descriptionAnnotation, choiceTypes);
|
||||||
} else if (extensionAttr != null) {
|
} else if (extensionAttr != null) {
|
||||||
/*
|
/*
|
||||||
* Child is an extension
|
* Child is an extension
|
||||||
|
@ -374,72 +406,124 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
Class<? extends IBase> et = (Class<? extends IBase>) nextElementType;
|
Class<? extends IBase> et = (Class<? extends IBase>) nextElementType;
|
||||||
|
|
||||||
Object binder = null;
|
Object binder = null;
|
||||||
if (BoundCodeDt.class.isAssignableFrom(nextElementType) || IBoundCodeableConcept.class.isAssignableFrom(nextElementType)) {
|
if (BoundCodeDt.class.isAssignableFrom(nextElementType)
|
||||||
|
|| IBoundCodeableConcept.class.isAssignableFrom(nextElementType)) {
|
||||||
binder = ModelScanner.getBoundCodeBinder(nextField);
|
binder = ModelScanner.getBoundCodeBinder(nextField);
|
||||||
}
|
}
|
||||||
|
|
||||||
def = new RuntimeChildDeclaredExtensionDefinition(nextField, childAnnotation, descriptionAnnotation, extensionAttr, elementName, extensionAttr.url(), et, binder);
|
def = new RuntimeChildDeclaredExtensionDefinition(
|
||||||
|
nextField,
|
||||||
|
childAnnotation,
|
||||||
|
descriptionAnnotation,
|
||||||
|
extensionAttr,
|
||||||
|
elementName,
|
||||||
|
extensionAttr.url(),
|
||||||
|
et,
|
||||||
|
binder);
|
||||||
|
|
||||||
if (IBaseEnumeration.class.isAssignableFrom(nextElementType)) {
|
if (IBaseEnumeration.class.isAssignableFrom(nextElementType)) {
|
||||||
((RuntimeChildDeclaredExtensionDefinition) def).setEnumerationType(ReflectionUtil.getGenericCollectionTypeOfFieldWithSecondOrderForList(nextField));
|
((RuntimeChildDeclaredExtensionDefinition) def)
|
||||||
|
.setEnumerationType(
|
||||||
|
ReflectionUtil.getGenericCollectionTypeOfFieldWithSecondOrderForList(
|
||||||
|
nextField));
|
||||||
}
|
}
|
||||||
} else if (BaseResourceReferenceDt.class.isAssignableFrom(nextElementType) || IBaseReference.class.isAssignableFrom(nextElementType)) {
|
} else if (BaseResourceReferenceDt.class.isAssignableFrom(nextElementType)
|
||||||
|
|| IBaseReference.class.isAssignableFrom(nextElementType)) {
|
||||||
/*
|
/*
|
||||||
* Child is a resource reference
|
* Child is a resource reference
|
||||||
*/
|
*/
|
||||||
List<Class<? extends IBaseResource>> refTypesList = new ArrayList<>();
|
List<Class<? extends IBaseResource>> refTypesList = new ArrayList<>();
|
||||||
for (Class<? extends IElement> nextType : childAnnotation.type()) {
|
for (Class<? extends IElement> nextType : childAnnotation.type()) {
|
||||||
if (IBaseReference.class.isAssignableFrom(nextType)) {
|
if (IBaseReference.class.isAssignableFrom(nextType)) {
|
||||||
refTypesList.add(myContext.getVersion().getVersion().isRi() ? IAnyResource.class : IResource.class);
|
refTypesList.add(
|
||||||
|
myContext.getVersion().getVersion().isRi() ? IAnyResource.class : IResource.class);
|
||||||
continue;
|
continue;
|
||||||
} else if (IBaseResource.class.isAssignableFrom(nextType) == false) {
|
} else if (IBaseResource.class.isAssignableFrom(nextType) == false) {
|
||||||
throw new ConfigurationException(Msg.code(1706) + "Field '" + nextField.getName() + "' in class '" + nextField.getDeclaringClass().getCanonicalName() + "' is of type " + BaseResourceReferenceDt.class + " but contains a non-resource type: " + nextType.getCanonicalName());
|
throw new ConfigurationException(
|
||||||
|
Msg.code(1706) + "Field '" + nextField.getName() + "' in class '"
|
||||||
|
+ nextField.getDeclaringClass().getCanonicalName() + "' is of type "
|
||||||
|
+ BaseResourceReferenceDt.class + " but contains a non-resource type: "
|
||||||
|
+ nextType.getCanonicalName());
|
||||||
}
|
}
|
||||||
refTypesList.add((Class<? extends IBaseResource>) nextType);
|
refTypesList.add((Class<? extends IBaseResource>) nextType);
|
||||||
}
|
}
|
||||||
def = new RuntimeChildResourceDefinition(nextField, elementName, childAnnotation, descriptionAnnotation, refTypesList);
|
def = new RuntimeChildResourceDefinition(
|
||||||
|
nextField, elementName, childAnnotation, descriptionAnnotation, refTypesList);
|
||||||
|
|
||||||
} else if (IResourceBlock.class.isAssignableFrom(nextElementType) || IBaseBackboneElement.class.isAssignableFrom(nextElementType)
|
} else if (IResourceBlock.class.isAssignableFrom(nextElementType)
|
||||||
|
|| IBaseBackboneElement.class.isAssignableFrom(nextElementType)
|
||||||
|| IBaseDatatypeElement.class.isAssignableFrom(nextElementType)) {
|
|| IBaseDatatypeElement.class.isAssignableFrom(nextElementType)) {
|
||||||
/*
|
/*
|
||||||
* Child is a resource block (i.e. a sub-tag within a resource) TODO: do these have a better name according to HL7?
|
* Child is a resource block (i.e. a sub-tag within a resource) TODO: do these have a better name according to HL7?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Class<? extends IBase> blockDef = (Class<? extends IBase>) nextElementType;
|
Class<? extends IBase> blockDef = (Class<? extends IBase>) nextElementType;
|
||||||
def = new RuntimeChildResourceBlockDefinition(myContext, nextField, childAnnotation, descriptionAnnotation, elementName, blockDef);
|
def = new RuntimeChildResourceBlockDefinition(
|
||||||
} else if (IDatatype.class.equals(nextElementType) || IElement.class.equals(nextElementType) || "Type".equals(nextElementType.getSimpleName())
|
myContext, nextField, childAnnotation, descriptionAnnotation, elementName, blockDef);
|
||||||
|
} else if (IDatatype.class.equals(nextElementType)
|
||||||
|
|| IElement.class.equals(nextElementType)
|
||||||
|
|| "Type".equals(nextElementType.getSimpleName())
|
||||||
|| IBaseDatatype.class.equals(nextElementType)) {
|
|| IBaseDatatype.class.equals(nextElementType)) {
|
||||||
|
|
||||||
def = new RuntimeChildAny(nextField, elementName, childAnnotation, descriptionAnnotation);
|
def = new RuntimeChildAny(nextField, elementName, childAnnotation, descriptionAnnotation);
|
||||||
} else if (IDatatype.class.isAssignableFrom(nextElementType) || IPrimitiveType.class.isAssignableFrom(nextElementType) || ICompositeType.class.isAssignableFrom(nextElementType)
|
} else if (IDatatype.class.isAssignableFrom(nextElementType)
|
||||||
|| IBaseDatatype.class.isAssignableFrom(nextElementType) || IBaseExtension.class.isAssignableFrom(nextElementType)) {
|
|| IPrimitiveType.class.isAssignableFrom(nextElementType)
|
||||||
|
|| ICompositeType.class.isAssignableFrom(nextElementType)
|
||||||
|
|| IBaseDatatype.class.isAssignableFrom(nextElementType)
|
||||||
|
|| IBaseExtension.class.isAssignableFrom(nextElementType)) {
|
||||||
Class<? extends IBase> nextDatatype = (Class<? extends IBase>) nextElementType;
|
Class<? extends IBase> nextDatatype = (Class<? extends IBase>) nextElementType;
|
||||||
|
|
||||||
if (IPrimitiveType.class.isAssignableFrom(nextElementType)) {
|
if (IPrimitiveType.class.isAssignableFrom(nextElementType)) {
|
||||||
if (nextElementType.equals(BoundCodeDt.class)) {
|
if (nextElementType.equals(BoundCodeDt.class)) {
|
||||||
IValueSetEnumBinder<Enum<?>> binder = ModelScanner.getBoundCodeBinder(nextField);
|
IValueSetEnumBinder<Enum<?>> binder = ModelScanner.getBoundCodeBinder(nextField);
|
||||||
Class<? extends Enum<?>> enumType = ModelScanner.determineEnumTypeForBoundField(nextField);
|
Class<? extends Enum<?>> enumType = ModelScanner.determineEnumTypeForBoundField(nextField);
|
||||||
def = new RuntimeChildPrimitiveBoundCodeDatatypeDefinition(nextField, elementName, childAnnotation, descriptionAnnotation, nextDatatype, binder, enumType);
|
def = new RuntimeChildPrimitiveBoundCodeDatatypeDefinition(
|
||||||
|
nextField,
|
||||||
|
elementName,
|
||||||
|
childAnnotation,
|
||||||
|
descriptionAnnotation,
|
||||||
|
nextDatatype,
|
||||||
|
binder,
|
||||||
|
enumType);
|
||||||
} else if (IBaseEnumeration.class.isAssignableFrom(nextElementType)) {
|
} else if (IBaseEnumeration.class.isAssignableFrom(nextElementType)) {
|
||||||
Class<? extends Enum<?>> binderType = ModelScanner.determineEnumTypeForBoundField(nextField);
|
Class<? extends Enum<?>> binderType =
|
||||||
def = new RuntimeChildPrimitiveEnumerationDatatypeDefinition(nextField, elementName, childAnnotation, descriptionAnnotation, nextDatatype, binderType);
|
ModelScanner.determineEnumTypeForBoundField(nextField);
|
||||||
|
def = new RuntimeChildPrimitiveEnumerationDatatypeDefinition(
|
||||||
|
nextField,
|
||||||
|
elementName,
|
||||||
|
childAnnotation,
|
||||||
|
descriptionAnnotation,
|
||||||
|
nextDatatype,
|
||||||
|
binderType);
|
||||||
} else {
|
} else {
|
||||||
def = new RuntimeChildPrimitiveDatatypeDefinition(nextField, elementName, descriptionAnnotation, childAnnotation, nextDatatype);
|
def = new RuntimeChildPrimitiveDatatypeDefinition(
|
||||||
|
nextField, elementName, descriptionAnnotation, childAnnotation, nextDatatype);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (IBoundCodeableConcept.class.isAssignableFrom(nextElementType)) {
|
if (IBoundCodeableConcept.class.isAssignableFrom(nextElementType)) {
|
||||||
IValueSetEnumBinder<Enum<?>> binder = ModelScanner.getBoundCodeBinder(nextField);
|
IValueSetEnumBinder<Enum<?>> binder = ModelScanner.getBoundCodeBinder(nextField);
|
||||||
Class<? extends Enum<?>> enumType = ModelScanner.determineEnumTypeForBoundField(nextField);
|
Class<? extends Enum<?>> enumType = ModelScanner.determineEnumTypeForBoundField(nextField);
|
||||||
def = new RuntimeChildCompositeBoundDatatypeDefinition(nextField, elementName, childAnnotation, descriptionAnnotation, nextDatatype, binder, enumType);
|
def = new RuntimeChildCompositeBoundDatatypeDefinition(
|
||||||
} else if (BaseNarrativeDt.class.isAssignableFrom(nextElementType) || INarrative.class.isAssignableFrom(nextElementType)) {
|
nextField,
|
||||||
def = new RuntimeChildNarrativeDefinition(nextField, elementName, childAnnotation, descriptionAnnotation, nextDatatype);
|
elementName,
|
||||||
|
childAnnotation,
|
||||||
|
descriptionAnnotation,
|
||||||
|
nextDatatype,
|
||||||
|
binder,
|
||||||
|
enumType);
|
||||||
|
} else if (BaseNarrativeDt.class.isAssignableFrom(nextElementType)
|
||||||
|
|| INarrative.class.isAssignableFrom(nextElementType)) {
|
||||||
|
def = new RuntimeChildNarrativeDefinition(
|
||||||
|
nextField, elementName, childAnnotation, descriptionAnnotation, nextDatatype);
|
||||||
} else {
|
} else {
|
||||||
def = new RuntimeChildCompositeDatatypeDefinition(nextField, elementName, childAnnotation, descriptionAnnotation, nextDatatype);
|
def = new RuntimeChildCompositeDatatypeDefinition(
|
||||||
|
nextField, elementName, childAnnotation, descriptionAnnotation, nextDatatype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new ConfigurationException(Msg.code(1707) + "Field '" + elementName + "' in type '" + declaringClass.getCanonicalName() + "' is not a valid child type: " + nextElementType);
|
throw new ConfigurationException(Msg.code(1707) + "Field '" + elementName + "' in type '"
|
||||||
|
+ declaringClass.getCanonicalName() + "' is not a valid child type: " + nextElementType);
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding bindingAnnotation = ModelScanner.pullAnnotation(nextField, Binding.class);
|
Binding bindingAnnotation = ModelScanner.pullAnnotation(nextField, Binding.class);
|
||||||
|
@ -448,7 +532,6 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
def.setBindingValueSet(bindingAnnotation.valueSet());
|
def.setBindingValueSet(bindingAnnotation.valueSet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def.setReplacedParentDefinition(replacedParent);
|
def.setReplacedParentDefinition(replacedParent);
|
||||||
|
@ -458,7 +541,9 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
if (mySealed == SealingStateEnum.SEALED) {
|
if (mySealed == SealingStateEnum.SEALED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -485,7 +570,8 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
}
|
}
|
||||||
for (String nextName : next.getValidChildNames()) {
|
for (String nextName : next.getValidChildNames()) {
|
||||||
if (myNameToChild.containsKey(nextName)) {
|
if (myNameToChild.containsKey(nextName)) {
|
||||||
throw new ConfigurationException(Msg.code(1708) + "Duplicate child name[" + nextName + "] in Element[" + getName() + "]");
|
throw new ConfigurationException(Msg.code(1708) + "Duplicate child name[" + nextName
|
||||||
|
+ "] in Element[" + getName() + "]");
|
||||||
}
|
}
|
||||||
myNameToChild.put(nextName, next);
|
myNameToChild.put(nextName, next);
|
||||||
}
|
}
|
||||||
|
@ -538,7 +624,6 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void validateSealed() {
|
protected void validateSealed() {
|
||||||
if (mySealed != SealingStateEnum.SEALED) {
|
if (mySealed != SealingStateEnum.SEALED) {
|
||||||
|
@ -610,7 +695,8 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int findIndex(List<BaseRuntimeChildDefinition> theChildren, String theName, boolean theDefaultAtEnd) {
|
private static int findIndex(
|
||||||
|
List<BaseRuntimeChildDefinition> theChildren, String theName, boolean theDefaultAtEnd) {
|
||||||
int index = theDefaultAtEnd ? theChildren.size() : -1;
|
int index = theDefaultAtEnd ? theChildren.size() : -1;
|
||||||
for (ListIterator<BaseRuntimeChildDefinition> iter = theChildren.listIterator(); iter.hasNext(); ) {
|
for (ListIterator<BaseRuntimeChildDefinition> iter = theChildren.listIterator(); iter.hasNext(); ) {
|
||||||
if (iter.next().getElementName().equals(theName)) {
|
if (iter.next().getElementName().equals(theName)) {
|
||||||
|
@ -620,5 +706,4 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,14 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
|
|
||||||
|
@ -47,7 +47,8 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
private Map<String, RuntimeChildDeclaredExtensionDefinition> myUrlToExtension = new HashMap<>();
|
private Map<String, RuntimeChildDeclaredExtensionDefinition> myUrlToExtension = new HashMap<>();
|
||||||
private BaseRuntimeElementDefinition<?> myRootParentDefinition;
|
private BaseRuntimeElementDefinition<?> myRootParentDefinition;
|
||||||
|
|
||||||
public BaseRuntimeElementDefinition(String theName, Class<? extends T> theImplementingClass, boolean theStandardType) {
|
public BaseRuntimeElementDefinition(
|
||||||
|
String theName, Class<? extends T> theImplementingClass, boolean theStandardType) {
|
||||||
assert StringUtils.isNotBlank(theName);
|
assert StringUtils.isNotBlank(theName);
|
||||||
assert theImplementingClass != null;
|
assert theImplementingClass != null;
|
||||||
|
|
||||||
|
@ -57,7 +58,6 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
name = name.substring(0, name.length() - 2);
|
name = name.substring(0, name.length() - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
myName = name;
|
myName = name;
|
||||||
myStandardType = theStandardType;
|
myStandardType = theStandardType;
|
||||||
myImplementingClass = theImplementingClass;
|
myImplementingClass = theImplementingClass;
|
||||||
|
@ -100,7 +100,8 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (retVal == null) {
|
if (retVal == null) {
|
||||||
throw new ConfigurationException(Msg.code(1695) + "Class " + getImplementingClass() + " has no constructor with a single argument of type " + argumentType);
|
throw new ConfigurationException(Msg.code(1695) + "Class " + getImplementingClass()
|
||||||
|
+ " has no constructor with a single argument of type " + argumentType);
|
||||||
}
|
}
|
||||||
myConstructors.put(argumentType, retVal);
|
myConstructors.put(argumentType, retVal);
|
||||||
}
|
}
|
||||||
|
@ -110,12 +111,15 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
/**
|
/**
|
||||||
* @return Returns null if none
|
* @return Returns null if none
|
||||||
*/
|
*/
|
||||||
public RuntimeChildDeclaredExtensionDefinition getDeclaredExtension(String theExtensionUrl, final String serverBaseUrl) {
|
public RuntimeChildDeclaredExtensionDefinition getDeclaredExtension(
|
||||||
|
String theExtensionUrl, final String serverBaseUrl) {
|
||||||
validateSealed();
|
validateSealed();
|
||||||
RuntimeChildDeclaredExtensionDefinition definition = myUrlToExtension.get(theExtensionUrl);
|
RuntimeChildDeclaredExtensionDefinition definition = myUrlToExtension.get(theExtensionUrl);
|
||||||
if (definition == null && StringUtils.isNotBlank(serverBaseUrl)) {
|
if (definition == null && StringUtils.isNotBlank(serverBaseUrl)) {
|
||||||
for (final Map.Entry<String, RuntimeChildDeclaredExtensionDefinition> entry : myUrlToExtension.entrySet()) {
|
for (final Map.Entry<String, RuntimeChildDeclaredExtensionDefinition> entry : myUrlToExtension.entrySet()) {
|
||||||
final String key = (!UrlUtil.isValid(entry.getKey()) && StringUtils.isNotBlank(serverBaseUrl)) ? serverBaseUrl + entry.getKey() : entry.getKey();
|
final String key = (!UrlUtil.isValid(entry.getKey()) && StringUtils.isNotBlank(serverBaseUrl))
|
||||||
|
? serverBaseUrl + entry.getKey()
|
||||||
|
: entry.getKey();
|
||||||
if (key.equals(theExtensionUrl)) {
|
if (key.equals(theExtensionUrl)) {
|
||||||
definition = entry.getValue();
|
definition = entry.getValue();
|
||||||
break;
|
break;
|
||||||
|
@ -173,7 +177,10 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
return getConstructor(theArgument).newInstance(theArgument);
|
return getConstructor(theArgument).newInstance(theArgument);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ConfigurationException(Msg.code(1696) + "Failed to instantiate type:" + getImplementingClass().getName(), e);
|
throw new ConfigurationException(
|
||||||
|
Msg.code(1696) + "Failed to instantiate type:"
|
||||||
|
+ getImplementingClass().getName(),
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +194,9 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
*
|
*
|
||||||
* @param theContext TODO
|
* @param theContext TODO
|
||||||
*/
|
*/
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
for (BaseRuntimeChildDefinition next : myExtensions) {
|
for (BaseRuntimeChildDefinition next : myExtensions) {
|
||||||
next.sealAndInitialize(theContext, theClassToElementDefinitions);
|
next.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
}
|
}
|
||||||
|
@ -195,7 +204,8 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
for (RuntimeChildDeclaredExtensionDefinition next : myExtensions) {
|
for (RuntimeChildDeclaredExtensionDefinition next : myExtensions) {
|
||||||
String extUrl = next.getExtensionUrl();
|
String extUrl = next.getExtensionUrl();
|
||||||
if (myUrlToExtension.containsKey(extUrl)) {
|
if (myUrlToExtension.containsKey(extUrl)) {
|
||||||
throw new ConfigurationException(Msg.code(1697) + "Duplicate extension URL[" + extUrl + "] in Element[" + getName() + "]");
|
throw new ConfigurationException(
|
||||||
|
Msg.code(1697) + "Duplicate extension URL[" + extUrl + "] in Element[" + getName() + "]");
|
||||||
}
|
}
|
||||||
myUrlToExtension.put(extUrl, next);
|
myUrlToExtension.put(extUrl, next);
|
||||||
if (next.isModifier()) {
|
if (next.isModifier()) {
|
||||||
|
@ -203,7 +213,6 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
} else {
|
} else {
|
||||||
myExtensionsNonModifier.add(next);
|
myExtensionsNonModifier.add(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
myExtensions = Collections.unmodifiableList(myExtensions);
|
myExtensions = Collections.unmodifiableList(myExtensions);
|
||||||
|
@ -216,12 +225,12 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
}
|
}
|
||||||
parent = parent.getSuperclass();
|
parent = parent.getSuperclass();
|
||||||
} while (!parent.equals(Object.class));
|
} while (!parent.equals(Object.class));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getSimpleName() + "[" + getName() + ", " + getImplementingClass().getSimpleName() + "]";
|
return getClass().getSimpleName() + "[" + getName() + ", "
|
||||||
|
+ getImplementingClass().getSimpleName() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void validateSealed() {
|
protected void validateSealed() {
|
||||||
|
@ -245,7 +254,8 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
/**
|
/**
|
||||||
* HAPI structure style.
|
* HAPI structure style.
|
||||||
*/
|
*/
|
||||||
CONTAINED_RESOURCES, EXTENSION_DECLARED,
|
CONTAINED_RESOURCES,
|
||||||
|
EXTENSION_DECLARED,
|
||||||
ID_DATATYPE,
|
ID_DATATYPE,
|
||||||
PRIMITIVE_DATATYPE,
|
PRIMITIVE_DATATYPE,
|
||||||
/**
|
/**
|
||||||
|
@ -260,7 +270,5 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
RESOURCE_BLOCK,
|
RESOURCE_BLOCK,
|
||||||
|
|
||||||
UNDECL_EXT,
|
UNDECL_EXT,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
public enum ComboSearchParamType {
|
public enum ComboSearchParamType {
|
||||||
|
|
||||||
UNIQUE,
|
UNIQUE,
|
||||||
NON_UNIQUE
|
NON_UNIQUE
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,5 +42,4 @@ public class ConfigurationException extends RuntimeException {
|
||||||
public ConfigurationException(Throwable theCause) {
|
public ConfigurationException(Throwable theCause) {
|
||||||
super(theCause);
|
super(theCause);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,6 @@ import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
@ -75,6 +73,8 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The FHIR context is the central starting point for the use of the HAPI FHIR API. It should be created once, and then
|
* The FHIR context is the central starting point for the use of the HAPI FHIR API. It should be created once, and then
|
||||||
|
@ -100,14 +100,16 @@ import java.util.Set;
|
||||||
public class FhirContext {
|
public class FhirContext {
|
||||||
|
|
||||||
private static final List<Class<? extends IBaseResource>> EMPTY_LIST = Collections.emptyList();
|
private static final List<Class<? extends IBaseResource>> EMPTY_LIST = Collections.emptyList();
|
||||||
private static final Map<FhirVersionEnum, FhirContext> ourStaticContexts = Collections.synchronizedMap(new EnumMap<>(FhirVersionEnum.class));
|
private static final Map<FhirVersionEnum, FhirContext> ourStaticContexts =
|
||||||
|
Collections.synchronizedMap(new EnumMap<>(FhirVersionEnum.class));
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirContext.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirContext.class);
|
||||||
private final IFhirVersion myVersion;
|
private final IFhirVersion myVersion;
|
||||||
private final Map<String, Class<? extends IBaseResource>> myDefaultTypeForProfile = new HashMap<>();
|
private final Map<String, Class<? extends IBaseResource>> myDefaultTypeForProfile = new HashMap<>();
|
||||||
private final Set<PerformanceOptionsEnum> myPerformanceOptions = new HashSet<>();
|
private final Set<PerformanceOptionsEnum> myPerformanceOptions = new HashSet<>();
|
||||||
private final Collection<Class<? extends IBaseResource>> myResourceTypesToScan;
|
private final Collection<Class<? extends IBaseResource>> myResourceTypesToScan;
|
||||||
private AddProfileTagEnum myAddProfileTagWhenEncoding = AddProfileTagEnum.ONLY_FOR_CUSTOM;
|
private AddProfileTagEnum myAddProfileTagWhenEncoding = AddProfileTagEnum.ONLY_FOR_CUSTOM;
|
||||||
private volatile Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> myClassToElementDefinition = Collections.emptyMap();
|
private volatile Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> myClassToElementDefinition =
|
||||||
|
Collections.emptyMap();
|
||||||
private ArrayList<Class<? extends IBase>> myCustomTypes;
|
private ArrayList<Class<? extends IBase>> myCustomTypes;
|
||||||
private volatile Map<String, RuntimeResourceDefinition> myIdToResourceDefinition = Collections.emptyMap();
|
private volatile Map<String, RuntimeResourceDefinition> myIdToResourceDefinition = Collections.emptyMap();
|
||||||
private volatile boolean myInitialized;
|
private volatile boolean myInitialized;
|
||||||
|
@ -122,7 +124,8 @@ public class FhirContext {
|
||||||
private volatile IRestfulClientFactory myRestfulClientFactory;
|
private volatile IRestfulClientFactory myRestfulClientFactory;
|
||||||
private volatile RuntimeChildUndeclaredExtensionDefinition myRuntimeChildUndeclaredExtensionDefinition;
|
private volatile RuntimeChildUndeclaredExtensionDefinition myRuntimeChildUndeclaredExtensionDefinition;
|
||||||
private IValidationSupport myValidationSupport;
|
private IValidationSupport myValidationSupport;
|
||||||
private Map<FhirVersionEnum, Map<String, Class<? extends IBaseResource>>> myVersionToNameToResourceType = Collections.emptyMap();
|
private Map<FhirVersionEnum, Map<String, Class<? extends IBaseResource>>> myVersionToNameToResourceType =
|
||||||
|
Collections.emptyMap();
|
||||||
private volatile Set<String> myResourceNames;
|
private volatile Set<String> myResourceNames;
|
||||||
private volatile Boolean myFormatXmlSupported;
|
private volatile Boolean myFormatXmlSupported;
|
||||||
private volatile Boolean myFormatJsonSupported;
|
private volatile Boolean myFormatJsonSupported;
|
||||||
|
@ -175,12 +178,15 @@ public class FhirContext {
|
||||||
this(theVersion, null);
|
this(theVersion, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FhirContext(final FhirVersionEnum theVersion, final Collection<Class<? extends IBaseResource>> theResourceTypes) {
|
private FhirContext(
|
||||||
|
final FhirVersionEnum theVersion, final Collection<Class<? extends IBaseResource>> theResourceTypes) {
|
||||||
VersionUtil.getVersion();
|
VersionUtil.getVersion();
|
||||||
|
|
||||||
if (theVersion != null) {
|
if (theVersion != null) {
|
||||||
if (!theVersion.isPresentOnClasspath()) {
|
if (!theVersion.isPresentOnClasspath()) {
|
||||||
throw new IllegalStateException(Msg.code(1680) + getLocalizer().getMessage(FhirContext.class, "noStructuresForSpecifiedVersion", theVersion.name()));
|
throw new IllegalStateException(Msg.code(1680)
|
||||||
|
+ getLocalizer()
|
||||||
|
.getMessage(FhirContext.class, "noStructuresForSpecifiedVersion", theVersion.name()));
|
||||||
}
|
}
|
||||||
myVersion = theVersion.getVersionImplementation();
|
myVersion = theVersion.getVersionImplementation();
|
||||||
} else if (FhirVersionEnum.DSTU2.isPresentOnClasspath()) {
|
} else if (FhirVersionEnum.DSTU2.isPresentOnClasspath()) {
|
||||||
|
@ -196,18 +202,25 @@ public class FhirContext {
|
||||||
} else if (FhirVersionEnum.R4B.isPresentOnClasspath()) {
|
} else if (FhirVersionEnum.R4B.isPresentOnClasspath()) {
|
||||||
myVersion = FhirVersionEnum.R4B.getVersionImplementation();
|
myVersion = FhirVersionEnum.R4B.getVersionImplementation();
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException(Msg.code(1681) + getLocalizer().getMessage(FhirContext.class, "noStructures"));
|
throw new IllegalStateException(
|
||||||
|
Msg.code(1681) + getLocalizer().getMessage(FhirContext.class, "noStructures"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theVersion == null) {
|
if (theVersion == null) {
|
||||||
ourLog.info("Creating new FhirContext with auto-detected version [{}]. It is recommended to explicitly select a version for future compatibility by invoking FhirContext.forDstuX()",
|
ourLog.info(
|
||||||
|
"Creating new FhirContext with auto-detected version [{}]. It is recommended to explicitly select a version for future compatibility by invoking FhirContext.forDstuX()",
|
||||||
myVersion.getVersion().name());
|
myVersion.getVersion().name());
|
||||||
} else {
|
} else {
|
||||||
if (HapiSystemProperties.isUnitTestModeEnabled()) {
|
if (HapiSystemProperties.isUnitTestModeEnabled()) {
|
||||||
String calledAt = ExceptionUtils.getStackFrames(new Throwable())[4];
|
String calledAt = ExceptionUtils.getStackFrames(new Throwable())[4];
|
||||||
ourLog.info("Creating new FHIR context for FHIR version [{}]{}", myVersion.getVersion().name(), calledAt);
|
ourLog.info(
|
||||||
|
"Creating new FHIR context for FHIR version [{}]{}",
|
||||||
|
myVersion.getVersion().name(),
|
||||||
|
calledAt);
|
||||||
} else {
|
} else {
|
||||||
ourLog.info("Creating new FHIR context for FHIR version [{}]", myVersion.getVersion().name());
|
ourLog.info(
|
||||||
|
"Creating new FHIR context for FHIR version [{}]",
|
||||||
|
myVersion.getVersion().name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,10 +241,8 @@ public class FhirContext {
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
ourLog.trace("Android mode not detected");
|
ourLog.trace("Android mode not detected");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.6.0
|
* @since 5.6.0
|
||||||
*/
|
*/
|
||||||
|
@ -246,7 +257,6 @@ public class FhirContext {
|
||||||
return forCached(FhirVersionEnum.DSTU2_HL7ORG);
|
return forCached(FhirVersionEnum.DSTU2_HL7ORG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.5.0
|
* @since 5.5.0
|
||||||
*/
|
*/
|
||||||
|
@ -475,7 +485,9 @@ public class FhirContext {
|
||||||
Validate.notNull(theResourceType, "theResourceType can not be null");
|
Validate.notNull(theResourceType, "theResourceType can not be null");
|
||||||
|
|
||||||
if (Modifier.isAbstract(theResourceType.getModifiers())) {
|
if (Modifier.isAbstract(theResourceType.getModifiers())) {
|
||||||
throw new IllegalArgumentException(Msg.code(1682) + "Can not scan abstract or interface class (resource definitions must be concrete classes): " + theResourceType.getName());
|
throw new IllegalArgumentException(Msg.code(1682)
|
||||||
|
+ "Can not scan abstract or interface class (resource definitions must be concrete classes): "
|
||||||
|
+ theResourceType.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
RuntimeResourceDefinition retVal = (RuntimeResourceDefinition) myClassToElementDefinition.get(theResourceType);
|
RuntimeResourceDefinition retVal = (RuntimeResourceDefinition) myClassToElementDefinition.get(theResourceType);
|
||||||
|
@ -486,7 +498,8 @@ public class FhirContext {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RuntimeResourceDefinition getResourceDefinition(final FhirVersionEnum theVersion, final String theResourceName) {
|
public RuntimeResourceDefinition getResourceDefinition(
|
||||||
|
final FhirVersionEnum theVersion, final String theResourceName) {
|
||||||
Validate.notNull(theVersion, "theVersion can not be null");
|
Validate.notNull(theVersion, "theVersion can not be null");
|
||||||
validateInitialized();
|
validateInitialized();
|
||||||
|
|
||||||
|
@ -500,7 +513,8 @@ public class FhirContext {
|
||||||
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> existing = new HashMap<>();
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> existing = new HashMap<>();
|
||||||
ModelScanner.scanVersionPropertyFile(null, nameToType, theVersion, existing);
|
ModelScanner.scanVersionPropertyFile(null, nameToType, theVersion, existing);
|
||||||
|
|
||||||
Map<FhirVersionEnum, Map<String, Class<? extends IBaseResource>>> newVersionToNameToResourceType = new HashMap<>();
|
Map<FhirVersionEnum, Map<String, Class<? extends IBaseResource>>> newVersionToNameToResourceType =
|
||||||
|
new HashMap<>();
|
||||||
newVersionToNameToResourceType.putAll(myVersionToNameToResourceType);
|
newVersionToNameToResourceType.putAll(myVersionToNameToResourceType);
|
||||||
newVersionToNameToResourceType.put(theVersion, nameToType);
|
newVersionToNameToResourceType.put(theVersion, nameToType);
|
||||||
myVersionToNameToResourceType = newVersionToNameToResourceType;
|
myVersionToNameToResourceType = newVersionToNameToResourceType;
|
||||||
|
@ -575,7 +589,8 @@ public class FhirContext {
|
||||||
// Multiple spots in HAPI FHIR and Smile CDR depend on DataFormatException
|
// Multiple spots in HAPI FHIR and Smile CDR depend on DataFormatException
|
||||||
// being thrown by this method, don't change that.
|
// being thrown by this method, don't change that.
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
throw new DataFormatException(Msg.code(1684) + createUnknownResourceNameError(theResourceName, myVersion.getVersion()));
|
throw new DataFormatException(
|
||||||
|
Msg.code(1684) + createUnknownResourceNameError(theResourceName, myVersion.getVersion()));
|
||||||
}
|
}
|
||||||
if (IBaseResource.class.isAssignableFrom(clazz)) {
|
if (IBaseResource.class.isAssignableFrom(clazz)) {
|
||||||
retVal = scanResourceType(clazz);
|
retVal = scanResourceType(clazz);
|
||||||
|
@ -645,9 +660,13 @@ public class FhirContext {
|
||||||
public IRestfulClientFactory getRestfulClientFactory() {
|
public IRestfulClientFactory getRestfulClientFactory() {
|
||||||
if (myRestfulClientFactory == null) {
|
if (myRestfulClientFactory == null) {
|
||||||
try {
|
try {
|
||||||
myRestfulClientFactory = (IRestfulClientFactory) ReflectionUtil.newInstance(Class.forName("ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory"), FhirContext.class, this);
|
myRestfulClientFactory = (IRestfulClientFactory) ReflectionUtil.newInstance(
|
||||||
|
Class.forName("ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory"),
|
||||||
|
FhirContext.class,
|
||||||
|
this);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new ConfigurationException(Msg.code(1686) + "hapi-fhir-client does not appear to be on the classpath");
|
throw new ConfigurationException(
|
||||||
|
Msg.code(1686) + "hapi-fhir-client does not appear to be on the classpath");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return myRestfulClientFactory;
|
return myRestfulClientFactory;
|
||||||
|
@ -684,20 +703,31 @@ public class FhirContext {
|
||||||
* If hapi-fhir-validation is on the classpath, we can create a much more robust
|
* If hapi-fhir-validation is on the classpath, we can create a much more robust
|
||||||
* validation chain using the classes found in that package
|
* validation chain using the classes found in that package
|
||||||
*/
|
*/
|
||||||
String inMemoryTermSvcType = "org.hl7.fhir.common.hapi.validation.support.InMemoryTerminologyServerValidationSupport";
|
String inMemoryTermSvcType =
|
||||||
String commonCodeSystemsSupportType = "org.hl7.fhir.common.hapi.validation.support.CommonCodeSystemsTerminologyService";
|
"org.hl7.fhir.common.hapi.validation.support.InMemoryTerminologyServerValidationSupport";
|
||||||
|
String commonCodeSystemsSupportType =
|
||||||
|
"org.hl7.fhir.common.hapi.validation.support.CommonCodeSystemsTerminologyService";
|
||||||
if (ReflectionUtil.typeExists(inMemoryTermSvcType)) {
|
if (ReflectionUtil.typeExists(inMemoryTermSvcType)) {
|
||||||
IValidationSupport inMemoryTermSvc = ReflectionUtil.newInstanceOrReturnNull(inMemoryTermSvcType, IValidationSupport.class, new Class<?>[]{FhirContext.class}, new Object[]{this});
|
IValidationSupport inMemoryTermSvc = ReflectionUtil.newInstanceOrReturnNull(
|
||||||
IValidationSupport commonCodeSystemsSupport = ReflectionUtil.newInstanceOrReturnNull(commonCodeSystemsSupportType, IValidationSupport.class, new Class<?>[]{FhirContext.class}, new Object[]{this});
|
inMemoryTermSvcType,
|
||||||
retVal = ReflectionUtil.newInstanceOrReturnNull("org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain", IValidationSupport.class, new Class<?>[]{IValidationSupport[].class}, new Object[]{new IValidationSupport[]{
|
IValidationSupport.class,
|
||||||
retVal,
|
new Class<?>[] {FhirContext.class},
|
||||||
inMemoryTermSvc,
|
new Object[] {this});
|
||||||
commonCodeSystemsSupport
|
IValidationSupport commonCodeSystemsSupport = ReflectionUtil.newInstanceOrReturnNull(
|
||||||
}});
|
commonCodeSystemsSupportType,
|
||||||
assert retVal != null : "Failed to instantiate " + "org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain";
|
IValidationSupport.class,
|
||||||
|
new Class<?>[] {FhirContext.class},
|
||||||
|
new Object[] {this});
|
||||||
|
retVal = ReflectionUtil.newInstanceOrReturnNull(
|
||||||
|
"org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain",
|
||||||
|
IValidationSupport.class,
|
||||||
|
new Class<?>[] {IValidationSupport[].class},
|
||||||
|
new Object[] {new IValidationSupport[] {retVal, inMemoryTermSvc, commonCodeSystemsSupport}});
|
||||||
|
assert retVal != null
|
||||||
|
: "Failed to instantiate "
|
||||||
|
+ "org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
myValidationSupport = retVal;
|
myValidationSupport = retVal;
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
|
@ -1005,7 +1035,8 @@ public class FhirContext {
|
||||||
return (RuntimeResourceDefinition) defs.get(theResourceType);
|
return (RuntimeResourceDefinition) defs.get(theResourceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> scanResourceTypes(final Collection<Class<? extends IElement>> theResourceTypes) {
|
private synchronized Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> scanResourceTypes(
|
||||||
|
final Collection<Class<? extends IElement>> theResourceTypes) {
|
||||||
List<Class<? extends IBase>> typesToScan = new ArrayList<>();
|
List<Class<? extends IBase>> typesToScan = new ArrayList<>();
|
||||||
if (theResourceTypes != null) {
|
if (theResourceTypes != null) {
|
||||||
typesToScan.addAll(theResourceTypes);
|
typesToScan.addAll(theResourceTypes);
|
||||||
|
@ -1022,7 +1053,8 @@ public class FhirContext {
|
||||||
|
|
||||||
Map<String, BaseRuntimeElementDefinition<?>> nameToElementDefinition = new HashMap<>();
|
Map<String, BaseRuntimeElementDefinition<?>> nameToElementDefinition = new HashMap<>();
|
||||||
nameToElementDefinition.putAll(myNameToElementDefinition);
|
nameToElementDefinition.putAll(myNameToElementDefinition);
|
||||||
for (Entry<String, BaseRuntimeElementDefinition<?>> next : scanner.getNameToElementDefinitions().entrySet()) {
|
for (Entry<String, BaseRuntimeElementDefinition<?>> next :
|
||||||
|
scanner.getNameToElementDefinitions().entrySet()) {
|
||||||
if (!nameToElementDefinition.containsKey(next.getKey())) {
|
if (!nameToElementDefinition.containsKey(next.getKey())) {
|
||||||
nameToElementDefinition.put(next.getKey().toLowerCase(), next.getValue());
|
nameToElementDefinition.put(next.getKey().toLowerCase(), next.getValue());
|
||||||
}
|
}
|
||||||
|
@ -1030,7 +1062,8 @@ public class FhirContext {
|
||||||
|
|
||||||
Map<String, RuntimeResourceDefinition> nameToResourceDefinition = new HashMap<>();
|
Map<String, RuntimeResourceDefinition> nameToResourceDefinition = new HashMap<>();
|
||||||
nameToResourceDefinition.putAll(myNameToResourceDefinition);
|
nameToResourceDefinition.putAll(myNameToResourceDefinition);
|
||||||
for (Entry<String, RuntimeResourceDefinition> next : scanner.getNameToResourceDefinition().entrySet()) {
|
for (Entry<String, RuntimeResourceDefinition> next :
|
||||||
|
scanner.getNameToResourceDefinition().entrySet()) {
|
||||||
if (!nameToResourceDefinition.containsKey(next.getKey())) {
|
if (!nameToResourceDefinition.containsKey(next.getKey())) {
|
||||||
nameToResourceDefinition.put(next.getKey(), next.getValue());
|
nameToResourceDefinition.put(next.getKey(), next.getValue());
|
||||||
}
|
}
|
||||||
|
@ -1043,7 +1076,8 @@ public class FhirContext {
|
||||||
if (next instanceof RuntimeResourceDefinition) {
|
if (next instanceof RuntimeResourceDefinition) {
|
||||||
if ("Bundle".equals(next.getName())) {
|
if ("Bundle".equals(next.getName())) {
|
||||||
if (!IBaseBundle.class.isAssignableFrom(next.getImplementingClass())) {
|
if (!IBaseBundle.class.isAssignableFrom(next.getImplementingClass())) {
|
||||||
throw new ConfigurationException(Msg.code(1687) + "Resource type declares resource name Bundle but does not implement IBaseBundle");
|
throw new ConfigurationException(Msg.code(1687)
|
||||||
|
+ "Resource type declares resource name Bundle but does not implement IBaseBundle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1111,7 +1145,8 @@ public class FhirContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"cast"})
|
@SuppressWarnings({"cast"})
|
||||||
private List<Class<? extends IElement>> toElementList(final Collection<Class<? extends IBaseResource>> theResourceTypes) {
|
private List<Class<? extends IElement>> toElementList(
|
||||||
|
final Collection<Class<? extends IBaseResource>> theResourceTypes) {
|
||||||
if (theResourceTypes == null) {
|
if (theResourceTypes == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1146,13 +1181,15 @@ public class FhirContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPrimitiveType<Boolean> newPrimitiveBoolean(Boolean theValue) {
|
public IPrimitiveType<Boolean> newPrimitiveBoolean(Boolean theValue) {
|
||||||
IPrimitiveType<Boolean> retval = (IPrimitiveType<Boolean>) getElementDefinition("boolean").newInstance();
|
IPrimitiveType<Boolean> retval =
|
||||||
|
(IPrimitiveType<Boolean>) getElementDefinition("boolean").newInstance();
|
||||||
retval.setValue(theValue);
|
retval.setValue(theValue);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPrimitiveType<String> newPrimitiveString(String theValue) {
|
public IPrimitiveType<String> newPrimitiveString(String theValue) {
|
||||||
IPrimitiveType<String> retval = (IPrimitiveType<String>) getElementDefinition("string").newInstance();
|
IPrimitiveType<String> retval =
|
||||||
|
(IPrimitiveType<String>) getElementDefinition("string").newInstance();
|
||||||
retval.setValue(theValue);
|
retval.setValue(theValue);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -1237,7 +1274,8 @@ public class FhirContext {
|
||||||
return ourStaticContexts.computeIfAbsent(theFhirVersionEnum, v -> new FhirContext(v));
|
return ourStaticContexts.computeIfAbsent(theFhirVersionEnum, v -> new FhirContext(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Collection<Class<? extends IBaseResource>> toCollection(Class<? extends IBaseResource> theResourceType) {
|
private static Collection<Class<? extends IBaseResource>> toCollection(
|
||||||
|
Class<? extends IBaseResource> theResourceType) {
|
||||||
ArrayList<Class<? extends IBaseResource>> retVal = new ArrayList<>(1);
|
ArrayList<Class<? extends IBaseResource>> retVal = new ArrayList<>(1);
|
||||||
retVal.add(theResourceType);
|
retVal.add(theResourceType);
|
||||||
return retVal;
|
return retVal;
|
||||||
|
@ -1248,11 +1286,11 @@ public class FhirContext {
|
||||||
ArrayList<Class<? extends IBaseResource>> retVal = new ArrayList<Class<? extends IBaseResource>>(1);
|
ArrayList<Class<? extends IBaseResource>> retVal = new ArrayList<Class<? extends IBaseResource>>(1);
|
||||||
for (Class<?> clazz : theResourceTypes) {
|
for (Class<?> clazz : theResourceTypes) {
|
||||||
if (!IResource.class.isAssignableFrom(clazz)) {
|
if (!IResource.class.isAssignableFrom(clazz)) {
|
||||||
throw new IllegalArgumentException(Msg.code(1688) + clazz.getCanonicalName() + " is not an instance of " + IResource.class.getSimpleName());
|
throw new IllegalArgumentException(Msg.code(1688) + clazz.getCanonicalName() + " is not an instance of "
|
||||||
|
+ IResource.class.getSimpleName());
|
||||||
}
|
}
|
||||||
retVal.add((Class<? extends IResource>) clazz);
|
retVal.add((Class<? extends IResource>) clazz);
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,11 @@ public enum FhirVersionEnum {
|
||||||
private volatile IFhirVersion myVersionImplementation;
|
private volatile IFhirVersion myVersionImplementation;
|
||||||
private String myFhirVersionString;
|
private String myFhirVersionString;
|
||||||
|
|
||||||
FhirVersionEnum(String theVersionClass, FhirVersionEnum theEquivalent, boolean theIsRi, IVersionProvider theVersionExtractor) {
|
FhirVersionEnum(
|
||||||
|
String theVersionClass,
|
||||||
|
FhirVersionEnum theEquivalent,
|
||||||
|
boolean theIsRi,
|
||||||
|
IVersionProvider theVersionExtractor) {
|
||||||
myVersionClass = theVersionClass;
|
myVersionClass = theVersionClass;
|
||||||
myEquivalent = theEquivalent;
|
myEquivalent = theEquivalent;
|
||||||
myFhirVersionString = theVersionExtractor.provideVersion();
|
myFhirVersionString = theVersionExtractor.provideVersion();
|
||||||
|
@ -74,7 +78,8 @@ public enum FhirVersionEnum {
|
||||||
}
|
}
|
||||||
if (myVersionImplementation == null) {
|
if (myVersionImplementation == null) {
|
||||||
try {
|
try {
|
||||||
myVersionImplementation = (IFhirVersion) Class.forName(myVersionClass).newInstance();
|
myVersionImplementation =
|
||||||
|
(IFhirVersion) Class.forName(myVersionClass).newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new InternalErrorException(Msg.code(1710) + "Failed to instantiate FHIR version " + name(), e);
|
throw new InternalErrorException(Msg.code(1710) + "Failed to instantiate FHIR version " + name(), e);
|
||||||
}
|
}
|
||||||
|
@ -143,7 +148,6 @@ public enum FhirVersionEnum {
|
||||||
return FhirContext.forCached(this);
|
return FhirContext.forCached(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private interface IVersionProvider {
|
private interface IVersionProvider {
|
||||||
String provideVersion();
|
String provideVersion();
|
||||||
}
|
}
|
||||||
|
@ -168,7 +172,6 @@ public enum FhirVersionEnum {
|
||||||
default:
|
default:
|
||||||
return determineVersionForType(theFhirType.getSuperclass());
|
return determineVersionForType(theFhirType.getSuperclass());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Version implements IVersionProvider {
|
private static class Version implements IVersionProvider {
|
||||||
|
@ -184,7 +187,6 @@ public enum FhirVersionEnum {
|
||||||
public String provideVersion() {
|
public String provideVersion() {
|
||||||
return myVersion;
|
return myVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -208,7 +210,6 @@ public enum FhirVersionEnum {
|
||||||
public String provideVersion() {
|
public String provideVersion() {
|
||||||
return myVersion;
|
return myVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class R4Version implements IVersionProvider {
|
private static class R4Version implements IVersionProvider {
|
||||||
|
@ -228,7 +229,6 @@ public enum FhirVersionEnum {
|
||||||
public String provideVersion() {
|
public String provideVersion() {
|
||||||
return myVersion;
|
return myVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class R4BVersion implements IVersionProvider {
|
private static class R4BVersion implements IVersionProvider {
|
||||||
|
@ -248,7 +248,6 @@ public enum FhirVersionEnum {
|
||||||
public String provideVersion() {
|
public String provideVersion() {
|
||||||
return myVersion;
|
return myVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class R5Version implements IVersionProvider {
|
private static class R5Version implements IVersionProvider {
|
||||||
|
@ -268,7 +267,6 @@ public enum FhirVersionEnum {
|
||||||
public String provideVersion() {
|
public String provideVersion() {
|
||||||
return myVersion;
|
return myVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -312,5 +310,4 @@ public enum FhirVersionEnum {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,5 +31,4 @@ public interface IRuntimeDatatypeDefinition {
|
||||||
boolean isProfileOf(Class<? extends IBaseDatatype> theType);
|
boolean isProfileOf(Class<? extends IBaseDatatype> theType);
|
||||||
|
|
||||||
public Class<? extends IBase> getImplementingClass();
|
public Class<? extends IBase> getImplementingClass();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
|
@ -68,6 +67,7 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
|
|
||||||
|
@ -85,8 +85,12 @@ class ModelScanner {
|
||||||
|
|
||||||
private Set<Class<? extends IBase>> myVersionTypes;
|
private Set<Class<? extends IBase>> myVersionTypes;
|
||||||
|
|
||||||
ModelScanner(FhirContext theContext, FhirVersionEnum theVersion, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theExistingDefinitions,
|
ModelScanner(
|
||||||
@Nonnull Collection<Class<? extends IBase>> theResourceTypes) throws ConfigurationException {
|
FhirContext theContext,
|
||||||
|
FhirVersionEnum theVersion,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theExistingDefinitions,
|
||||||
|
@Nonnull Collection<Class<? extends IBase>> theResourceTypes)
|
||||||
|
throws ConfigurationException {
|
||||||
myContext = theContext;
|
myContext = theContext;
|
||||||
myVersion = theVersion;
|
myVersion = theVersion;
|
||||||
|
|
||||||
|
@ -118,7 +122,9 @@ class ModelScanner {
|
||||||
return myRuntimeChildUndeclaredExtensionDefinition;
|
return myRuntimeChildUndeclaredExtensionDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theExistingDefinitions, Set<Class<? extends IBase>> theTypesToScan) {
|
private void init(
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theExistingDefinitions,
|
||||||
|
Set<Class<? extends IBase>> theTypesToScan) {
|
||||||
if (theExistingDefinitions != null) {
|
if (theExistingDefinitions != null) {
|
||||||
myClassToElementDefinitions.putAll(theExistingDefinitions);
|
myClassToElementDefinitions.putAll(theExistingDefinitions);
|
||||||
}
|
}
|
||||||
|
@ -140,7 +146,8 @@ class ModelScanner {
|
||||||
myScanAlso.clear();
|
myScanAlso.clear();
|
||||||
} while (!typesToScan.isEmpty());
|
} while (!typesToScan.isEmpty());
|
||||||
|
|
||||||
for (Entry<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> nextEntry : myClassToElementDefinitions.entrySet()) {
|
for (Entry<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> nextEntry :
|
||||||
|
myClassToElementDefinitions.entrySet()) {
|
||||||
if (theExistingDefinitions != null && theExistingDefinitions.containsKey(nextEntry.getKey())) {
|
if (theExistingDefinitions != null && theExistingDefinitions.containsKey(nextEntry.getKey())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +185,9 @@ class ModelScanner {
|
||||||
ResourceDef resourceDefinition = pullAnnotation(theClass, ResourceDef.class);
|
ResourceDef resourceDefinition = pullAnnotation(theClass, ResourceDef.class);
|
||||||
if (resourceDefinition != null) {
|
if (resourceDefinition != null) {
|
||||||
if (!IBaseResource.class.isAssignableFrom(theClass)) {
|
if (!IBaseResource.class.isAssignableFrom(theClass)) {
|
||||||
throw new ConfigurationException(Msg.code(1714) + "Resource type contains a @" + ResourceDef.class.getSimpleName() + " annotation but does not implement " + IResource.class.getCanonicalName() + ": " + theClass.getCanonicalName());
|
throw new ConfigurationException(Msg.code(1714) + "Resource type contains a @"
|
||||||
|
+ ResourceDef.class.getSimpleName() + " annotation but does not implement "
|
||||||
|
+ IResource.class.getCanonicalName() + ": " + theClass.getCanonicalName());
|
||||||
}
|
}
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Class<? extends IBaseResource> resClass = (Class<? extends IBaseResource>) theClass;
|
Class<? extends IBaseResource> resClass = (Class<? extends IBaseResource>) theClass;
|
||||||
|
@ -204,10 +213,14 @@ class ModelScanner {
|
||||||
Block blockDefinition = pullAnnotation(theClass, Block.class);
|
Block blockDefinition = pullAnnotation(theClass, Block.class);
|
||||||
|
|
||||||
if (blockDefinition != null) {
|
if (blockDefinition != null) {
|
||||||
if (IResourceBlock.class.isAssignableFrom(theClass) || IBaseBackboneElement.class.isAssignableFrom(theClass) || IBaseDatatypeElement.class.isAssignableFrom(theClass)) {
|
if (IResourceBlock.class.isAssignableFrom(theClass)
|
||||||
|
|| IBaseBackboneElement.class.isAssignableFrom(theClass)
|
||||||
|
|| IBaseDatatypeElement.class.isAssignableFrom(theClass)) {
|
||||||
scanBlock(theClass);
|
scanBlock(theClass);
|
||||||
} else {
|
} else {
|
||||||
throw new ConfigurationException(Msg.code(1715) + "Type contains a @" + Block.class.getSimpleName() + " annotation but does not implement " + IResourceBlock.class.getCanonicalName() + ": " + theClass.getCanonicalName());
|
throw new ConfigurationException(Msg.code(1715) + "Type contains a @" + Block.class.getSimpleName()
|
||||||
|
+ " annotation but does not implement " + IResourceBlock.class.getCanonicalName() + ": "
|
||||||
|
+ theClass.getCanonicalName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +229,8 @@ class ModelScanner {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ConfigurationException(Msg.code(1716) + "Resource class[" + theClass.getName() + "] does not contain any valid HAPI-FHIR annotations");
|
throw new ConfigurationException(Msg.code(1716) + "Resource class[" + theClass.getName()
|
||||||
|
+ "] does not contain any valid HAPI-FHIR annotations");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,11 +242,14 @@ class ModelScanner {
|
||||||
// Just in case someone messes up when upgrading from DSTU2
|
// Just in case someone messes up when upgrading from DSTU2
|
||||||
if (myContext.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
|
if (myContext.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
|
||||||
if (BaseIdentifiableElement.class.isAssignableFrom(theClass)) {
|
if (BaseIdentifiableElement.class.isAssignableFrom(theClass)) {
|
||||||
throw new ConfigurationException(Msg.code(1717) + "@Block class for version " + myContext.getVersion().getVersion().name() + " should not extend " + BaseIdentifiableElement.class.getSimpleName() + ": " + theClass.getName());
|
throw new ConfigurationException(Msg.code(1717) + "@Block class for version "
|
||||||
|
+ myContext.getVersion().getVersion().name() + " should not extend "
|
||||||
|
+ BaseIdentifiableElement.class.getSimpleName() + ": " + theClass.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RuntimeResourceBlockDefinition blockDef = new RuntimeResourceBlockDefinition(blockName, theClass, isStandardType(theClass), myContext, myClassToElementDefinitions);
|
RuntimeResourceBlockDefinition blockDef = new RuntimeResourceBlockDefinition(
|
||||||
|
blockName, theClass, isStandardType(theClass), myContext, myClassToElementDefinitions);
|
||||||
blockDef.populateScanAlso(myScanAlso);
|
blockDef.populateScanAlso(myScanAlso);
|
||||||
|
|
||||||
myClassToElementDefinitions.put(theClass, blockDef);
|
myClassToElementDefinitions.put(theClass, blockDef);
|
||||||
|
@ -243,11 +260,13 @@ class ModelScanner {
|
||||||
|
|
||||||
RuntimeCompositeDatatypeDefinition elementDef;
|
RuntimeCompositeDatatypeDefinition elementDef;
|
||||||
if (theClass.equals(ExtensionDt.class)) {
|
if (theClass.equals(ExtensionDt.class)) {
|
||||||
elementDef = new RuntimeExtensionDtDefinition(theDatatypeDefinition, theClass, true, myContext, myClassToElementDefinitions);
|
elementDef = new RuntimeExtensionDtDefinition(
|
||||||
|
theDatatypeDefinition, theClass, true, myContext, myClassToElementDefinitions);
|
||||||
// } else if (IBaseMetaType.class.isAssignableFrom(theClass)) {
|
// } else if (IBaseMetaType.class.isAssignableFrom(theClass)) {
|
||||||
// resourceDef = new RuntimeMetaDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
|
// resourceDef = new RuntimeMetaDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
|
||||||
} else {
|
} else {
|
||||||
elementDef = new RuntimeCompositeDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass), myContext, myClassToElementDefinitions);
|
elementDef = new RuntimeCompositeDatatypeDefinition(
|
||||||
|
theDatatypeDefinition, theClass, isStandardType(theClass), myContext, myClassToElementDefinitions);
|
||||||
}
|
}
|
||||||
myClassToElementDefinitions.put(theClass, elementDef);
|
myClassToElementDefinitions.put(theClass, elementDef);
|
||||||
myNameToElementDefinitions.put(elementDef.getName().toLowerCase(), elementDef);
|
myNameToElementDefinitions.put(elementDef.getName().toLowerCase(), elementDef);
|
||||||
|
@ -260,12 +279,14 @@ class ModelScanner {
|
||||||
elementDef.populateScanAlso(myScanAlso);
|
elementDef.populateScanAlso(myScanAlso);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String scanPrimitiveDatatype(Class<? extends IPrimitiveType<?>> theClass, DatatypeDef theDatatypeDefinition) {
|
private String scanPrimitiveDatatype(
|
||||||
|
Class<? extends IPrimitiveType<?>> theClass, DatatypeDef theDatatypeDefinition) {
|
||||||
ourLog.debug("Scanning resource class: {}", theClass.getName());
|
ourLog.debug("Scanning resource class: {}", theClass.getName());
|
||||||
|
|
||||||
String resourceName = theDatatypeDefinition.name();
|
String resourceName = theDatatypeDefinition.name();
|
||||||
if (isBlank(resourceName)) {
|
if (isBlank(resourceName)) {
|
||||||
throw new ConfigurationException(Msg.code(1718) + "Resource type @" + ResourceDef.class.getSimpleName() + " annotation contains no resource name: " + theClass.getCanonicalName());
|
throw new ConfigurationException(Msg.code(1718) + "Resource type @" + ResourceDef.class.getSimpleName()
|
||||||
|
+ " annotation contains no resource name: " + theClass.getCanonicalName());
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseRuntimeElementDefinition<?> elementDef;
|
BaseRuntimeElementDefinition<?> elementDef;
|
||||||
|
@ -280,7 +301,8 @@ class ModelScanner {
|
||||||
} else if (IIdType.class.isAssignableFrom(theClass)) {
|
} else if (IIdType.class.isAssignableFrom(theClass)) {
|
||||||
elementDef = new RuntimeIdDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
|
elementDef = new RuntimeIdDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
|
||||||
} else {
|
} else {
|
||||||
elementDef = new RuntimePrimitiveDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
|
elementDef =
|
||||||
|
new RuntimePrimitiveDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
|
||||||
}
|
}
|
||||||
myClassToElementDefinitions.put(theClass, elementDef);
|
myClassToElementDefinitions.put(theClass, elementDef);
|
||||||
if (!theDatatypeDefinition.isSpecialization()) {
|
if (!theDatatypeDefinition.isSpecialization()) {
|
||||||
|
@ -312,7 +334,8 @@ class ModelScanner {
|
||||||
parent = parent.getSuperclass();
|
parent = parent.getSuperclass();
|
||||||
}
|
}
|
||||||
if (isBlank(resourceName)) {
|
if (isBlank(resourceName)) {
|
||||||
throw new ConfigurationException(Msg.code(1719) + "Resource type @" + ResourceDef.class.getSimpleName() + " annotation contains no resource name(): " + theClass.getCanonicalName()
|
throw new ConfigurationException(Msg.code(1719) + "Resource type @" + ResourceDef.class.getSimpleName()
|
||||||
|
+ " annotation contains no resource name(): " + theClass.getCanonicalName()
|
||||||
+ " - This is only allowed for types that extend other resource types ");
|
+ " - This is only allowed for types that extend other resource types ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,12 +352,17 @@ class ModelScanner {
|
||||||
String resourceId = resourceDefinition.id();
|
String resourceId = resourceDefinition.id();
|
||||||
if (!isBlank(resourceId)) {
|
if (!isBlank(resourceId)) {
|
||||||
if (myIdToResourceDefinition.containsKey(resourceId)) {
|
if (myIdToResourceDefinition.containsKey(resourceId)) {
|
||||||
throw new ConfigurationException(Msg.code(1720) + "The following resource types have the same ID of '" + resourceId + "' - " + theClass.getCanonicalName() + " and "
|
throw new ConfigurationException(Msg.code(1720) + "The following resource types have the same ID of '"
|
||||||
+ myIdToResourceDefinition.get(resourceId).getImplementingClass().getCanonicalName());
|
+ resourceId + "' - " + theClass.getCanonicalName() + " and "
|
||||||
|
+ myIdToResourceDefinition
|
||||||
|
.get(resourceId)
|
||||||
|
.getImplementingClass()
|
||||||
|
.getCanonicalName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(myContext, resourceName, theClass, resourceDefinition, standardType, myClassToElementDefinitions);
|
RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(
|
||||||
|
myContext, resourceName, theClass, resourceDefinition, standardType, myClassToElementDefinitions);
|
||||||
myClassToElementDefinitions.put(theClass, resourceDef);
|
myClassToElementDefinitions.put(theClass, resourceDef);
|
||||||
if (primaryNameProvider) {
|
if (primaryNameProvider) {
|
||||||
if (resourceDef.getStructureVersion() == myVersion) {
|
if (resourceDef.getStructureVersion() == myVersion) {
|
||||||
|
@ -360,7 +388,8 @@ class ModelScanner {
|
||||||
return resourceName;
|
return resourceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scanResourceForSearchParams(Class<? extends IBaseResource> theClass, RuntimeResourceDefinition theResourceDef) {
|
private void scanResourceForSearchParams(
|
||||||
|
Class<? extends IBaseResource> theClass, RuntimeResourceDefinition theResourceDef) {
|
||||||
|
|
||||||
Map<String, RuntimeSearchParam> nameToParam = new HashMap<>();
|
Map<String, RuntimeSearchParam> nameToParam = new HashMap<>();
|
||||||
Map<Field, SearchParamDefinition> compositeFields = new LinkedHashMap<>();
|
Map<Field, SearchParamDefinition> compositeFields = new LinkedHashMap<>();
|
||||||
|
@ -384,9 +413,11 @@ class ModelScanner {
|
||||||
for (Field nextField : fields) {
|
for (Field nextField : fields) {
|
||||||
SearchParamDefinition searchParam = pullAnnotation(nextField, SearchParamDefinition.class);
|
SearchParamDefinition searchParam = pullAnnotation(nextField, SearchParamDefinition.class);
|
||||||
if (searchParam != null) {
|
if (searchParam != null) {
|
||||||
RestSearchParameterTypeEnum paramType = RestSearchParameterTypeEnum.forCode(searchParam.type().toLowerCase());
|
RestSearchParameterTypeEnum paramType =
|
||||||
|
RestSearchParameterTypeEnum.forCode(searchParam.type().toLowerCase());
|
||||||
if (paramType == null) {
|
if (paramType == null) {
|
||||||
throw new ConfigurationException(Msg.code(1721) + "Search param " + searchParam.name() + " has an invalid type: " + searchParam.type());
|
throw new ConfigurationException(Msg.code(1721) + "Search param " + searchParam.name()
|
||||||
|
+ " has an invalid type: " + searchParam.type());
|
||||||
}
|
}
|
||||||
Set<String> providesMembershipInCompartments;
|
Set<String> providesMembershipInCompartments;
|
||||||
providesMembershipInCompartments = new HashSet<>();
|
providesMembershipInCompartments = new HashSet<>();
|
||||||
|
@ -425,12 +456,23 @@ class ModelScanner {
|
||||||
String name = searchParam.name();
|
String name = searchParam.name();
|
||||||
url = toCanonicalSearchParameterUri(theResourceDef, name);
|
url = toCanonicalSearchParameterUri(theResourceDef, name);
|
||||||
}
|
}
|
||||||
RuntimeSearchParam param = new RuntimeSearchParam(null, url, searchParam.name(), searchParam.description(), searchParam.path(), paramType, providesMembershipInCompartments, toTargetList(searchParam.target()), RuntimeSearchParamStatusEnum.ACTIVE, null, components, base);
|
RuntimeSearchParam param = new RuntimeSearchParam(
|
||||||
|
null,
|
||||||
|
url,
|
||||||
|
searchParam.name(),
|
||||||
|
searchParam.description(),
|
||||||
|
searchParam.path(),
|
||||||
|
paramType,
|
||||||
|
providesMembershipInCompartments,
|
||||||
|
toTargetList(searchParam.target()),
|
||||||
|
RuntimeSearchParamStatusEnum.ACTIVE,
|
||||||
|
null,
|
||||||
|
components,
|
||||||
|
base);
|
||||||
theResourceDef.addSearchParam(param);
|
theResourceDef.addSearchParam(param);
|
||||||
nameToParam.put(param.getName(), param);
|
nameToParam.put(param.getName(), param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toCanonicalSearchParameterUri(RuntimeResourceDefinition theResourceDef, String theName) {
|
private String toCanonicalSearchParameterUri(RuntimeResourceDefinition theResourceDef, String theName) {
|
||||||
|
@ -455,7 +497,9 @@ class ModelScanner {
|
||||||
if (List.class.equals(nextElementType)) {
|
if (List.class.equals(nextElementType)) {
|
||||||
nextElementType = ReflectionUtil.getGenericCollectionTypeOfField(next);
|
nextElementType = ReflectionUtil.getGenericCollectionTypeOfField(next);
|
||||||
} else if (Collection.class.isAssignableFrom(nextElementType)) {
|
} else if (Collection.class.isAssignableFrom(nextElementType)) {
|
||||||
throw new ConfigurationException(Msg.code(1722) + "Field '" + next.getName() + "' in type '" + next.getClass().getCanonicalName() + "' is a Collection - Only java.util.List curently supported");
|
throw new ConfigurationException(Msg.code(1722) + "Field '" + next.getName() + "' in type '"
|
||||||
|
+ next.getClass().getCanonicalName()
|
||||||
|
+ "' is a Collection - Only java.util.List curently supported");
|
||||||
}
|
}
|
||||||
return nextElementType;
|
return nextElementType;
|
||||||
}
|
}
|
||||||
|
@ -464,7 +508,8 @@ class ModelScanner {
|
||||||
static IValueSetEnumBinder<Enum<?>> getBoundCodeBinder(Field theNext) {
|
static IValueSetEnumBinder<Enum<?>> getBoundCodeBinder(Field theNext) {
|
||||||
Class<?> bound = getGenericCollectionTypeOfCodedField(theNext);
|
Class<?> bound = getGenericCollectionTypeOfCodedField(theNext);
|
||||||
if (bound == null) {
|
if (bound == null) {
|
||||||
throw new ConfigurationException(Msg.code(1723) + "Field '" + theNext + "' has no parameter for " + BoundCodeDt.class.getSimpleName() + " to determine enum type");
|
throw new ConfigurationException(Msg.code(1723) + "Field '" + theNext + "' has no parameter for "
|
||||||
|
+ BoundCodeDt.class.getSimpleName() + " to determine enum type");
|
||||||
}
|
}
|
||||||
|
|
||||||
String fieldName = "VALUESET_BINDER";
|
String fieldName = "VALUESET_BINDER";
|
||||||
|
@ -472,7 +517,11 @@ class ModelScanner {
|
||||||
Field bindingField = bound.getField(fieldName);
|
Field bindingField = bound.getField(fieldName);
|
||||||
return (IValueSetEnumBinder<Enum<?>>) bindingField.get(null);
|
return (IValueSetEnumBinder<Enum<?>>) bindingField.get(null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ConfigurationException(Msg.code(1724) + "Field '" + theNext + "' has type parameter " + bound.getCanonicalName() + " but this class has no valueset binding field (must have a field called " + fieldName + ")", e);
|
throw new ConfigurationException(
|
||||||
|
Msg.code(1724) + "Field '" + theNext + "' has type parameter " + bound.getCanonicalName()
|
||||||
|
+ " but this class has no valueset binding field (must have a field called " + fieldName
|
||||||
|
+ ")",
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +537,8 @@ class ModelScanner {
|
||||||
|
|
||||||
static Class<? extends Enum<?>> determineEnumTypeForBoundField(Field next) {
|
static Class<? extends Enum<?>> determineEnumTypeForBoundField(Field next) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Class<? extends Enum<?>> enumType = (Class<? extends Enum<?>>) ReflectionUtil.getGenericCollectionTypeOfFieldWithSecondOrderForList(next);
|
Class<? extends Enum<?>> enumType =
|
||||||
|
(Class<? extends Enum<?>>) ReflectionUtil.getGenericCollectionTypeOfFieldWithSecondOrderForList(next);
|
||||||
return enumType;
|
return enumType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +556,11 @@ class ModelScanner {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Set<Class<? extends IBase>> scanVersionPropertyFile(Set<Class<? extends IBase>> theDatatypes, Map<String, Class<? extends IBaseResource>> theResourceTypes, FhirVersionEnum theVersion, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theExistingElementDefinitions) {
|
static Set<Class<? extends IBase>> scanVersionPropertyFile(
|
||||||
|
Set<Class<? extends IBase>> theDatatypes,
|
||||||
|
Map<String, Class<? extends IBaseResource>> theResourceTypes,
|
||||||
|
FhirVersionEnum theVersion,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theExistingElementDefinitions) {
|
||||||
Set<Class<? extends IBase>> retVal = new HashSet<>();
|
Set<Class<? extends IBase>> retVal = new HashSet<>();
|
||||||
|
|
||||||
try (InputStream str = theVersion.getVersionImplementation().getFhirVersionPropertiesFile()) {
|
try (InputStream str = theVersion.getVersionImplementation().getFhirVersionPropertiesFile()) {
|
||||||
|
@ -537,12 +591,16 @@ class ModelScanner {
|
||||||
Class<? extends IBaseDatatype> nextClass = (Class<? extends IBaseDatatype>) dtType;
|
Class<? extends IBaseDatatype> nextClass = (Class<? extends IBaseDatatype>) dtType;
|
||||||
theDatatypes.add(nextClass);
|
theDatatypes.add(nextClass);
|
||||||
} else {
|
} else {
|
||||||
ourLog.warn("Class is not assignable from " + IElement.class.getSimpleName() + " or " + IBaseDatatype.class.getSimpleName() + ": " + nextValue);
|
ourLog.warn("Class is not assignable from " + IElement.class.getSimpleName() + " or "
|
||||||
|
+ IBaseDatatype.class.getSimpleName() + ": " + nextValue);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new ConfigurationException(Msg.code(1725) + "Unknown class[" + nextValue + "] for data type definition: " + nextKey.substring("datatype.".length()), e);
|
throw new ConfigurationException(
|
||||||
|
Msg.code(1725) + "Unknown class[" + nextValue + "] for data type definition: "
|
||||||
|
+ nextKey.substring("datatype.".length()),
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (nextKey.startsWith("resource.")) {
|
} else if (nextKey.startsWith("resource.")) {
|
||||||
|
@ -550,27 +608,33 @@ class ModelScanner {
|
||||||
String resName = nextKey.substring("resource.".length()).toLowerCase();
|
String resName = nextKey.substring("resource.".length()).toLowerCase();
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Class<? extends IBaseResource> nextClass = (Class<? extends IBaseResource>) Class.forName(nextValue);
|
Class<? extends IBaseResource> nextClass =
|
||||||
|
(Class<? extends IBaseResource>) Class.forName(nextValue);
|
||||||
if (theExistingElementDefinitions.containsKey(nextClass)) {
|
if (theExistingElementDefinitions.containsKey(nextClass)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!IBaseResource.class.isAssignableFrom(nextClass)) {
|
if (!IBaseResource.class.isAssignableFrom(nextClass)) {
|
||||||
throw new ConfigurationException(Msg.code(1726) + "Class is not assignable from " + IBaseResource.class.getSimpleName() + ": " + nextValue);
|
throw new ConfigurationException(Msg.code(1726) + "Class is not assignable from "
|
||||||
|
+ IBaseResource.class.getSimpleName() + ": " + nextValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
theResourceTypes.put(resName, nextClass);
|
theResourceTypes.put(resName, nextClass);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new ConfigurationException(Msg.code(1727) + "Unknown class[" + nextValue + "] for resource definition: " + nextKey.substring("resource.".length()), e);
|
throw new ConfigurationException(
|
||||||
|
Msg.code(1727) + "Unknown class[" + nextValue + "] for resource definition: "
|
||||||
|
+ nextKey.substring("resource.".length()),
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ConfigurationException(Msg.code(1728) + "Unexpected property in version property file: " + nextKey + "=" + nextValue);
|
throw new ConfigurationException(Msg.code(1728) + "Unexpected property in version property file: "
|
||||||
|
+ nextKey + "=" + nextValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ConfigurationException(Msg.code(1729) + "Failed to load model property file from classpath: " + "/ca/uhn/fhir/model/dstu/model.properties");
|
throw new ConfigurationException(Msg.code(1729) + "Failed to load model property file from classpath: "
|
||||||
|
+ "/ca/uhn/fhir/model/dstu/model.properties");
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,9 +200,9 @@ public class ParserOptions {
|
||||||
* Bundle.entry.fullUrl
|
* Bundle.entry.fullUrl
|
||||||
* @return Returns a reference to <code>this</code> parser so that method calls can be chained together
|
* @return Returns a reference to <code>this</code> parser so that method calls can be chained together
|
||||||
*/
|
*/
|
||||||
public ParserOptions setOverrideResourceIdWithBundleEntryFullUrl(boolean theOverrideResourceIdWithBundleEntryFullUrl) {
|
public ParserOptions setOverrideResourceIdWithBundleEntryFullUrl(
|
||||||
|
boolean theOverrideResourceIdWithBundleEntryFullUrl) {
|
||||||
myOverrideResourceIdWithBundleEntryFullUrl = theOverrideResourceIdWithBundleEntryFullUrl;
|
myOverrideResourceIdWithBundleEntryFullUrl = theOverrideResourceIdWithBundleEntryFullUrl;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,5 +35,4 @@ public enum PerformanceOptionsEnum {
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
DEFERRED_MODEL_SCANNING
|
DEFERRED_MODEL_SCANNING
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,15 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.api.IDatatype;
|
||||||
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
import ca.uhn.fhir.model.primitive.XhtmlDt;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -26,24 +35,17 @@ import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.IDatatype;
|
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
|
||||||
import ca.uhn.fhir.model.primitive.XhtmlDt;
|
|
||||||
|
|
||||||
public class RuntimeChildAny extends RuntimeChildChoiceDefinition {
|
public class RuntimeChildAny extends RuntimeChildChoiceDefinition {
|
||||||
|
|
||||||
public RuntimeChildAny(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
|
public RuntimeChildAny(
|
||||||
|
Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
|
||||||
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation);
|
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
List<Class<? extends IBase>> choiceTypes = new ArrayList<Class<? extends IBase>>();
|
List<Class<? extends IBase>> choiceTypes = new ArrayList<Class<? extends IBase>>();
|
||||||
|
|
||||||
for (Class<? extends IBase> next : theClassToElementDefinitions.keySet()) {
|
for (Class<? extends IBase> next : theClassToElementDefinitions.keySet()) {
|
||||||
|
@ -62,7 +64,10 @@ public class RuntimeChildAny extends RuntimeChildChoiceDefinition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IResource.class.isAssignableFrom(next) || IDatatype.class.isAssignableFrom(next) || IBaseDatatype.class.isAssignableFrom(next) || IBaseReference.class.isAssignableFrom(next)) {
|
if (IResource.class.isAssignableFrom(next)
|
||||||
|
|| IDatatype.class.isAssignableFrom(next)
|
||||||
|
|| IBaseDatatype.class.isAssignableFrom(next)
|
||||||
|
|| IBaseReference.class.isAssignableFrom(next)) {
|
||||||
choiceTypes.add(next);
|
choiceTypes.add(next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,13 +85,11 @@ public class RuntimeChildAny extends RuntimeChildChoiceDefinition {
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setChoiceTypes(choiceTypes);
|
setChoiceTypes(choiceTypes);
|
||||||
|
|
||||||
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,12 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public RuntimeChildChoiceDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, List<Class<? extends IBase>> theChoiceTypes) {
|
public RuntimeChildChoiceDefinition(
|
||||||
|
Field theField,
|
||||||
|
String theElementName,
|
||||||
|
Child theChildAnnotation,
|
||||||
|
Description theDescriptionAnnotation,
|
||||||
|
List<Class<? extends IBase>> theChoiceTypes) {
|
||||||
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
||||||
|
|
||||||
myChoiceTypes = Collections.unmodifiableList(theChoiceTypes);
|
myChoiceTypes = Collections.unmodifiableList(theChoiceTypes);
|
||||||
|
@ -60,7 +65,8 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
|
||||||
*
|
*
|
||||||
* For extension, if myChoiceTypes will be set some other way
|
* For extension, if myChoiceTypes will be set some other way
|
||||||
*/
|
*/
|
||||||
RuntimeChildChoiceDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
|
RuntimeChildChoiceDefinition(
|
||||||
|
Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
|
||||||
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,14 +85,17 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseRuntimeElementDefinition<?> getChildByName(String theName) {
|
public BaseRuntimeElementDefinition<?> getChildByName(String theName) {
|
||||||
assert myNameToChildDefinition.containsKey(theName) : "Can't find child '" + theName + "' in names: " + myNameToChildDefinition.keySet();
|
assert myNameToChildDefinition.containsKey(theName)
|
||||||
|
: "Can't find child '" + theName + "' in names: " + myNameToChildDefinition.keySet();
|
||||||
|
|
||||||
return myNameToChildDefinition.get(theName);
|
return myNameToChildDefinition.get(theName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myNameToChildDefinition = new HashMap<String, BaseRuntimeElementDefinition<?>>();
|
myNameToChildDefinition = new HashMap<String, BaseRuntimeElementDefinition<?>>();
|
||||||
myDatatypeToElementName = new HashMap<Class<? extends IBase>, String>();
|
myDatatypeToElementName = new HashMap<Class<? extends IBase>, String>();
|
||||||
myDatatypeToElementDefinition = new HashMap<Class<? extends IBase>, BaseRuntimeElementDefinition<?>>();
|
myDatatypeToElementDefinition = new HashMap<Class<? extends IBase>, BaseRuntimeElementDefinition<?>>();
|
||||||
|
@ -158,7 +167,9 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
|
||||||
if (myDatatypeToElementName.containsKey(next)) {
|
if (myDatatypeToElementName.containsKey(next)) {
|
||||||
String existing = myDatatypeToElementName.get(next);
|
String existing = myDatatypeToElementName.get(next);
|
||||||
if (!existing.equals(elementName)) {
|
if (!existing.equals(elementName)) {
|
||||||
throw new ConfigurationException(Msg.code(1693) + "Already have element name " + existing + " for datatype " + next.getSimpleName() + " in " + getElementName() + ", cannot add " + elementName);
|
throw new ConfigurationException(
|
||||||
|
Msg.code(1693) + "Already have element name " + existing + " for datatype "
|
||||||
|
+ next.getSimpleName() + " in " + getElementName() + ", cannot add " + elementName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
myDatatypeToElementName.put(next, elementName);
|
myDatatypeToElementName.put(next, elementName);
|
||||||
|
@ -171,7 +182,6 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
|
||||||
myResourceTypes = Collections.unmodifiableList(myResourceTypes);
|
myResourceTypes = Collections.unmodifiableList(myResourceTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<Class<? extends IBaseResource>> getResourceTypes() {
|
public List<Class<? extends IBaseResource>> getResourceTypes() {
|
||||||
return myResourceTypes;
|
return myResourceTypes;
|
||||||
}
|
}
|
||||||
|
@ -190,5 +200,4 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
|
||||||
public Set<Class<? extends IBase>> getValidChildTypes() {
|
public Set<Class<? extends IBase>> getValidChildTypes() {
|
||||||
return Collections.unmodifiableSet((myDatatypeToElementDefinition.keySet()));
|
return Collections.unmodifiableSet((myDatatypeToElementDefinition.keySet()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,21 +19,27 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
import org.apache.commons.lang3.Validate;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class RuntimeChildCompositeBoundDatatypeDefinition extends RuntimeChildCompositeDatatypeDefinition {
|
public class RuntimeChildCompositeBoundDatatypeDefinition extends RuntimeChildCompositeDatatypeDefinition {
|
||||||
|
|
||||||
private IValueSetEnumBinder<Enum<?>> myBinder;
|
private IValueSetEnumBinder<Enum<?>> myBinder;
|
||||||
private Class<? extends Enum<?>> myEnumType;
|
private Class<? extends Enum<?>> myEnumType;
|
||||||
|
|
||||||
public RuntimeChildCompositeBoundDatatypeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class<? extends IBase> theDatatype, IValueSetEnumBinder<Enum<?>> theBinder, Class<? extends Enum<?>> theEnumType) {
|
public RuntimeChildCompositeBoundDatatypeDefinition(
|
||||||
|
Field theField,
|
||||||
|
String theElementName,
|
||||||
|
Child theChildAnnotation,
|
||||||
|
Description theDescriptionAnnotation,
|
||||||
|
Class<? extends IBase> theDatatype,
|
||||||
|
IValueSetEnumBinder<Enum<?>> theBinder,
|
||||||
|
Class<? extends Enum<?>> theEnumType) {
|
||||||
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
|
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
|
||||||
Validate.notNull(theBinder, "theBinder must not be null");
|
Validate.notNull(theBinder, "theBinder must not be null");
|
||||||
Validate.notNull(theEnumType, "theEnumType must not be null");
|
Validate.notNull(theEnumType, "theEnumType must not be null");
|
||||||
|
@ -51,5 +57,4 @@ public class RuntimeChildCompositeBoundDatatypeDefinition extends RuntimeChildCo
|
||||||
public Class<? extends Enum<?>> getBoundEnumType() {
|
public Class<? extends Enum<?>> getBoundEnumType() {
|
||||||
return myEnumType;
|
return myEnumType;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,18 +19,20 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class RuntimeChildCompositeDatatypeDefinition extends BaseRuntimeChildDatatypeDefinition {
|
public class RuntimeChildCompositeDatatypeDefinition extends BaseRuntimeChildDatatypeDefinition {
|
||||||
|
|
||||||
public RuntimeChildCompositeDatatypeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class<? extends IBase> theDatatype) {
|
public RuntimeChildCompositeDatatypeDefinition(
|
||||||
|
Field theField,
|
||||||
|
String theElementName,
|
||||||
|
Child theChildAnnotation,
|
||||||
|
Description theDescriptionAnnotation,
|
||||||
|
Class<? extends IBase> theDatatype) {
|
||||||
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
|
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,9 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi
|
||||||
|
|
||||||
private BaseRuntimeElementDefinition<?> myElem;
|
private BaseRuntimeElementDefinition<?> myElem;
|
||||||
|
|
||||||
RuntimeChildContainedResources(Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName) throws ConfigurationException {
|
RuntimeChildContainedResources(
|
||||||
|
Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName)
|
||||||
|
throws ConfigurationException {
|
||||||
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +74,9 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
Class<?> actualType = theContext.getVersion().getContainedType();
|
Class<?> actualType = theContext.getVersion().getContainedType();
|
||||||
if (BaseContainedDt.class.isAssignableFrom(actualType)) {
|
if (BaseContainedDt.class.isAssignableFrom(actualType)) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -81,8 +85,8 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi
|
||||||
} else if (List.class.isAssignableFrom(actualType)) {
|
} else if (List.class.isAssignableFrom(actualType)) {
|
||||||
myElem = new RuntimeElemContainedResourceList(IBaseResource.class, false);
|
myElem = new RuntimeElemContainedResourceList(IBaseResource.class, false);
|
||||||
} else {
|
} else {
|
||||||
throw new ConfigurationException(Msg.code(1735) + "Fhir Version definition returned invalid contained type: " + actualType);
|
throw new ConfigurationException(
|
||||||
|
Msg.code(1735) + "Fhir Version definition returned invalid contained type: " + actualType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,12 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
import ca.uhn.fhir.model.api.IElement;
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Extension;
|
||||||
|
import ca.uhn.fhir.util.ReflectionUtil;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
@ -29,13 +34,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.IElement;
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Extension;
|
|
||||||
import ca.uhn.fhir.util.ReflectionUtil;
|
|
||||||
|
|
||||||
public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceDefinition {
|
public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceDefinition {
|
||||||
|
|
||||||
|
@ -56,8 +55,15 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
|
||||||
* @param theDefinedLocally
|
* @param theDefinedLocally
|
||||||
* See {@link Extension#definedLocally()}
|
* See {@link Extension#definedLocally()}
|
||||||
*/
|
*/
|
||||||
RuntimeChildDeclaredExtensionDefinition(Field theField, Child theChild, Description theDescriptionAnnotation, Extension theExtension, String theElementName, String theExtensionUrl,
|
RuntimeChildDeclaredExtensionDefinition(
|
||||||
Class<? extends IBase> theChildType, Object theBoundTypeBinder)
|
Field theField,
|
||||||
|
Child theChild,
|
||||||
|
Description theDescriptionAnnotation,
|
||||||
|
Extension theExtension,
|
||||||
|
String theElementName,
|
||||||
|
String theExtensionUrl,
|
||||||
|
Class<? extends IBase> theChildType,
|
||||||
|
Object theBoundTypeBinder)
|
||||||
throws ConfigurationException {
|
throws ConfigurationException {
|
||||||
super(theField, theElementName, theChild, theDescriptionAnnotation);
|
super(theField, theElementName, theChild, theDescriptionAnnotation);
|
||||||
assert isNotBlank(theExtensionUrl);
|
assert isNotBlank(theExtensionUrl);
|
||||||
|
@ -116,7 +122,6 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
|
||||||
return "modifierExtension";
|
return "modifierExtension";
|
||||||
}
|
}
|
||||||
return "extension";
|
return "extension";
|
||||||
|
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +174,9 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myUrlToChildExtension = new HashMap<String, RuntimeChildDeclaredExtensionDefinition>();
|
myUrlToChildExtension = new HashMap<String, RuntimeChildDeclaredExtensionDefinition>();
|
||||||
|
|
||||||
BaseRuntimeElementDefinition<?> elementDef = theClassToElementDefinitions.get(myChildType);
|
BaseRuntimeElementDefinition<?> elementDef = theClassToElementDefinitions.get(myChildType);
|
||||||
|
@ -184,8 +191,10 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elementDef instanceof RuntimePrimitiveDatatypeDefinition || elementDef instanceof RuntimeCompositeDatatypeDefinition) {
|
if (elementDef instanceof RuntimePrimitiveDatatypeDefinition
|
||||||
// myDatatypeChildName = "value" + elementDef.getName().substring(0, 1).toUpperCase() + elementDef.getName().substring(1);
|
|| elementDef instanceof RuntimeCompositeDatatypeDefinition) {
|
||||||
|
// myDatatypeChildName = "value" + elementDef.getName().substring(0, 1).toUpperCase() +
|
||||||
|
// elementDef.getName().substring(1);
|
||||||
// if ("valueResourceReference".equals(myDatatypeChildName)) {
|
// if ("valueResourceReference".equals(myDatatypeChildName)) {
|
||||||
// Per one of the examples here: http://hl7.org/implement/standards/fhir/extensibility.html#extension
|
// Per one of the examples here: http://hl7.org/implement/standards/fhir/extensibility.html#extension
|
||||||
// myDatatypeChildName = "valueResource";
|
// myDatatypeChildName = "valueResource";
|
||||||
|
@ -215,5 +224,4 @@ public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceD
|
||||||
public Class<? extends IBase> getChildType() {
|
public Class<? extends IBase> getChildType() {
|
||||||
return myChildType;
|
return myChildType;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,23 +19,24 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
|
||||||
|
|
||||||
public class RuntimeChildDirectResource extends BaseRuntimeDeclaredChildDefinition {
|
public class RuntimeChildDirectResource extends BaseRuntimeDeclaredChildDefinition {
|
||||||
|
|
||||||
// private RuntimeElemContainedResources myElem;
|
// private RuntimeElemContainedResources myElem;
|
||||||
private FhirContext myContext;
|
private FhirContext myContext;
|
||||||
|
|
||||||
RuntimeChildDirectResource(Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName) throws ConfigurationException {
|
RuntimeChildDirectResource(
|
||||||
|
Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName)
|
||||||
|
throws ConfigurationException {
|
||||||
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +62,9 @@ public class RuntimeChildDirectResource extends BaseRuntimeDeclaredChildDefiniti
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myContext = theContext;
|
myContext = theContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,9 @@ public class RuntimeChildExt extends BaseRuntimeChildDefinition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myNameToChild = new HashMap<>();
|
myNameToChild = new HashMap<>();
|
||||||
myDatatypeToChild = new HashMap<>();
|
myDatatypeToChild = new HashMap<>();
|
||||||
myDatatypeToChildName = new HashMap<>();
|
myDatatypeToChildName = new HashMap<>();
|
||||||
|
|
|
@ -19,20 +19,20 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
|
||||||
|
|
||||||
public class RuntimeChildExtension extends RuntimeChildAny {
|
public class RuntimeChildExtension extends RuntimeChildAny {
|
||||||
|
|
||||||
// private RuntimeChildUndeclaredExtensionDefinition myExtensionElement;
|
// private RuntimeChildUndeclaredExtensionDefinition myExtensionElement;
|
||||||
|
|
||||||
public RuntimeChildExtension(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
|
public RuntimeChildExtension(
|
||||||
|
Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
|
||||||
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation);
|
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,11 +63,11 @@ public class RuntimeChildExtension extends RuntimeChildAny {
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
// void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
// void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>>
|
||||||
|
// theClassToElementDefinitions) {
|
||||||
// super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
// super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
//
|
//
|
||||||
// myExtensionElement = theContext.getRuntimeChildUndeclaredExtensionDefinition();
|
// myExtensionElement = theContext.getRuntimeChildUndeclaredExtensionDefinition();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,18 +19,20 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class RuntimeChildNarrativeDefinition extends RuntimeChildCompositeDatatypeDefinition {
|
public class RuntimeChildNarrativeDefinition extends RuntimeChildCompositeDatatypeDefinition {
|
||||||
|
|
||||||
public RuntimeChildNarrativeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class<? extends IBase> theDatatype) {
|
public RuntimeChildNarrativeDefinition(
|
||||||
|
Field theField,
|
||||||
|
String theElementName,
|
||||||
|
Child theChildAnnotation,
|
||||||
|
Description theDescriptionAnnotation,
|
||||||
|
Class<? extends IBase> theDatatype) {
|
||||||
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
|
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,25 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class RuntimeChildPrimitiveBoundCodeDatatypeDefinition extends RuntimeChildPrimitiveDatatypeDefinition {
|
public class RuntimeChildPrimitiveBoundCodeDatatypeDefinition extends RuntimeChildPrimitiveDatatypeDefinition {
|
||||||
|
|
||||||
private Object myBinder;
|
private Object myBinder;
|
||||||
private Class<? extends Enum<?>> myEnumType;
|
private Class<? extends Enum<?>> myEnumType;
|
||||||
|
|
||||||
public RuntimeChildPrimitiveBoundCodeDatatypeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class<? extends IBase> theDatatype, Object theBinder, Class<? extends Enum<?>> theEnumType) {
|
public RuntimeChildPrimitiveBoundCodeDatatypeDefinition(
|
||||||
|
Field theField,
|
||||||
|
String theElementName,
|
||||||
|
Child theChildAnnotation,
|
||||||
|
Description theDescriptionAnnotation,
|
||||||
|
Class<? extends IBase> theDatatype,
|
||||||
|
Object theBinder,
|
||||||
|
Class<? extends Enum<?>> theEnumType) {
|
||||||
super(theField, theElementName, theDescriptionAnnotation, theChildAnnotation, theDatatype);
|
super(theField, theElementName, theDescriptionAnnotation, theChildAnnotation, theDatatype);
|
||||||
|
|
||||||
myBinder = theBinder;
|
myBinder = theBinder;
|
||||||
|
@ -47,5 +53,4 @@ public class RuntimeChildPrimitiveBoundCodeDatatypeDefinition extends RuntimeChi
|
||||||
public Object getInstanceConstructorArguments() {
|
public Object getInstanceConstructorArguments() {
|
||||||
return myBinder;
|
return myBinder;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,20 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class RuntimeChildPrimitiveDatatypeDefinition extends BaseRuntimeChildDatatypeDefinition {
|
public class RuntimeChildPrimitiveDatatypeDefinition extends BaseRuntimeChildDatatypeDefinition {
|
||||||
|
|
||||||
public RuntimeChildPrimitiveDatatypeDefinition(Field theField, String theElementName, Description theDescriptionAnnotation, Child theChildAnnotation, Class<? extends IBase> theDatatype) {
|
public RuntimeChildPrimitiveDatatypeDefinition(
|
||||||
|
Field theField,
|
||||||
|
String theElementName,
|
||||||
|
Description theDescriptionAnnotation,
|
||||||
|
Child theChildAnnotation,
|
||||||
|
Class<? extends IBase> theDatatype) {
|
||||||
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
|
super(theField, theElementName, theChildAnnotation, theDescriptionAnnotation, theDatatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,13 @@ public class RuntimeChildPrimitiveEnumerationDatatypeDefinition extends RuntimeC
|
||||||
private Object myBinder;
|
private Object myBinder;
|
||||||
private Class<? extends Enum<?>> myEnumType;
|
private Class<? extends Enum<?>> myEnumType;
|
||||||
|
|
||||||
public RuntimeChildPrimitiveEnumerationDatatypeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class<? extends IBase> theDatatype, Class<? extends Enum<?>> theBinderType) {
|
public RuntimeChildPrimitiveEnumerationDatatypeDefinition(
|
||||||
|
Field theField,
|
||||||
|
String theElementName,
|
||||||
|
Child theChildAnnotation,
|
||||||
|
Description theDescriptionAnnotation,
|
||||||
|
Class<? extends IBase> theDatatype,
|
||||||
|
Class<? extends Enum<?>> theBinderType) {
|
||||||
super(theField, theElementName, theDescriptionAnnotation, theChildAnnotation, theDatatype);
|
super(theField, theElementName, theDescriptionAnnotation, theChildAnnotation, theDatatype);
|
||||||
|
|
||||||
myEnumType = theBinderType;
|
myEnumType = theBinderType;
|
||||||
|
@ -64,5 +70,4 @@ public class RuntimeChildPrimitiveEnumerationDatatypeDefinition extends RuntimeC
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,23 +19,29 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
|
||||||
|
|
||||||
public class RuntimeChildResourceBlockDefinition extends BaseRuntimeDeclaredChildDefinition {
|
public class RuntimeChildResourceBlockDefinition extends BaseRuntimeDeclaredChildDefinition {
|
||||||
|
|
||||||
// private RuntimeResourceBlockDefinition myElementDef;
|
// private RuntimeResourceBlockDefinition myElementDef;
|
||||||
private Class<? extends IBase> myResourceBlockType;
|
private Class<? extends IBase> myResourceBlockType;
|
||||||
private FhirContext myContext;
|
private FhirContext myContext;
|
||||||
|
|
||||||
public RuntimeChildResourceBlockDefinition(FhirContext theContext, Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName, Class<? extends IBase> theResourceBlockType) throws ConfigurationException {
|
public RuntimeChildResourceBlockDefinition(
|
||||||
|
FhirContext theContext,
|
||||||
|
Field theField,
|
||||||
|
Child theChildAnnotation,
|
||||||
|
Description theDescriptionAnnotation,
|
||||||
|
String theElementName,
|
||||||
|
Class<? extends IBase> theResourceBlockType)
|
||||||
|
throws ConfigurationException {
|
||||||
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
||||||
myContext = theContext;
|
myContext = theContext;
|
||||||
myResourceBlockType = theResourceBlockType;
|
myResourceBlockType = theResourceBlockType;
|
||||||
|
@ -75,8 +81,9 @@ public class RuntimeChildResourceBlockDefinition extends BaseRuntimeDeclaredChil
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
// myElementDef = (RuntimeResourceBlockDefinition) theClassToElementDefinitions.get(myResourceBlockType);
|
// myElementDef = (RuntimeResourceBlockDefinition) theClassToElementDefinitions.get(myResourceBlockType);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,12 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public RuntimeChildResourceDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, List<Class<? extends IBaseResource>> theResourceTypes) {
|
public RuntimeChildResourceDefinition(
|
||||||
|
Field theField,
|
||||||
|
String theElementName,
|
||||||
|
Child theChildAnnotation,
|
||||||
|
Description theDescriptionAnnotation,
|
||||||
|
List<Class<? extends IBaseResource>> theResourceTypes) {
|
||||||
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
||||||
myResourceTypes = theResourceTypes;
|
myResourceTypes = theResourceTypes;
|
||||||
|
|
||||||
|
@ -79,7 +84,9 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myRuntimeDef = findResourceReferenceDefinition(theClassToElementDefinitions);
|
myRuntimeDef = findResourceReferenceDefinition(theClassToElementDefinitions);
|
||||||
|
|
||||||
myValidChildNames = new HashSet<String>();
|
myValidChildNames = new HashSet<String>();
|
||||||
|
@ -99,7 +106,8 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
|
||||||
*/
|
*/
|
||||||
// for (Class<? extends IBaseResource> next : myResourceTypes) {
|
// for (Class<? extends IBaseResource> next : myResourceTypes) {
|
||||||
// if (next == IResource.class) {
|
// if (next == IResource.class) {
|
||||||
// for (Entry<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> nextEntry : theClassToElementDefinitions.entrySet()) {
|
// for (Entry<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> nextEntry :
|
||||||
|
// theClassToElementDefinitions.entrySet()) {
|
||||||
// if (IResource.class.isAssignableFrom(nextEntry.getKey())) {
|
// if (IResource.class.isAssignableFrom(nextEntry.getKey())) {
|
||||||
// RuntimeResourceDefinition nextDef = (RuntimeResourceDefinition) nextEntry.getValue();
|
// RuntimeResourceDefinition nextDef = (RuntimeResourceDefinition) nextEntry.getValue();
|
||||||
// myValidChildNames.add(getElementName() + nextDef.getName());
|
// myValidChildNames.add(getElementName() + nextDef.getName());
|
||||||
|
@ -109,7 +117,8 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
|
||||||
// else {
|
// else {
|
||||||
// RuntimeResourceDefinition nextDef = (RuntimeResourceDefinition) theClassToElementDefinitions.get(next);
|
// RuntimeResourceDefinition nextDef = (RuntimeResourceDefinition) theClassToElementDefinitions.get(next);
|
||||||
// if (nextDef == null) {
|
// if (nextDef == null) {
|
||||||
// throw new ConfigurationException(Msg.code(1691) + "Can't find child of type: " + next.getCanonicalName() + " in " + getField().getDeclaringClass());
|
// throw new ConfigurationException(Msg.code(1691) + "Can't find child of type: " + next.getCanonicalName()
|
||||||
|
// + " in " + getField().getDeclaringClass());
|
||||||
// }
|
// }
|
||||||
// myValidChildNames.add(getElementName() + nextDef.getName());
|
// myValidChildNames.add(getElementName() + nextDef.getName());
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -37,7 +37,8 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||||
|
|
||||||
private static final String VALUE_REFERENCE = "valueReference";
|
private static final String VALUE_REFERENCE = "valueReference";
|
||||||
private static final String VALUE_RESOURCE = "valueResource";
|
private static final String VALUE_RESOURCE = "valueResource";
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RuntimeChildUndeclaredExtensionDefinition.class);
|
private static final org.slf4j.Logger ourLog =
|
||||||
|
org.slf4j.LoggerFactory.getLogger(RuntimeChildUndeclaredExtensionDefinition.class);
|
||||||
private Map<String, BaseRuntimeElementDefinition<?>> myAttributeNameToDefinition;
|
private Map<String, BaseRuntimeElementDefinition<?>> myAttributeNameToDefinition;
|
||||||
private Map<Class<? extends IBase>, String> myDatatypeToAttributeName;
|
private Map<Class<? extends IBase>, String> myDatatypeToAttributeName;
|
||||||
private Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> myDatatypeToDefinition;
|
private Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> myDatatypeToDefinition;
|
||||||
|
@ -46,7 +47,10 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||||
// nothing
|
// nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addReferenceBinding(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions, String value) {
|
private void addReferenceBinding(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions,
|
||||||
|
String value) {
|
||||||
BaseRuntimeElementDefinition<?> def = findResourceReferenceDefinition(theClassToElementDefinitions);
|
BaseRuntimeElementDefinition<?> def = findResourceReferenceDefinition(theClassToElementDefinitions);
|
||||||
|
|
||||||
myAttributeNameToDefinition.put(value, def);
|
myAttributeNameToDefinition.put(value, def);
|
||||||
|
@ -58,7 +62,6 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||||
myDatatypeToDefinition.put(BaseResourceReferenceDt.class, def);
|
myDatatypeToDefinition.put(BaseResourceReferenceDt.class, def);
|
||||||
myDatatypeToDefinition.put(theContext.getVersion().getResourceReferenceType(), def);
|
myDatatypeToDefinition.put(theContext.getVersion().getResourceReferenceType(), def);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,7 +75,6 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||||
}
|
}
|
||||||
return new ArrayList<>(target.getUndeclaredExtensions());
|
return new ArrayList<>(target.getUndeclaredExtensions());
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +136,9 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
Map<String, BaseRuntimeElementDefinition<?>> datatypeAttributeNameToDefinition = new HashMap<>();
|
Map<String, BaseRuntimeElementDefinition<?>> datatypeAttributeNameToDefinition = new HashMap<>();
|
||||||
myDatatypeToAttributeName = new HashMap<>();
|
myDatatypeToAttributeName = new HashMap<>();
|
||||||
myDatatypeToDefinition = new HashMap<>();
|
myDatatypeToDefinition = new HashMap<>();
|
||||||
|
@ -149,7 +153,6 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||||
ourLog.trace("Not adding specialization: {}", next.getImplementingClass());
|
ourLog.trace("Not adding specialization: {}", next.getImplementingClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!next.isStandardType()) {
|
if (!next.isStandardType()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +183,10 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||||
// CodeType should win. If we aren't in a situation like that, there is a problem with the
|
// CodeType should win. If we aren't in a situation like that, there is a problem with the
|
||||||
// model so we should bail.
|
// model so we should bail.
|
||||||
if (!existing.isStandardType()) {
|
if (!existing.isStandardType()) {
|
||||||
throw new ConfigurationException(Msg.code(1734) + "More than one child of " + getElementName() + " matches attribute name " + attrName + ". Found [" + existing.getImplementingClass().getName() + "] and [" + next.getImplementingClass().getName() + "]");
|
throw new ConfigurationException(Msg.code(1734) + "More than one child of " + getElementName()
|
||||||
|
+ " matches attribute name " + attrName + ". Found ["
|
||||||
|
+ existing.getImplementingClass().getName() + "] and ["
|
||||||
|
+ next.getImplementingClass().getName() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +198,6 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||||
|
|
||||||
myAttributeNameToDefinition = datatypeAttributeNameToDefinition;
|
myAttributeNameToDefinition = datatypeAttributeNameToDefinition;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Resource reference - The correct name is 'valueReference' in DSTU2 and 'valueResource' in DSTU1
|
* Resource reference - The correct name is 'valueReference' in DSTU2 and 'valueResource' in DSTU1
|
||||||
*/
|
*/
|
||||||
|
@ -203,5 +208,4 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||||
public static String createExtensionChildName(BaseRuntimeElementDefinition<?> next) {
|
public static String createExtensionChildName(BaseRuntimeElementDefinition<?> next) {
|
||||||
return "value" + WordUtils.capitalize(next.getName());
|
return "value" + WordUtils.capitalize(next.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,18 +30,25 @@ import java.util.Map;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
|
|
||||||
public class RuntimeCompositeDatatypeDefinition extends BaseRuntimeElementCompositeDefinition<ICompositeType> implements IRuntimeDatatypeDefinition {
|
public class RuntimeCompositeDatatypeDefinition extends BaseRuntimeElementCompositeDefinition<ICompositeType>
|
||||||
|
implements IRuntimeDatatypeDefinition {
|
||||||
|
|
||||||
private boolean mySpecialization;
|
private boolean mySpecialization;
|
||||||
private Class<? extends IBaseDatatype> myProfileOfType;
|
private Class<? extends IBaseDatatype> myProfileOfType;
|
||||||
private BaseRuntimeElementDefinition<?> myProfileOf;
|
private BaseRuntimeElementDefinition<?> myProfileOf;
|
||||||
|
|
||||||
public RuntimeCompositeDatatypeDefinition(DatatypeDef theDef, Class<? extends ICompositeType> theImplementingClass, boolean theStandardType, FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
public RuntimeCompositeDatatypeDefinition(
|
||||||
|
DatatypeDef theDef,
|
||||||
|
Class<? extends ICompositeType> theImplementingClass,
|
||||||
|
boolean theStandardType,
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super(theDef.name(), theImplementingClass, theStandardType, theContext, theClassToElementDefinitions);
|
super(theDef.name(), theImplementingClass, theStandardType, theContext, theClassToElementDefinitions);
|
||||||
|
|
||||||
String resourceName = theDef.name();
|
String resourceName = theDef.name();
|
||||||
if (isBlank(resourceName)) {
|
if (isBlank(resourceName)) {
|
||||||
throw new ConfigurationException(Msg.code(1712) + "Resource type @" + ResourceDef.class.getSimpleName() + " annotation contains no resource name: " + theImplementingClass.getCanonicalName());
|
throw new ConfigurationException(Msg.code(1712) + "Resource type @" + ResourceDef.class.getSimpleName()
|
||||||
|
+ " annotation contains no resource name: " + theImplementingClass.getCanonicalName());
|
||||||
}
|
}
|
||||||
|
|
||||||
mySpecialization = theDef.isSpecialization();
|
mySpecialization = theDef.isSpecialization();
|
||||||
|
@ -49,11 +56,12 @@ public class RuntimeCompositeDatatypeDefinition extends BaseRuntimeElementCompos
|
||||||
if (myProfileOfType.equals(IBaseDatatype.class)) {
|
if (myProfileOfType.equals(IBaseDatatype.class)) {
|
||||||
myProfileOfType = null;
|
myProfileOfType = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
public void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
|
|
||||||
if (myProfileOfType != null) {
|
if (myProfileOfType != null) {
|
||||||
|
@ -91,6 +99,4 @@ public class RuntimeCompositeDatatypeDefinition extends BaseRuntimeElementCompos
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,5 +34,4 @@ public class RuntimeElemContainedResourceList extends BaseRuntimeElementDefiniti
|
||||||
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
||||||
return ChildTypeEnum.CONTAINED_RESOURCE_LIST;
|
return ChildTypeEnum.CONTAINED_RESOURCE_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,5 +32,4 @@ public class RuntimeElemContainedResources extends BaseRuntimeElementDefinition<
|
||||||
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
||||||
return ChildTypeEnum.CONTAINED_RESOURCES;
|
return ChildTypeEnum.CONTAINED_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,5 +31,4 @@ public class RuntimeElementDirectResource extends BaseRuntimeElementDefinition<I
|
||||||
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
||||||
return ChildTypeEnum.RESOURCE;
|
return ChildTypeEnum.RESOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,21 +19,25 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
|
||||||
|
|
||||||
public class RuntimeExtensionDtDefinition extends RuntimeCompositeDatatypeDefinition {
|
public class RuntimeExtensionDtDefinition extends RuntimeCompositeDatatypeDefinition {
|
||||||
|
|
||||||
private List<BaseRuntimeChildDefinition> myChildren;
|
private List<BaseRuntimeChildDefinition> myChildren;
|
||||||
|
|
||||||
public RuntimeExtensionDtDefinition(DatatypeDef theDef, Class<? extends ICompositeType> theImplementingClass, boolean theStandardType, FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
public RuntimeExtensionDtDefinition(
|
||||||
|
DatatypeDef theDef,
|
||||||
|
Class<? extends ICompositeType> theImplementingClass,
|
||||||
|
boolean theStandardType,
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super(theDef, theImplementingClass, theStandardType, theContext, theClassToElementDefinitions);
|
super(theDef, theImplementingClass, theStandardType, theContext, theClassToElementDefinitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +51,9 @@ public class RuntimeExtensionDtDefinition extends RuntimeCompositeDatatypeDefini
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
public void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -66,5 +72,4 @@ public class RuntimeExtensionDtDefinition extends RuntimeCompositeDatatypeDefini
|
||||||
|
|
||||||
myChildren = Collections.unmodifiableList(children);
|
myChildren = Collections.unmodifiableList(children);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,14 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
public class RuntimeIdDatatypeDefinition extends RuntimePrimitiveDatatypeDefinition
|
||||||
|
implements IRuntimeDatatypeDefinition {
|
||||||
|
|
||||||
public class RuntimeIdDatatypeDefinition extends RuntimePrimitiveDatatypeDefinition implements IRuntimeDatatypeDefinition {
|
public RuntimeIdDatatypeDefinition(
|
||||||
|
DatatypeDef theDef, Class<? extends IPrimitiveType<?>> theImplementingClass, boolean theStandardType) {
|
||||||
public RuntimeIdDatatypeDefinition(DatatypeDef theDef, Class<? extends IPrimitiveType<?>> theImplementingClass, boolean theStandardType) {
|
|
||||||
super(theDef, theImplementingClass, theStandardType);
|
super(theDef, theImplementingClass, theStandardType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,5 +34,4 @@ public class RuntimeIdDatatypeDefinition extends RuntimePrimitiveDatatypeDefinit
|
||||||
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
||||||
return ChildTypeEnum.ID_DATATYPE;
|
return ChildTypeEnum.ID_DATATYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,8 @@ import java.util.Map;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
|
|
||||||
public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefinition<IPrimitiveType<?>> implements IRuntimeDatatypeDefinition {
|
public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefinition<IPrimitiveType<?>>
|
||||||
|
implements IRuntimeDatatypeDefinition {
|
||||||
|
|
||||||
private Class<?> myNativeType;
|
private Class<?> myNativeType;
|
||||||
private BaseRuntimeElementDefinition<?> myProfileOf;
|
private BaseRuntimeElementDefinition<?> myProfileOf;
|
||||||
|
@ -44,12 +45,14 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
|
||||||
private List<BaseRuntimeChildDefinition> myChildren;
|
private List<BaseRuntimeChildDefinition> myChildren;
|
||||||
private RuntimeChildExt myRuntimeChildExt;
|
private RuntimeChildExt myRuntimeChildExt;
|
||||||
|
|
||||||
public RuntimePrimitiveDatatypeDefinition(DatatypeDef theDef, Class<? extends IPrimitiveType<?>> theImplementingClass, boolean theStandardType) {
|
public RuntimePrimitiveDatatypeDefinition(
|
||||||
|
DatatypeDef theDef, Class<? extends IPrimitiveType<?>> theImplementingClass, boolean theStandardType) {
|
||||||
super(theDef.name(), theImplementingClass, theStandardType);
|
super(theDef.name(), theImplementingClass, theStandardType);
|
||||||
|
|
||||||
String resourceName = theDef.name();
|
String resourceName = theDef.name();
|
||||||
if (isBlank(resourceName)) {
|
if (isBlank(resourceName)) {
|
||||||
throw new ConfigurationException(Msg.code(1689) + "Resource type @" + ResourceDef.class.getSimpleName() + " annotation contains no resource name: " + theImplementingClass.getCanonicalName());
|
throw new ConfigurationException(Msg.code(1689) + "Resource type @" + ResourceDef.class.getSimpleName()
|
||||||
|
+ " annotation contains no resource name: " + theImplementingClass.getCanonicalName());
|
||||||
}
|
}
|
||||||
|
|
||||||
mySpecialization = theDef.isSpecialization();
|
mySpecialization = theDef.isSpecialization();
|
||||||
|
@ -83,7 +86,8 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
|
||||||
Type rawType = superPt.getRawType();
|
Type rawType = superPt.getRawType();
|
||||||
if (rawType instanceof Class) {
|
if (rawType instanceof Class) {
|
||||||
Class<?> rawClass = (Class<?>) rawType;
|
Class<?> rawClass = (Class<?>) rawType;
|
||||||
if (rawClass.getName().endsWith(".BasePrimitive") || rawClass.getName().endsWith(".PrimitiveType")) {
|
if (rawClass.getName().endsWith(".BasePrimitive")
|
||||||
|
|| rawClass.getName().endsWith(".PrimitiveType")) {
|
||||||
Type typeVariable = superPt.getActualTypeArguments()[0];
|
Type typeVariable = superPt.getActualTypeArguments()[0];
|
||||||
if (typeVariable instanceof Class) {
|
if (typeVariable instanceof Class) {
|
||||||
myNativeType = (Class<?>) typeVariable;
|
myNativeType = (Class<?>) typeVariable;
|
||||||
|
@ -128,7 +132,9 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
|
|
||||||
if (myProfileOfType != null) {
|
if (myProfileOfType != null) {
|
||||||
|
@ -153,5 +159,4 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
|
||||||
myChildren.add(myRuntimeChildExt);
|
myChildren.add(myRuntimeChildExt);
|
||||||
myChildren = Collections.unmodifiableList(myChildren);
|
myChildren = Collections.unmodifiableList(myChildren);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,15 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
import java.util.Map;
|
import ca.uhn.fhir.model.primitive.XhtmlDt;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.primitive.XhtmlDt;
|
import java.util.Map;
|
||||||
|
|
||||||
public class RuntimePrimitiveDatatypeNarrativeDefinition extends BaseRuntimeElementDefinition<XhtmlDt> {
|
public class RuntimePrimitiveDatatypeNarrativeDefinition extends BaseRuntimeElementDefinition<XhtmlDt> {
|
||||||
|
|
||||||
public RuntimePrimitiveDatatypeNarrativeDefinition(String theName, Class<XhtmlDt> theImplementingClass, boolean theStandardType) {
|
public RuntimePrimitiveDatatypeNarrativeDefinition(
|
||||||
|
String theName, Class<XhtmlDt> theImplementingClass, boolean theStandardType) {
|
||||||
super(theName, theImplementingClass, theStandardType);
|
super(theName, theImplementingClass, theStandardType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,9 @@ public class RuntimePrimitiveDatatypeNarrativeDefinition extends BaseRuntimeEle
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
// nothing
|
// nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,15 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseXhtml;
|
import org.hl7.fhir.instance.model.api.IBaseXhtml;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition extends BaseRuntimeElementDefinition<IBaseXhtml> {
|
public class RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition extends BaseRuntimeElementDefinition<IBaseXhtml> {
|
||||||
|
|
||||||
public RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition(String theName, Class<? extends IBaseXhtml> theImplementingClass, boolean theStandardType) {
|
public RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition(
|
||||||
|
String theName, Class<? extends IBaseXhtml> theImplementingClass, boolean theStandardType) {
|
||||||
super(theName, theImplementingClass, theStandardType);
|
super(theName, theImplementingClass, theStandardType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +37,9 @@ public class RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition extends BaseRuntimeE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
// nothing
|
// nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,18 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class RuntimeResourceBlockDefinition extends BaseRuntimeElementCompositeDefinition<IBase> {
|
public class RuntimeResourceBlockDefinition extends BaseRuntimeElementCompositeDefinition<IBase> {
|
||||||
|
|
||||||
public RuntimeResourceBlockDefinition(String theName, Class<? extends IBase> theImplementingClass, boolean theStandardType, FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
public RuntimeResourceBlockDefinition(
|
||||||
|
String theName,
|
||||||
|
Class<? extends IBase> theImplementingClass,
|
||||||
|
boolean theStandardType,
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super(theName, theImplementingClass, theStandardType, theContext, theClassToElementDefinitions);
|
super(theName, theImplementingClass, theStandardType, theContext, theClassToElementDefinitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,5 +38,4 @@ public class RuntimeResourceBlockDefinition extends BaseRuntimeElementCompositeD
|
||||||
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
public ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum getChildType() {
|
||||||
return ChildTypeEnum.RESOURCE_BLOCK;
|
return ChildTypeEnum.RESOURCE_BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,13 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
||||||
private final FhirVersionEnum myStructureVersion;
|
private final FhirVersionEnum myStructureVersion;
|
||||||
private volatile RuntimeResourceDefinition myBaseDefinition;
|
private volatile RuntimeResourceDefinition myBaseDefinition;
|
||||||
|
|
||||||
|
public RuntimeResourceDefinition(
|
||||||
|
FhirContext theContext,
|
||||||
public RuntimeResourceDefinition(FhirContext theContext, String theResourceName, Class<? extends IBaseResource> theClass, ResourceDef theResourceAnnotation, boolean theStandardType, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
String theResourceName,
|
||||||
|
Class<? extends IBaseResource> theClass,
|
||||||
|
ResourceDef theResourceAnnotation,
|
||||||
|
boolean theStandardType,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super(theResourceName, theClass, theStandardType, theContext, theClassToElementDefinitions);
|
super(theResourceName, theClass, theStandardType, theContext, theClassToElementDefinitions);
|
||||||
myContext = theContext;
|
myContext = theContext;
|
||||||
myResourceProfile = theResourceAnnotation.profile();
|
myResourceProfile = theResourceAnnotation.profile();
|
||||||
|
@ -60,23 +64,35 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
||||||
try {
|
try {
|
||||||
instance = theClass.getConstructor().newInstance();
|
instance = theClass.getConstructor().newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ConfigurationException(Msg.code(1730) + myContext.getLocalizer().getMessage(getClass(), "nonInstantiableType", theClass.getName(), e.toString()), e);
|
throw new ConfigurationException(
|
||||||
|
Msg.code(1730)
|
||||||
|
+ myContext
|
||||||
|
.getLocalizer()
|
||||||
|
.getMessage(getClass(), "nonInstantiableType", theClass.getName(), e.toString()),
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
myStructureVersion = instance.getStructureFhirVersionEnum();
|
myStructureVersion = instance.getStructureFhirVersionEnum();
|
||||||
if (myStructureVersion != theContext.getVersion().getVersion()) {
|
if (myStructureVersion != theContext.getVersion().getVersion()) {
|
||||||
if (myStructureVersion == FhirVersionEnum.R5 && theContext.getVersion().getVersion() == FhirVersionEnum.R4B) {
|
if (myStructureVersion == FhirVersionEnum.R5
|
||||||
|
&& theContext.getVersion().getVersion() == FhirVersionEnum.R4B) {
|
||||||
// TODO: remove this exception once we've bumped FHIR core to a new version
|
// TODO: remove this exception once we've bumped FHIR core to a new version
|
||||||
// TODO: also fix the TODO in ModelScanner
|
// TODO: also fix the TODO in ModelScanner
|
||||||
// TODO: also fix the TODO in RestfulServerUtils
|
// TODO: also fix the TODO in RestfulServerUtils
|
||||||
// TODO: also fix the TODO in BaseParser
|
// TODO: also fix the TODO in BaseParser
|
||||||
} else {
|
} else {
|
||||||
throw new ConfigurationException(Msg.code(1731) + myContext.getLocalizer().getMessage(getClass(), "typeWrongVersion", theContext.getVersion().getVersion(), theClass.getName(), myStructureVersion));
|
throw new ConfigurationException(Msg.code(1731)
|
||||||
|
+ myContext
|
||||||
|
.getLocalizer()
|
||||||
|
.getMessage(
|
||||||
|
getClass(),
|
||||||
|
"typeWrongVersion",
|
||||||
|
theContext.getVersion().getVersion(),
|
||||||
|
theClass.getName(),
|
||||||
|
myStructureVersion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addSearchParam(RuntimeSearchParam theParam) {
|
public void addSearchParam(RuntimeSearchParam theParam) {
|
||||||
myNameToSearchParam.put(theParam.getName(), theParam);
|
myNameToSearchParam.put(theParam.getName(), theParam);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +129,8 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> Class<T> getImplementingClass(Class<T> theClass) {
|
public <T> Class<T> getImplementingClass(Class<T> theClass) {
|
||||||
if (!theClass.isAssignableFrom(getImplementingClass())) {
|
if (!theClass.isAssignableFrom(getImplementingClass())) {
|
||||||
throw new ConfigurationException(Msg.code(1732) + "Unable to convert " + getImplementingClass() + " to " + theClass);
|
throw new ConfigurationException(
|
||||||
|
Msg.code(1732) + "Unable to convert " + getImplementingClass() + " to " + theClass);
|
||||||
}
|
}
|
||||||
return (Class<T>) getImplementingClass();
|
return (Class<T>) getImplementingClass();
|
||||||
}
|
}
|
||||||
|
@ -176,7 +193,9 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
public void sealAndInitialize(
|
||||||
|
FhirContext theContext,
|
||||||
|
Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
|
|
||||||
myNameToSearchParam = Collections.unmodifiableMap(myNameToSearchParam);
|
myNameToSearchParam = Collections.unmodifiableMap(myNameToSearchParam);
|
||||||
|
@ -202,7 +221,8 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
||||||
if (!compartmentNameToSearchParams.containsKey(nextCompartment)) {
|
if (!compartmentNameToSearchParams.containsKey(nextCompartment)) {
|
||||||
compartmentNameToSearchParams.put(nextCompartment, new ArrayList<>());
|
compartmentNameToSearchParams.put(nextCompartment, new ArrayList<>());
|
||||||
}
|
}
|
||||||
List<RuntimeSearchParam> searchParamsForCompartment = compartmentNameToSearchParams.get(nextCompartment);
|
List<RuntimeSearchParam> searchParamsForCompartment =
|
||||||
|
compartmentNameToSearchParams.get(nextCompartment);
|
||||||
searchParamsForCompartment.add(next);
|
searchParamsForCompartment.add(next);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -247,11 +267,11 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
||||||
if (hasExtensions()) {
|
if (hasExtensions()) {
|
||||||
if (IAnyResource.class.isAssignableFrom(getImplementingClass())) {
|
if (IAnyResource.class.isAssignableFrom(getImplementingClass())) {
|
||||||
if (!IDomainResource.class.isAssignableFrom(getImplementingClass())) {
|
if (!IDomainResource.class.isAssignableFrom(getImplementingClass())) {
|
||||||
throw new ConfigurationException(Msg.code(1733) + "Class \"" + getImplementingClass() + "\" is invalid. This resource type is not a DomainResource, it must not have extensions");
|
throw new ConfigurationException(Msg.code(1733) + "Class \"" + getImplementingClass()
|
||||||
|
+ "\" is invalid. This resource type is not a DomainResource, it must not have extensions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String massagePathForCompartmentSimilarity(String thePath) {
|
private String massagePathForCompartmentSimilarity(String thePath) {
|
||||||
|
@ -286,5 +306,4 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package ca.uhn.fhir.context;
|
package ca.uhn.fhir.context;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.phonetic.IPhoneticEncoder;
|
import ca.uhn.fhir.context.phonetic.IPhoneticEncoder;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
|
||||||
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
|
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
@ -28,10 +27,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -39,9 +35,10 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
import static org.apache.commons.lang3.StringUtils.trim;
|
import static org.apache.commons.lang3.StringUtils.trim;
|
||||||
|
@ -66,22 +63,67 @@ public class RuntimeSearchParam {
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public RuntimeSearchParam(IIdType theId, String theUri, String theName, String theDescription, String thePath, RestSearchParameterTypeEnum theParamType,
|
public RuntimeSearchParam(
|
||||||
Set<String> theProvidesMembershipInCompartments, Set<String> theTargets, RuntimeSearchParamStatusEnum theStatus, Collection<String> theBase) {
|
IIdType theId,
|
||||||
this(theId, theUri, theName, theDescription, thePath, theParamType, theProvidesMembershipInCompartments, theTargets, theStatus, null, Collections.emptyList(), theBase);
|
String theUri,
|
||||||
|
String theName,
|
||||||
|
String theDescription,
|
||||||
|
String thePath,
|
||||||
|
RestSearchParameterTypeEnum theParamType,
|
||||||
|
Set<String> theProvidesMembershipInCompartments,
|
||||||
|
Set<String> theTargets,
|
||||||
|
RuntimeSearchParamStatusEnum theStatus,
|
||||||
|
Collection<String> theBase) {
|
||||||
|
this(
|
||||||
|
theId,
|
||||||
|
theUri,
|
||||||
|
theName,
|
||||||
|
theDescription,
|
||||||
|
thePath,
|
||||||
|
theParamType,
|
||||||
|
theProvidesMembershipInCompartments,
|
||||||
|
theTargets,
|
||||||
|
theStatus,
|
||||||
|
null,
|
||||||
|
Collections.emptyList(),
|
||||||
|
theBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor
|
* Copy constructor
|
||||||
*/
|
*/
|
||||||
public RuntimeSearchParam(RuntimeSearchParam theSp) {
|
public RuntimeSearchParam(RuntimeSearchParam theSp) {
|
||||||
this(theSp.getId(), theSp.getUri(), theSp.getName(), theSp.getDescription(), theSp.getPath(), theSp.getParamType(), theSp.getProvidesMembershipInCompartments(), theSp.getTargets(), theSp.getStatus(), theSp.getComboSearchParamType(), theSp.getComponents(), theSp.getBase());
|
this(
|
||||||
|
theSp.getId(),
|
||||||
|
theSp.getUri(),
|
||||||
|
theSp.getName(),
|
||||||
|
theSp.getDescription(),
|
||||||
|
theSp.getPath(),
|
||||||
|
theSp.getParamType(),
|
||||||
|
theSp.getProvidesMembershipInCompartments(),
|
||||||
|
theSp.getTargets(),
|
||||||
|
theSp.getStatus(),
|
||||||
|
theSp.getComboSearchParamType(),
|
||||||
|
theSp.getComponents(),
|
||||||
|
theSp.getBase());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public RuntimeSearchParam(IIdType theId, String theUri, String theName, String theDescription, String thePath, RestSearchParameterTypeEnum theParamType, Set<String> theProvidesMembershipInCompartments, Set<String> theTargets, RuntimeSearchParamStatusEnum theStatus, ComboSearchParamType theComboSearchParamType, List<Component> theComponents, Collection<String> theBase) {
|
public RuntimeSearchParam(
|
||||||
|
IIdType theId,
|
||||||
|
String theUri,
|
||||||
|
String theName,
|
||||||
|
String theDescription,
|
||||||
|
String thePath,
|
||||||
|
RestSearchParameterTypeEnum theParamType,
|
||||||
|
Set<String> theProvidesMembershipInCompartments,
|
||||||
|
Set<String> theTargets,
|
||||||
|
RuntimeSearchParamStatusEnum theStatus,
|
||||||
|
ComboSearchParamType theComboSearchParamType,
|
||||||
|
List<Component> theComponents,
|
||||||
|
Collection<String> theBase) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
myId = theId;
|
myId = theId;
|
||||||
|
@ -375,7 +417,6 @@ public class RuntimeSearchParam {
|
||||||
public Component(String theExpression, String theReference) {
|
public Component(String theExpression, String theReference) {
|
||||||
myExpression = theExpression;
|
myExpression = theExpression;
|
||||||
myReference = theReference;
|
myReference = theReference;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -394,5 +435,4 @@ public class RuntimeSearchParam {
|
||||||
return myReference;
|
return myReference;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.context.api;
|
package ca.uhn.fhir.context.api;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.Include;
|
import ca.uhn.fhir.model.api.Include;
|
||||||
import ca.uhn.fhir.util.ResourceReferenceInfo;
|
import ca.uhn.fhir.util.ResourceReferenceInfo;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Bill de Beaubien on 3/4/2015.
|
* Created by Bill de Beaubien on 3/4/2015.
|
||||||
*
|
*
|
||||||
|
@ -38,7 +38,8 @@ public enum BundleInclusionRule {
|
||||||
*/
|
*/
|
||||||
BASED_ON_INCLUDES {
|
BASED_ON_INCLUDES {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldIncludeReferencedResource(ResourceReferenceInfo theReferenceInfo, Set<Include> theIncludes) {
|
public boolean shouldIncludeReferencedResource(
|
||||||
|
ResourceReferenceInfo theReferenceInfo, Set<Include> theIncludes) {
|
||||||
return theReferenceInfo.matchesIncludeSet(theIncludes);
|
return theReferenceInfo.matchesIncludeSet(theIncludes);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -50,10 +51,12 @@ public enum BundleInclusionRule {
|
||||||
*/
|
*/
|
||||||
BASED_ON_RESOURCE_PRESENCE {
|
BASED_ON_RESOURCE_PRESENCE {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldIncludeReferencedResource(ResourceReferenceInfo theReferenceInfo, Set<Include> theIncludes) {
|
public boolean shouldIncludeReferencedResource(
|
||||||
|
ResourceReferenceInfo theReferenceInfo, Set<Include> theIncludes) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public abstract boolean shouldIncludeReferencedResource(ResourceReferenceInfo theReferenceInfo, Set<Include> theIncludes);
|
public abstract boolean shouldIncludeReferencedResource(
|
||||||
|
ResourceReferenceInfo theReferenceInfo, Set<Include> theIncludes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,8 @@ public class ApacheEncoder implements IPhoneticEncoder {
|
||||||
@Override
|
@Override
|
||||||
public String encode(String theString) {
|
public String encode(String theString) {
|
||||||
try {
|
try {
|
||||||
// If the string contains a space, encode alpha parts separately so, for example, numbers are preserved in address lines.
|
// If the string contains a space, encode alpha parts separately so, for example, numbers are preserved in
|
||||||
|
// address lines.
|
||||||
if (theString.contains(" ")) {
|
if (theString.contains(" ")) {
|
||||||
return encodeStringWithSpaces(theString);
|
return encodeStringWithSpaces(theString);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@ package ca.uhn.fhir.context.phonetic;
|
||||||
import com.google.common.base.CharMatcher;
|
import com.google.common.base.CharMatcher;
|
||||||
|
|
||||||
// Useful for numerical identifiers like phone numbers, address parts etc.
|
// Useful for numerical identifiers like phone numbers, address parts etc.
|
||||||
// This should not be used where decimals are important. A new "quantity encoder" should be added to handle cases like that.
|
// This should not be used where decimals are important. A new "quantity encoder" should be added to handle cases like
|
||||||
|
// that.
|
||||||
public class NumericEncoder implements IPhoneticEncoder {
|
public class NumericEncoder implements IPhoneticEncoder {
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
|
|
|
@ -27,12 +27,12 @@ import org.hl7.fhir.instance.model.api.IBase;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class returns the vocabulary that is shipped with the base FHIR
|
* This class returns the vocabulary that is shipped with the base FHIR
|
||||||
|
@ -46,13 +46,15 @@ import java.util.Optional;
|
||||||
*/
|
*/
|
||||||
public class DefaultProfileValidationSupport implements IValidationSupport {
|
public class DefaultProfileValidationSupport implements IValidationSupport {
|
||||||
|
|
||||||
private static final Map<FhirVersionEnum, IValidationSupport> ourImplementations = Collections.synchronizedMap(new HashMap<>());
|
private static final Map<FhirVersionEnum, IValidationSupport> ourImplementations =
|
||||||
|
Collections.synchronizedMap(new HashMap<>());
|
||||||
private final FhirContext myCtx;
|
private final FhirContext myCtx;
|
||||||
/**
|
/**
|
||||||
* This module just delegates all calls to a concrete implementation which will
|
* This module just delegates all calls to a concrete implementation which will
|
||||||
* be in this field. Which implementation gets used depends on the FHIR version.
|
* be in this field. Which implementation gets used depends on the FHIR version.
|
||||||
*/
|
*/
|
||||||
private final IValidationSupport myDelegate;
|
private final IValidationSupport myDelegate;
|
||||||
|
|
||||||
private final Runnable myFlush;
|
private final Runnable myFlush;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +78,11 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
|
||||||
* make this hard to clean up. At some point it'd be nice to figure out
|
* make this hard to clean up. At some point it'd be nice to figure out
|
||||||
* a cleaner solution though.
|
* a cleaner solution though.
|
||||||
*/
|
*/
|
||||||
strategy = ReflectionUtil.newInstance("org.hl7.fhir.common.hapi.validation.support.DefaultProfileValidationSupportNpmStrategy", IValidationSupport.class, new Class[]{FhirContext.class}, new Object[]{theFhirContext});
|
strategy = ReflectionUtil.newInstance(
|
||||||
|
"org.hl7.fhir.common.hapi.validation.support.DefaultProfileValidationSupportNpmStrategy",
|
||||||
|
IValidationSupport.class,
|
||||||
|
new Class[] {FhirContext.class},
|
||||||
|
new Object[] {theFhirContext});
|
||||||
((ILockable) strategy).lock();
|
((ILockable) strategy).lock();
|
||||||
} else {
|
} else {
|
||||||
strategy = new DefaultProfileValidationSupportBundleStrategy(theFhirContext);
|
strategy = new DefaultProfileValidationSupportBundleStrategy(theFhirContext);
|
||||||
|
@ -109,7 +115,6 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
|
||||||
return myDelegate.fetchAllNonBaseStructureDefinitions();
|
return myDelegate.fetchAllNonBaseStructureDefinitions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBaseResource fetchCodeSystem(String theSystem) {
|
public IBaseResource fetchCodeSystem(String theSystem) {
|
||||||
return myDelegate.fetchCodeSystem(theSystem);
|
return myDelegate.fetchCodeSystem(theSystem);
|
||||||
|
@ -134,17 +139,18 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
|
||||||
return myCtx;
|
return myCtx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static String getConformanceResourceUrl(FhirContext theFhirContext, IBaseResource theResource) {
|
public static String getConformanceResourceUrl(FhirContext theFhirContext, IBaseResource theResource) {
|
||||||
String urlValueString = null;
|
String urlValueString = null;
|
||||||
Optional<IBase> urlValue = theFhirContext.getResourceDefinition(theResource).getChildByName("url").getAccessor().getFirstValueOrNull(theResource);
|
Optional<IBase> urlValue = theFhirContext
|
||||||
|
.getResourceDefinition(theResource)
|
||||||
|
.getChildByName("url")
|
||||||
|
.getAccessor()
|
||||||
|
.getFirstValueOrNull(theResource);
|
||||||
if (urlValue.isPresent()) {
|
if (urlValue.isPresent()) {
|
||||||
IPrimitiveType<?> urlValueType = (IPrimitiveType<?>) urlValue.get();
|
IPrimitiveType<?> urlValueType = (IPrimitiveType<?>) urlValue.get();
|
||||||
urlValueString = urlValueType.getValueAsString();
|
urlValueString = urlValueType.getValueAsString();
|
||||||
}
|
}
|
||||||
return urlValueString;
|
return urlValueString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,20 +23,16 @@ import ca.uhn.fhir.context.ConfigurationException;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||||
import ca.uhn.fhir.context.support.DefaultProfileValidationSupport;
|
|
||||||
import ca.uhn.fhir.context.support.IValidationSupport;
|
|
||||||
import ca.uhn.fhir.i18n.Msg;
|
import ca.uhn.fhir.i18n.Msg;
|
||||||
import ca.uhn.fhir.parser.LenientErrorHandler;
|
import ca.uhn.fhir.parser.LenientErrorHandler;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.util.BundleUtil;
|
import ca.uhn.fhir.util.BundleUtil;
|
||||||
import ca.uhn.fhir.util.ClasspathUtil;
|
import ca.uhn.fhir.util.ClasspathUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
@ -46,8 +42,8 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
|
|
||||||
|
@ -55,7 +51,8 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
|
|
||||||
private static final String URL_PREFIX_STRUCTURE_DEFINITION = "http://hl7.org/fhir/StructureDefinition/";
|
private static final String URL_PREFIX_STRUCTURE_DEFINITION = "http://hl7.org/fhir/StructureDefinition/";
|
||||||
private static final String URL_PREFIX_STRUCTURE_DEFINITION_BASE = "http://hl7.org/fhir/";
|
private static final String URL_PREFIX_STRUCTURE_DEFINITION_BASE = "http://hl7.org/fhir/";
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(DefaultProfileValidationSupport.class);
|
private static final org.slf4j.Logger ourLog =
|
||||||
|
org.slf4j.LoggerFactory.getLogger(DefaultProfileValidationSupport.class);
|
||||||
private final FhirContext myCtx;
|
private final FhirContext myCtx;
|
||||||
|
|
||||||
private Map<String, IBaseResource> myCodeSystems;
|
private Map<String, IBaseResource> myCodeSystems;
|
||||||
|
@ -73,7 +70,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
myCtx = theFhirContext;
|
myCtx = theFhirContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initializeResourceLists() {
|
private void initializeResourceLists() {
|
||||||
|
|
||||||
if (myTerminologyResources != null && myStructureDefinitionResources != null) {
|
if (myTerminologyResources != null && myStructureDefinitionResources != null) {
|
||||||
|
@ -90,7 +86,8 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
terminologyResources.add("/org/hl7/fhir/instance/model/valueset/v3-codesystems.xml");
|
terminologyResources.add("/org/hl7/fhir/instance/model/valueset/v3-codesystems.xml");
|
||||||
Properties profileNameProperties = new Properties();
|
Properties profileNameProperties = new Properties();
|
||||||
try {
|
try {
|
||||||
profileNameProperties.load(DefaultProfileValidationSupport.class.getResourceAsStream("/org/hl7/fhir/instance/model/profile/profiles.properties"));
|
profileNameProperties.load(DefaultProfileValidationSupport.class.getResourceAsStream(
|
||||||
|
"/org/hl7/fhir/instance/model/profile/profiles.properties"));
|
||||||
for (Object nextKey : profileNameProperties.keySet()) {
|
for (Object nextKey : profileNameProperties.keySet()) {
|
||||||
structureDefinitionResources.add("/org/hl7/fhir/instance/model/profile/" + nextKey);
|
structureDefinitionResources.add("/org/hl7/fhir/instance/model/profile/" + nextKey);
|
||||||
}
|
}
|
||||||
|
@ -148,7 +145,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
myStructureDefinitionResources = structureDefinitionResources;
|
myStructureDefinitionResources = structureDefinitionResources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IBaseResource> fetchAllConformanceResources() {
|
public List<IBaseResource> fetchAllConformanceResources() {
|
||||||
ArrayList<IBaseResource> retVal = new ArrayList<>();
|
ArrayList<IBaseResource> retVal = new ArrayList<>();
|
||||||
|
@ -169,7 +165,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBaseResource fetchCodeSystem(String theSystem) {
|
public IBaseResource fetchCodeSystem(String theSystem) {
|
||||||
return fetchCodeSystemOrValueSet(theSystem, true);
|
return fetchCodeSystemOrValueSet(theSystem, true);
|
||||||
|
@ -208,8 +203,12 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
candidate = valueSets.get(system);
|
candidate = valueSets.get(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (candidate != null && isNotBlank(version) && !system.startsWith("http://hl7.org") && !system.startsWith("http://terminology.hl7.org")) {
|
if (candidate != null
|
||||||
if (!StringUtils.equals(version, myCtx.newTerser().getSinglePrimitiveValueOrNull(candidate, "version"))) {
|
&& isNotBlank(version)
|
||||||
|
&& !system.startsWith("http://hl7.org")
|
||||||
|
&& !system.startsWith("http://terminology.hl7.org")) {
|
||||||
|
if (!StringUtils.equals(
|
||||||
|
version, myCtx.newTerser().getSinglePrimitiveValueOrNull(candidate, "version"))) {
|
||||||
candidate = null;
|
candidate = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,7 +238,9 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
* search parameters eg "value.as(String)" when it should be
|
* search parameters eg "value.as(String)" when it should be
|
||||||
* "value.as(string)". This lets us be a bit lenient about this.
|
* "value.as(string)". This lets us be a bit lenient about this.
|
||||||
*/
|
*/
|
||||||
if (myCtx.getVersion().getVersion() == FhirVersionEnum.R4 || myCtx.getVersion().getVersion() == FhirVersionEnum.R4B || myCtx.getVersion().getVersion() == FhirVersionEnum.R5) {
|
if (myCtx.getVersion().getVersion() == FhirVersionEnum.R4
|
||||||
|
|| myCtx.getVersion().getVersion() == FhirVersionEnum.R4B
|
||||||
|
|| myCtx.getVersion().getVersion() == FhirVersionEnum.R5) {
|
||||||
String end = url.substring(URL_PREFIX_STRUCTURE_DEFINITION.length());
|
String end = url.substring(URL_PREFIX_STRUCTURE_DEFINITION.length());
|
||||||
if (Character.isUpperCase(end.charAt(0))) {
|
if (Character.isUpperCase(end.charAt(0))) {
|
||||||
String newEnd = Character.toLowerCase(end.charAt(0)) + end.substring(1);
|
String newEnd = Character.toLowerCase(end.charAt(0)) + end.substring(1);
|
||||||
|
@ -251,9 +252,7 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +288,8 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
return structureDefinitions;
|
return structureDefinitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadCodeSystems(Map<String, IBaseResource> theCodeSystems, Map<String, IBaseResource> theValueSets, String theClasspath) {
|
private void loadCodeSystems(
|
||||||
|
Map<String, IBaseResource> theCodeSystems, Map<String, IBaseResource> theValueSets, String theClasspath) {
|
||||||
ourLog.info("Loading CodeSystem/ValueSet from classpath: {}", theClasspath);
|
ourLog.info("Loading CodeSystem/ValueSet from classpath: {}", theClasspath);
|
||||||
InputStream inputStream = DefaultProfileValidationSupport.class.getResourceAsStream(theClasspath);
|
InputStream inputStream = DefaultProfileValidationSupport.class.getResourceAsStream(theClasspath);
|
||||||
InputStreamReader reader = null;
|
InputStreamReader reader = null;
|
||||||
|
@ -319,8 +319,8 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
switch (myCtx.getVersion().getVersion()) {
|
switch (myCtx.getVersion().getVersion()) {
|
||||||
case DSTU2:
|
case DSTU2:
|
||||||
case DSTU2_HL7ORG:
|
case DSTU2_HL7ORG:
|
||||||
|
IPrimitiveType<?> codeSystem = myCtx.newTerser()
|
||||||
IPrimitiveType<?> codeSystem = myCtx.newTerser().getSingleValueOrNull(next, "ValueSet.codeSystem.system", IPrimitiveType.class);
|
.getSingleValueOrNull(next, "ValueSet.codeSystem.system", IPrimitiveType.class);
|
||||||
if (codeSystem != null && isNotBlank(codeSystem.getValueAsString())) {
|
if (codeSystem != null && isNotBlank(codeSystem.getValueAsString())) {
|
||||||
theCodeSystems.put(codeSystem.getValueAsString(), next);
|
theCodeSystems.put(codeSystem.getValueAsString(), next);
|
||||||
}
|
}
|
||||||
|
@ -336,8 +336,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
|
@ -356,15 +354,14 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
// Load built-in system
|
// Load built-in system
|
||||||
|
|
||||||
if (myCtx.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
|
if (myCtx.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
|
||||||
String storageCodeEnum = ClasspathUtil.loadResource("ca/uhn/fhir/context/support/HapiFhirStorageResponseCode.json");
|
String storageCodeEnum =
|
||||||
IBaseResource storageCodeCodeSystem = myCtx.newJsonParser().setParserErrorHandler(new LenientErrorHandler()).parseResource(storageCodeEnum);
|
ClasspathUtil.loadResource("ca/uhn/fhir/context/support/HapiFhirStorageResponseCode.json");
|
||||||
|
IBaseResource storageCodeCodeSystem = myCtx.newJsonParser()
|
||||||
|
.setParserErrorHandler(new LenientErrorHandler())
|
||||||
|
.parseResource(storageCodeEnum);
|
||||||
String url = myCtx.newTerser().getSinglePrimitiveValueOrNull(storageCodeCodeSystem, "url");
|
String url = myCtx.newTerser().getSinglePrimitiveValueOrNull(storageCodeCodeSystem, "url");
|
||||||
theCodeSystems.put(url, storageCodeCodeSystem);
|
theCodeSystems.put(url, storageCodeCodeSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadStructureDefinitions(Map<String, IBaseResource> theCodeSystems, String theClasspath) {
|
private void loadStructureDefinitions(Map<String, IBaseResource> theCodeSystems, String theClasspath) {
|
||||||
|
@ -372,7 +369,12 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
|
|
||||||
String packageUserData = null;
|
String packageUserData = null;
|
||||||
if (myCtx.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
|
if (myCtx.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
|
||||||
packageUserData = "hl7.fhir." + myCtx.getVersion().getVersion().name().replace("DSTU", "R").toLowerCase(Locale.US);
|
packageUserData = "hl7.fhir."
|
||||||
|
+ myCtx.getVersion()
|
||||||
|
.getVersion()
|
||||||
|
.name()
|
||||||
|
.replace("DSTU", "R")
|
||||||
|
.toLowerCase(Locale.US);
|
||||||
}
|
}
|
||||||
|
|
||||||
try (InputStream valueSetText = DefaultProfileValidationSupport.class.getResourceAsStream(theClasspath)) {
|
try (InputStream valueSetText = DefaultProfileValidationSupport.class.getResourceAsStream(theClasspath)) {
|
||||||
|
@ -389,7 +391,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
if (isNotBlank(url)) {
|
if (isNotBlank(url)) {
|
||||||
theCodeSystems.put(url, next);
|
theCodeSystems.put(url, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is used by the validator to determine which package a given SD came from.
|
// This is used by the validator to determine which package a given SD came from.
|
||||||
|
@ -397,7 +398,6 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
if (packageUserData != null) {
|
if (packageUserData != null) {
|
||||||
next.setUserData("package", packageUserData);
|
next.setUserData("package", packageUserData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -426,5 +426,4 @@ class DefaultProfileValidationSupportBundleStrategy implements IValidationSuppor
|
||||||
ArrayList<IBaseResource> retVal = new ArrayList<>(theMap.values());
|
ArrayList<IBaseResource> retVal = new ArrayList<>(theMap.values());
|
||||||
return (List<T>) Collections.unmodifiableList(retVal);
|
return (List<T>) Collections.unmodifiableList(retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,6 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -43,6 +41,8 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.defaultString;
|
import static org.apache.commons.lang3.StringUtils.defaultString;
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
|
@ -80,7 +80,6 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
public interface IValidationSupport {
|
public interface IValidationSupport {
|
||||||
String URL_PREFIX_VALUE_SET = "http://hl7.org/fhir/ValueSet/";
|
String URL_PREFIX_VALUE_SET = "http://hl7.org/fhir/ValueSet/";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expands the given portion of a ValueSet
|
* Expands the given portion of a ValueSet
|
||||||
*
|
*
|
||||||
|
@ -91,7 +90,10 @@ public interface IValidationSupport {
|
||||||
* @return The expansion, or null
|
* @return The expansion, or null
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
default ValueSetExpansionOutcome expandValueSet(ValidationSupportContext theValidationSupportContext, @Nullable ValueSetExpansionOptions theExpansionOptions, @Nonnull IBaseResource theValueSetToExpand) {
|
default ValueSetExpansionOutcome expandValueSet(
|
||||||
|
ValidationSupportContext theValidationSupportContext,
|
||||||
|
@Nullable ValueSetExpansionOptions theExpansionOptions,
|
||||||
|
@Nonnull IBaseResource theValueSetToExpand) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,11 +109,16 @@ public interface IValidationSupport {
|
||||||
* @since 6.0.0
|
* @since 6.0.0
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
default ValueSetExpansionOutcome expandValueSet(ValidationSupportContext theValidationSupportContext, @Nullable ValueSetExpansionOptions theExpansionOptions, @Nonnull String theValueSetUrlToExpand) throws ResourceNotFoundException {
|
default ValueSetExpansionOutcome expandValueSet(
|
||||||
|
ValidationSupportContext theValidationSupportContext,
|
||||||
|
@Nullable ValueSetExpansionOptions theExpansionOptions,
|
||||||
|
@Nonnull String theValueSetUrlToExpand)
|
||||||
|
throws ResourceNotFoundException {
|
||||||
Validate.notBlank(theValueSetUrlToExpand, "theValueSetUrlToExpand must not be null or blank");
|
Validate.notBlank(theValueSetUrlToExpand, "theValueSetUrlToExpand must not be null or blank");
|
||||||
IBaseResource valueSet = fetchValueSet(theValueSetUrlToExpand);
|
IBaseResource valueSet = fetchValueSet(theValueSetUrlToExpand);
|
||||||
if (valueSet == null) {
|
if (valueSet == null) {
|
||||||
throw new ResourceNotFoundException(Msg.code(2024) + "Unknown ValueSet: " + UrlUtil.escapeUrlParam(theValueSetUrlToExpand));
|
throw new ResourceNotFoundException(
|
||||||
|
Msg.code(2024) + "Unknown ValueSet: " + UrlUtil.escapeUrlParam(theValueSetUrlToExpand));
|
||||||
}
|
}
|
||||||
return expandValueSet(theValidationSupportContext, theExpansionOptions, valueSet);
|
return expandValueSet(theValidationSupportContext, theExpansionOptions, valueSet);
|
||||||
}
|
}
|
||||||
|
@ -201,12 +208,9 @@ public interface IValidationSupport {
|
||||||
|
|
||||||
if (theClass == null) {
|
if (theClass == null) {
|
||||||
Supplier<IBaseResource>[] sources = new Supplier[] {
|
Supplier<IBaseResource>[] sources = new Supplier[] {
|
||||||
() -> fetchStructureDefinition(theUri),
|
() -> fetchStructureDefinition(theUri), () -> fetchValueSet(theUri), () -> fetchCodeSystem(theUri)
|
||||||
() -> fetchValueSet(theUri),
|
|
||||||
() -> fetchCodeSystem(theUri)
|
|
||||||
};
|
};
|
||||||
return (T) Arrays
|
return (T) Arrays.stream(sources)
|
||||||
.stream(sources)
|
|
||||||
.map(t -> t.get())
|
.map(t -> t.get())
|
||||||
.filter(t -> t != null)
|
.filter(t -> t != null)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
@ -289,7 +293,13 @@ public interface IValidationSupport {
|
||||||
* @return Returns a validation result object
|
* @return Returns a validation result object
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
default CodeValidationResult validateCode(@Nonnull ValidationSupportContext theValidationSupportContext, @Nonnull ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, String theValueSetUrl) {
|
default CodeValidationResult validateCode(
|
||||||
|
@Nonnull ValidationSupportContext theValidationSupportContext,
|
||||||
|
@Nonnull ConceptValidationOptions theOptions,
|
||||||
|
String theCodeSystem,
|
||||||
|
String theCode,
|
||||||
|
String theDisplay,
|
||||||
|
String theValueSetUrl) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +317,13 @@ public interface IValidationSupport {
|
||||||
* @return Returns a validation result object, or <code>null</code> if this validation support module can not handle this kind of request
|
* @return Returns a validation result object, or <code>null</code> if this validation support module can not handle this kind of request
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
default CodeValidationResult validateCodeInValueSet(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, @Nonnull IBaseResource theValueSet) {
|
default CodeValidationResult validateCodeInValueSet(
|
||||||
|
ValidationSupportContext theValidationSupportContext,
|
||||||
|
ConceptValidationOptions theOptions,
|
||||||
|
String theCodeSystem,
|
||||||
|
String theCode,
|
||||||
|
String theDisplay,
|
||||||
|
@Nonnull IBaseResource theValueSet) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +337,11 @@ public interface IValidationSupport {
|
||||||
* @param theDisplayLanguage to filter out the designation by the display language. To return all designation, set this value to <code>null</code>.
|
* @param theDisplayLanguage to filter out the designation by the display language. To return all designation, set this value to <code>null</code>.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
default LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) {
|
default LookupCodeResult lookupCode(
|
||||||
|
ValidationSupportContext theValidationSupportContext,
|
||||||
|
String theSystem,
|
||||||
|
String theCode,
|
||||||
|
String theDisplayLanguage) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +354,8 @@ public interface IValidationSupport {
|
||||||
* @param theCode The code
|
* @param theCode The code
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
default LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) {
|
default LookupCodeResult lookupCode(
|
||||||
|
ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) {
|
||||||
return lookupCode(theValidationSupportContext, theSystem, theCode, null);
|
return lookupCode(theValidationSupportContext, theSystem, theCode, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +379,12 @@ public interface IValidationSupport {
|
||||||
* @return Returns null if this module does not know how to handle this request
|
* @return Returns null if this module does not know how to handle this request
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
default IBaseResource generateSnapshot(ValidationSupportContext theValidationSupportContext, IBaseResource theInput, String theUrl, String theWebUrl, String theProfileName) {
|
default IBaseResource generateSnapshot(
|
||||||
|
ValidationSupportContext theValidationSupportContext,
|
||||||
|
IBaseResource theInput,
|
||||||
|
String theUrl,
|
||||||
|
String theWebUrl,
|
||||||
|
String theProfileName) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,11 +781,13 @@ public interface IValidationSupport {
|
||||||
|
|
||||||
public void throwNotFoundIfAppropriate() {
|
public void throwNotFoundIfAppropriate() {
|
||||||
if (isFound() == false) {
|
if (isFound() == false) {
|
||||||
throw new ResourceNotFoundException(Msg.code(1738) + "Unable to find code[" + getSearchedForCode() + "] in system[" + getSearchedForSystem() + "]");
|
throw new ResourceNotFoundException(Msg.code(1738) + "Unable to find code[" + getSearchedForCode()
|
||||||
|
+ "] in system[" + getSearchedForSystem() + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBaseParameters toParameters(FhirContext theContext, List<? extends IPrimitiveType<String>> theProperties) {
|
public IBaseParameters toParameters(
|
||||||
|
FhirContext theContext, List<? extends IPrimitiveType<String>> theProperties) {
|
||||||
|
|
||||||
IBaseParameters retVal = ParametersUtil.newInstance(theContext);
|
IBaseParameters retVal = ParametersUtil.newInstance(theContext);
|
||||||
if (isNotBlank(getCodeSystemDisplayName())) {
|
if (isNotBlank(getCodeSystemDisplayName())) {
|
||||||
|
@ -775,8 +803,7 @@ public interface IValidationSupport {
|
||||||
|
|
||||||
Set<String> properties = Collections.emptySet();
|
Set<String> properties = Collections.emptySet();
|
||||||
if (theProperties != null) {
|
if (theProperties != null) {
|
||||||
properties = theProperties
|
properties = theProperties.stream()
|
||||||
.stream()
|
|
||||||
.map(IPrimitiveType::getValueAsString)
|
.map(IPrimitiveType::getValueAsString)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
@ -797,7 +824,8 @@ public interface IValidationSupport {
|
||||||
ParametersUtil.addPartString(theContext, property, "value", prop.getValue());
|
ParametersUtil.addPartString(theContext, property, "value", prop.getValue());
|
||||||
} else if (next instanceof IValidationSupport.CodingConceptProperty) {
|
} else if (next instanceof IValidationSupport.CodingConceptProperty) {
|
||||||
IValidationSupport.CodingConceptProperty prop = (IValidationSupport.CodingConceptProperty) next;
|
IValidationSupport.CodingConceptProperty prop = (IValidationSupport.CodingConceptProperty) next;
|
||||||
ParametersUtil.addPartCoding(theContext, property, "value", prop.getCodeSystem(), prop.getCode(), prop.getDisplay());
|
ParametersUtil.addPartCoding(
|
||||||
|
theContext, property, "value", prop.getCodeSystem(), prop.getCode(), prop.getDisplay());
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException(Msg.code(1739) + "Don't know how to handle " + next.getClass());
|
throw new IllegalStateException(Msg.code(1739) + "Don't know how to handle " + next.getClass());
|
||||||
}
|
}
|
||||||
|
@ -809,7 +837,8 @@ public interface IValidationSupport {
|
||||||
|
|
||||||
IBase property = ParametersUtil.addParameterToParameters(theContext, retVal, "designation");
|
IBase property = ParametersUtil.addParameterToParameters(theContext, retVal, "designation");
|
||||||
ParametersUtil.addPartCode(theContext, property, "language", next.getLanguage());
|
ParametersUtil.addPartCode(theContext, property, "language", next.getLanguage());
|
||||||
ParametersUtil.addPartCoding(theContext, property, "use", next.getUseSystem(), next.getUseCode(), next.getUseDisplay());
|
ParametersUtil.addPartCoding(
|
||||||
|
theContext, property, "use", next.getUseSystem(), next.getUseCode(), next.getUseDisplay());
|
||||||
ParametersUtil.addPartString(theContext, property, "value", next.getValue());
|
ParametersUtil.addPartString(theContext, property, "value", next.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -825,7 +854,6 @@ public interface IValidationSupport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TranslateCodeRequest {
|
class TranslateCodeRequest {
|
||||||
private final String myTargetSystemUrl;
|
private final String myTargetSystemUrl;
|
||||||
private final String myConceptMapUrl;
|
private final String myConceptMapUrl;
|
||||||
|
|
|
@ -115,9 +115,7 @@ public class ValueSetExpansionOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ValueSetExpansionOptions forOffsetAndCount(int theOffset, int theCount) {
|
public static ValueSetExpansionOptions forOffsetAndCount(int theOffset, int theCount) {
|
||||||
return new ValueSetExpansionOptions()
|
return new ValueSetExpansionOptions().setOffset(theOffset).setCount(theCount);
|
||||||
.setOffset(theOffset)
|
|
||||||
.setCount(theCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTheDisplayLanguage() {
|
public String getTheDisplayLanguage() {
|
||||||
|
|
|
@ -36,5 +36,4 @@ public class FhirPathExecutionException extends InternalErrorException {
|
||||||
public FhirPathExecutionException(String theMessage) {
|
public FhirPathExecutionException(String theMessage) {
|
||||||
super(theMessage);
|
super(theMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@ package ca.uhn.fhir.fhirpath;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public interface IFhirPath {
|
public interface IFhirPath {
|
||||||
|
|
||||||
|
@ -47,13 +47,11 @@ public interface IFhirPath {
|
||||||
*/
|
*/
|
||||||
<T extends IBase> Optional<T> evaluateFirst(IBase theInput, String thePath, Class<T> theReturnType);
|
<T extends IBase> Optional<T> evaluateFirst(IBase theInput, String thePath, Class<T> theReturnType);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the expression and throws an exception if it can not parse correctly
|
* Parses the expression and throws an exception if it can not parse correctly
|
||||||
*/
|
*/
|
||||||
void parse(String theExpression) throws Exception;
|
void parse(String theExpression) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method can be used optionally to supply an evaluation context for the
|
* This method can be used optionally to supply an evaluation context for the
|
||||||
* FHIRPath evaluator instance. The context can be used to supply data needed by
|
* FHIRPath evaluator instance. The context can be used to supply data needed by
|
||||||
|
|
|
@ -19,7 +19,4 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.i18n;
|
package ca.uhn.fhir.i18n;
|
||||||
|
|
||||||
public final class HapiErrorCode {
|
public final class HapiErrorCode {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,6 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
import static org.apache.commons.lang3.StringUtils.trim;
|
import static org.apache.commons.lang3.StringUtils.trim;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This feature is not yet in its final state and should be considered an internal part of HAPI for now - use with caution
|
* This feature is not yet in its final state and should be considered an internal part of HAPI for now - use with caution
|
||||||
*/
|
*/
|
||||||
|
@ -48,6 +46,7 @@ public class HapiLocalizer {
|
||||||
|
|
||||||
@SuppressWarnings("WeakerAccess")
|
@SuppressWarnings("WeakerAccess")
|
||||||
public static final String UNKNOWN_I18N_KEY_MESSAGE = "!MESSAGE!";
|
public static final String UNKNOWN_I18N_KEY_MESSAGE = "!MESSAGE!";
|
||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(HapiLocalizer.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(HapiLocalizer.class);
|
||||||
private static boolean ourFailOnMissingMessage;
|
private static boolean ourFailOnMissingMessage;
|
||||||
private final Map<String, MessageFormat> myKeyToMessageFormat = new ConcurrentHashMap<>();
|
private final Map<String, MessageFormat> myKeyToMessageFormat = new ConcurrentHashMap<>();
|
||||||
|
@ -148,7 +147,6 @@ public class HapiLocalizer {
|
||||||
MessageFormat newMessageFormat(String theFormatString) {
|
MessageFormat newMessageFormat(String theFormatString) {
|
||||||
StringBuilder pattern = new StringBuilder(theFormatString.trim());
|
StringBuilder pattern = new StringBuilder(theFormatString.trim());
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < (pattern.length() - 1); i++) {
|
for (int i = 0; i < (pattern.length() - 1); i++) {
|
||||||
if (pattern.charAt(i) == '{') {
|
if (pattern.charAt(i) == '{') {
|
||||||
char nextChar = pattern.charAt(i + 1);
|
char nextChar = pattern.charAt(i + 1);
|
||||||
|
@ -191,5 +189,4 @@ public class HapiLocalizer {
|
||||||
public static String toKey(Class<?> theType, String theKey) {
|
public static String toKey(Class<?> theType, String theKey) {
|
||||||
return theType.getName() + '.' + theKey;
|
return theType.getName() + '.' + theKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ public final class Msg {
|
||||||
* IMPORTANT: Please update the table in the following link after you add a new code:
|
* IMPORTANT: Please update the table in the following link after you add a new code:
|
||||||
* https://github.com/hapifhir/hapi-fhir/wiki/Bumping-Error-Code
|
* https://github.com/hapifhir/hapi-fhir/wiki/Bumping-Error-Code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Msg() {}
|
private Msg() {}
|
||||||
|
|
||||||
public static String code(int theCode) {
|
public static String code(int theCode) {
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package ca.uhn.fhir.interceptor.api;
|
package ca.uhn.fhir.interceptor.api;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Repeatable;
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
|
@ -24,12 +24,12 @@ import com.google.common.collect.ListMultimap;
|
||||||
import com.google.common.collect.Multimaps;
|
import com.google.common.collect.Multimaps;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class HookParams {
|
public class HookParams {
|
||||||
|
|
||||||
|
@ -38,8 +38,7 @@ public class HookParams {
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public HookParams() {
|
public HookParams() {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -110,9 +109,7 @@ public class HookParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Object> values() {
|
public Collection<Object> values() {
|
||||||
return
|
return Collections.unmodifiableCollection(myParams.values()).stream()
|
||||||
Collections.unmodifiableCollection(myParams.values())
|
|
||||||
.stream()
|
|
||||||
.map(t -> unwrapValue(t))
|
.map(t -> unwrapValue(t))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,5 +31,4 @@ import com.google.common.annotations.VisibleForTesting;
|
||||||
public interface IAnonymousInterceptor {
|
public interface IAnonymousInterceptor {
|
||||||
|
|
||||||
void invoke(IPointcut thePointcut, HookParams theArgs);
|
void invoke(IPointcut thePointcut, HookParams theArgs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.interceptor.api;
|
package ca.uhn.fhir.interceptor.api;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public interface IBaseInterceptorService<POINTCUT extends IPointcut> extends IBaseInterceptorBroadcaster<POINTCUT> {
|
public interface IBaseInterceptorService<POINTCUT extends IPointcut> extends IBaseInterceptorBroadcaster<POINTCUT> {
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,4 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.interceptor.api;
|
package ca.uhn.fhir.interceptor.api;
|
||||||
|
|
||||||
public interface IInterceptorBroadcaster extends IBaseInterceptorBroadcaster<Pointcut> {
|
public interface IInterceptorBroadcaster extends IBaseInterceptorBroadcaster<Pointcut> {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -24,5 +24,4 @@ public interface IInterceptorService extends IBaseInterceptorService<Pointcut>,
|
||||||
void registerAnonymousInterceptor(Pointcut thePointcut, IAnonymousInterceptor theInterceptor);
|
void registerAnonymousInterceptor(Pointcut thePointcut, IAnonymousInterceptor theInterceptor);
|
||||||
|
|
||||||
void registerAnonymousInterceptor(Pointcut thePointcut, int theOrder, IAnonymousInterceptor theInterceptor);
|
void registerAnonymousInterceptor(Pointcut thePointcut, int theOrder, IAnonymousInterceptor theInterceptor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.interceptor.api;
|
package ca.uhn.fhir.interceptor.api;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public interface IPointcut {
|
public interface IPointcut {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
|
|
@ -27,13 +27,13 @@ import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||||
import ca.uhn.fhir.validation.ValidationResult;
|
import ca.uhn.fhir.validation.ValidationResult;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseConformance;
|
import org.hl7.fhir.instance.model.api.IBaseConformance;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Value for {@link Hook#value()}
|
* Value for {@link Hook#value()}
|
||||||
|
@ -74,10 +74,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* </p>
|
* </p>
|
||||||
* Hook methods must return <code>void</code>.
|
* Hook methods must return <code>void</code>.
|
||||||
*/
|
*/
|
||||||
CLIENT_REQUEST(void.class,
|
CLIENT_REQUEST(
|
||||||
"ca.uhn.fhir.rest.client.api.IHttpRequest",
|
void.class, "ca.uhn.fhir.rest.client.api.IHttpRequest", "ca.uhn.fhir.rest.client.api.IRestfulClient"),
|
||||||
"ca.uhn.fhir.rest.client.api.IRestfulClient"
|
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Client Hook:</b>
|
* <b>Client Hook:</b>
|
||||||
|
@ -99,11 +97,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* </p>
|
* </p>
|
||||||
* Hook methods must return <code>void</code>.
|
* Hook methods must return <code>void</code>.
|
||||||
*/
|
*/
|
||||||
CLIENT_RESPONSE(void.class,
|
CLIENT_RESPONSE(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.client.api.IHttpRequest",
|
"ca.uhn.fhir.rest.client.api.IHttpRequest",
|
||||||
"ca.uhn.fhir.rest.client.api.IHttpResponse",
|
"ca.uhn.fhir.rest.client.api.IHttpResponse",
|
||||||
"ca.uhn.fhir.rest.client.api.IRestfulClient"
|
"ca.uhn.fhir.rest.client.api.IRestfulClient"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -138,11 +136,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* chooses to modify the <code>CapabilityStatement</code> that was supplied to the interceptor, it is fine
|
* chooses to modify the <code>CapabilityStatement</code> that was supplied to the interceptor, it is fine
|
||||||
* for your hook method to return <code>void</code> or <code>null</code>.
|
* for your hook method to return <code>void</code> or <code>null</code>.
|
||||||
*/
|
*/
|
||||||
SERVER_CAPABILITY_STATEMENT_GENERATED(IBaseConformance.class,
|
SERVER_CAPABILITY_STATEMENT_GENERATED(
|
||||||
|
IBaseConformance.class,
|
||||||
"org.hl7.fhir.instance.model.api.IBaseConformance",
|
"org.hl7.fhir.instance.model.api.IBaseConformance",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -167,10 +165,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* letting HAPI handle the response normally, you must return <code>false</code>. In this case,
|
* letting HAPI handle the response normally, you must return <code>false</code>. In this case,
|
||||||
* no further processing will occur and no further interceptors will be called.
|
* no further processing will occur and no further interceptors will be called.
|
||||||
*/
|
*/
|
||||||
SERVER_INCOMING_REQUEST_PRE_PROCESSED(boolean.class,
|
SERVER_INCOMING_REQUEST_PRE_PROCESSED(
|
||||||
"javax.servlet.http.HttpServletRequest",
|
boolean.class, "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse"),
|
||||||
"javax.servlet.http.HttpServletResponse"
|
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -215,13 +211,13 @@ public enum Pointcut implements IPointcut {
|
||||||
* should return <code>false</code>, to indicate that they have handled the request and processing should stop.
|
* should return <code>false</code>, to indicate that they have handled the request and processing should stop.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SERVER_HANDLE_EXCEPTION(boolean.class,
|
SERVER_HANDLE_EXCEPTION(
|
||||||
|
boolean.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"javax.servlet.http.HttpServletRequest",
|
"javax.servlet.http.HttpServletRequest",
|
||||||
"javax.servlet.http.HttpServletResponse",
|
"javax.servlet.http.HttpServletResponse",
|
||||||
"ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException"
|
"ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -263,12 +259,12 @@ public enum Pointcut implements IPointcut {
|
||||||
*
|
*
|
||||||
* @since 5.4.0
|
* @since 5.4.0
|
||||||
*/
|
*/
|
||||||
SERVER_INCOMING_REQUEST_PRE_HANDLER_SELECTED(boolean.class,
|
SERVER_INCOMING_REQUEST_PRE_HANDLER_SELECTED(
|
||||||
|
boolean.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"javax.servlet.http.HttpServletRequest",
|
"javax.servlet.http.HttpServletRequest",
|
||||||
"javax.servlet.http.HttpServletResponse"
|
"javax.servlet.http.HttpServletResponse"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -308,13 +304,12 @@ public enum Pointcut implements IPointcut {
|
||||||
* to indicate that the interceptor has detected an unauthorized access
|
* to indicate that the interceptor has detected an unauthorized access
|
||||||
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
|
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
|
||||||
*/
|
*/
|
||||||
SERVER_INCOMING_REQUEST_POST_PROCESSED(boolean.class,
|
SERVER_INCOMING_REQUEST_POST_PROCESSED(
|
||||||
|
boolean.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"javax.servlet.http.HttpServletRequest",
|
"javax.servlet.http.HttpServletRequest",
|
||||||
"javax.servlet.http.HttpServletResponse"
|
"javax.servlet.http.HttpServletResponse"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -353,12 +348,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* will be aborted with an appropriate error returned to the client.
|
* will be aborted with an appropriate error returned to the client.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SERVER_INCOMING_REQUEST_PRE_HANDLED(void.class,
|
SERVER_INCOMING_REQUEST_PRE_HANDLED(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.rest.api.RestOperationTypeEnum"
|
"ca.uhn.fhir.rest.api.RestOperationTypeEnum"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -375,9 +369,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hook methods may modify the method binding, replace it, or return <code>null</code> to cancel the binding.
|
* Hook methods may modify the method binding, replace it, or return <code>null</code> to cancel the binding.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SERVER_PROVIDER_METHOD_BOUND("ca.uhn.fhir.rest.server.method.BaseMethodBinding",
|
SERVER_PROVIDER_METHOD_BOUND(
|
||||||
"ca.uhn.fhir.rest.server.method.BaseMethodBinding"),
|
"ca.uhn.fhir.rest.server.method.BaseMethodBinding", "ca.uhn.fhir.rest.server.method.BaseMethodBinding"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -431,13 +424,13 @@ public enum Pointcut implements IPointcut {
|
||||||
* should return an exception.
|
* should return an exception.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SERVER_PRE_PROCESS_OUTGOING_EXCEPTION(BaseServerResponseException.class,
|
SERVER_PRE_PROCESS_OUTGOING_EXCEPTION(
|
||||||
|
BaseServerResponseException.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"java.lang.Throwable",
|
"java.lang.Throwable",
|
||||||
"javax.servlet.http.HttpServletRequest",
|
"javax.servlet.http.HttpServletRequest",
|
||||||
"javax.servlet.http.HttpServletResponse"
|
"javax.servlet.http.HttpServletResponse"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -483,15 +476,14 @@ public enum Pointcut implements IPointcut {
|
||||||
* has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
|
* has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
|
||||||
* will be returned to the client.
|
* will be returned to the client.
|
||||||
*/
|
*/
|
||||||
SERVER_OUTGOING_RESPONSE(boolean.class,
|
SERVER_OUTGOING_RESPONSE(
|
||||||
|
boolean.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"ca.uhn.fhir.rest.api.server.ResponseDetails",
|
"ca.uhn.fhir.rest.api.server.ResponseDetails",
|
||||||
"javax.servlet.http.HttpServletRequest",
|
"javax.servlet.http.HttpServletRequest",
|
||||||
"javax.servlet.http.HttpServletResponse"
|
"javax.servlet.http.HttpServletResponse"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -525,12 +517,11 @@ public enum Pointcut implements IPointcut {
|
||||||
*
|
*
|
||||||
* @since 5.0.0
|
* @since 5.0.0
|
||||||
*/
|
*/
|
||||||
SERVER_OUTGOING_WRITER_CREATED(Writer.class,
|
SERVER_OUTGOING_WRITER_CREATED(
|
||||||
|
Writer.class,
|
||||||
"java.io.Writer",
|
"java.io.Writer",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -576,15 +567,14 @@ public enum Pointcut implements IPointcut {
|
||||||
* has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
|
* has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
|
||||||
* will be returned to the client.
|
* will be returned to the client.
|
||||||
*/
|
*/
|
||||||
SERVER_OUTGOING_GRAPHQL_RESPONSE(boolean.class,
|
SERVER_OUTGOING_GRAPHQL_RESPONSE(
|
||||||
|
boolean.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"java.lang.String",
|
"java.lang.String",
|
||||||
"java.lang.String",
|
"java.lang.String",
|
||||||
"javax.servlet.http.HttpServletRequest",
|
"javax.servlet.http.HttpServletRequest",
|
||||||
"javax.servlet.http.HttpServletResponse"
|
"javax.servlet.http.HttpServletResponse"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -618,9 +608,7 @@ public enum Pointcut implements IPointcut {
|
||||||
void.class,
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"org.hl7.fhir.instance.model.api.IBaseOperationOutcome"
|
"org.hl7.fhir.instance.model.api.IBaseOperationOutcome"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -661,11 +649,9 @@ public enum Pointcut implements IPointcut {
|
||||||
*/
|
*/
|
||||||
SERVER_PROCESSING_COMPLETED_NORMALLY(
|
SERVER_PROCESSING_COMPLETED_NORMALLY(
|
||||||
void.class,
|
void.class,
|
||||||
new ExceptionHandlingSpec()
|
new ExceptionHandlingSpec().addLogAndSwallow(Throwable.class),
|
||||||
.addLogAndSwallow(Throwable.class),
|
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Server Hook:</b>
|
* <b>Server Hook:</b>
|
||||||
|
@ -700,11 +686,9 @@ public enum Pointcut implements IPointcut {
|
||||||
*/
|
*/
|
||||||
SERVER_PROCESSING_COMPLETED(
|
SERVER_PROCESSING_COMPLETED(
|
||||||
void.class,
|
void.class,
|
||||||
new ExceptionHandlingSpec()
|
new ExceptionHandlingSpec().addLogAndSwallow(Throwable.class),
|
||||||
.addLogAndSwallow(Throwable.class),
|
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -726,7 +710,6 @@ public enum Pointcut implements IPointcut {
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_RESOURCE_MODIFIED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
SUBSCRIPTION_RESOURCE_MODIFIED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
* Invoked any time that a resource is matched by an individual subscription, and
|
* Invoked any time that a resource is matched by an individual subscription, and
|
||||||
|
@ -748,7 +731,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* returns <code>false</code>, delivery will be aborted.
|
* returns <code>false</code>, delivery will be aborted.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_RESOURCE_MATCHED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult"),
|
SUBSCRIPTION_RESOURCE_MATCHED(
|
||||||
|
boolean.class,
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage",
|
||||||
|
"ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -764,7 +751,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_RESOURCE_DID_NOT_MATCH_ANY_SUBSCRIPTIONS(void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
SUBSCRIPTION_RESOURCE_DID_NOT_MATCH_ANY_SUBSCRIPTIONS(
|
||||||
|
void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -786,7 +774,10 @@ public enum Pointcut implements IPointcut {
|
||||||
* returns <code>false</code>, processing will be aborted.
|
* returns <code>false</code>, processing will be aborted.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_BEFORE_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
|
SUBSCRIPTION_BEFORE_DELIVERY(
|
||||||
|
boolean.class,
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -803,8 +794,10 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_AFTER_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
|
SUBSCRIPTION_AFTER_DELIVERY(
|
||||||
|
void.class,
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -827,7 +820,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* taken for the delivery.
|
* taken for the delivery.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_AFTER_DELIVERY_FAILED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "java.lang.Exception"),
|
SUBSCRIPTION_AFTER_DELIVERY_FAILED(
|
||||||
|
boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "java.lang.Exception"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -845,7 +839,10 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
|
SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY(
|
||||||
|
void.class,
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -866,7 +863,10 @@ public enum Pointcut implements IPointcut {
|
||||||
* returns <code>false</code>, processing will be aborted.
|
* returns <code>false</code>, processing will be aborted.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
|
SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY(
|
||||||
|
boolean.class,
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -884,7 +884,10 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_AFTER_MESSAGE_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
|
SUBSCRIPTION_AFTER_MESSAGE_DELIVERY(
|
||||||
|
void.class,
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -909,8 +912,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* returns <code>false</code>, processing will be aborted.
|
* returns <code>false</code>, processing will be aborted.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_BEFORE_MESSAGE_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage"),
|
SUBSCRIPTION_BEFORE_MESSAGE_DELIVERY(
|
||||||
|
boolean.class,
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage",
|
||||||
|
"ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -929,8 +935,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* returns <code>false</code>, processing will be aborted.
|
* returns <code>false</code>, processing will be aborted.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_BEFORE_PERSISTED_RESOURCE_CHECKED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
SUBSCRIPTION_BEFORE_PERSISTED_RESOURCE_CHECKED(
|
||||||
|
boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -947,8 +953,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
SUBSCRIPTION_AFTER_PERSISTED_RESOURCE_CHECKED(
|
||||||
|
void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -967,7 +973,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription"),
|
SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED(
|
||||||
|
void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Hook:</b>
|
* <b>Subscription Hook:</b>
|
||||||
|
@ -1028,8 +1035,7 @@ public enum Pointcut implements IPointcut {
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.jpa.api.model.DeleteConflictList",
|
"ca.uhn.fhir.jpa.api.model.DeleteConflictList",
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource"
|
"org.hl7.fhir.instance.model.api.IBaseResource"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Topic Hook:</b>
|
* <b>Subscription Topic Hook:</b>
|
||||||
|
@ -1048,8 +1054,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* returns <code>false</code>, processing will be aborted.
|
* returns <code>false</code>, processing will be aborted.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_TOPIC_BEFORE_PERSISTED_RESOURCE_CHECKED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
SUBSCRIPTION_TOPIC_BEFORE_PERSISTED_RESOURCE_CHECKED(
|
||||||
|
boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Subscription Topic Hook:</b>
|
* <b>Subscription Topic Hook:</b>
|
||||||
|
@ -1066,8 +1072,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
SUBSCRIPTION_TOPIC_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
SUBSCRIPTION_TOPIC_AFTER_PERSISTED_RESOURCE_CHECKED(
|
||||||
|
void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1103,8 +1109,7 @@ public enum Pointcut implements IPointcut {
|
||||||
void.class,
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions",
|
"ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
* Invoked when a set of resources are about to be deleted and expunged via url like http://localhost/Patient?active=false&_expunge=true
|
* Invoked when a set of resources are about to be deleted and expunged via url like http://localhost/Patient?active=false&_expunge=true
|
||||||
|
@ -1135,13 +1140,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* which case the delete expunge will not occur.
|
* which case the delete expunge will not occur.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
STORAGE_PRE_DELETE_EXPUNGE(
|
STORAGE_PRE_DELETE_EXPUNGE(
|
||||||
void.class,
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"java.lang.String"
|
"java.lang.String"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1184,15 +1187,13 @@ public enum Pointcut implements IPointcut {
|
||||||
* which case the delete expunge will not occur.
|
* which case the delete expunge will not occur.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
STORAGE_PRE_DELETE_EXPUNGE_PID_LIST(
|
STORAGE_PRE_DELETE_EXPUNGE_PID_LIST(
|
||||||
void.class,
|
void.class,
|
||||||
"java.lang.String",
|
"java.lang.String",
|
||||||
"java.util.List",
|
"java.util.List",
|
||||||
"java.util.concurrent.atomic.AtomicLong",
|
"java.util.concurrent.atomic.AtomicLong",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1235,11 +1236,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_PREACCESS_RESOURCES(void.class,
|
STORAGE_PREACCESS_RESOURCES(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails",
|
"ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1273,11 +1274,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* search no matter what.
|
* search no matter what.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_PRECHECK_FOR_CACHED_SEARCH(boolean.class,
|
STORAGE_PRECHECK_FOR_CACHED_SEARCH(
|
||||||
|
boolean.class,
|
||||||
"ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
|
"ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1316,13 +1317,13 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_PRESEARCH_REGISTERED(void.class,
|
STORAGE_PRESEARCH_REGISTERED(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.server.util.ICachedSearchDetails",
|
"ca.uhn.fhir.rest.server.util.ICachedSearchDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
|
"ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
|
||||||
"ca.uhn.fhir.interceptor.model.RequestPartitionId"
|
"ca.uhn.fhir.interceptor.model.RequestPartitionId"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1367,11 +1368,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_PRESHOW_RESOURCES(void.class,
|
STORAGE_PRESHOW_RESOURCES(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.IPreResourceShowDetails",
|
"ca.uhn.fhir.rest.api.server.IPreResourceShowDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1406,13 +1407,13 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_PRESTORAGE_RESOURCE_CREATED(void.class,
|
STORAGE_PRESTORAGE_RESOURCE_CREATED(
|
||||||
|
void.class,
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
|
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
|
||||||
"ca.uhn.fhir.interceptor.model.RequestPartitionId"
|
"ca.uhn.fhir.interceptor.model.RequestPartitionId"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1437,10 +1438,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_PRESTORAGE_CLIENT_ASSIGNED_ID(void.class,
|
STORAGE_PRESTORAGE_CLIENT_ASSIGNED_ID(
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
void.class, "org.hl7.fhir.instance.model.api.IBaseResource", "ca.uhn.fhir.rest.api.server.RequestDetails"),
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails"
|
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1477,13 +1476,13 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_PRESTORAGE_RESOURCE_UPDATED(void.class,
|
STORAGE_PRESTORAGE_RESOURCE_UPDATED(
|
||||||
|
void.class,
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
|
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1518,13 +1517,12 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_PRESTORAGE_RESOURCE_DELETED(void.class,
|
STORAGE_PRESTORAGE_RESOURCE_DELETED(
|
||||||
|
void.class,
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
|
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1567,13 +1565,13 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_PRECOMMIT_RESOURCE_CREATED(void.class,
|
STORAGE_PRECOMMIT_RESOURCE_CREATED(
|
||||||
|
void.class,
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
|
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
|
||||||
"ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"
|
"ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1614,15 +1612,14 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_PRECOMMIT_RESOURCE_UPDATED(void.class,
|
STORAGE_PRECOMMIT_RESOURCE_UPDATED(
|
||||||
|
void.class,
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
|
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
|
||||||
"ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"
|
"ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1658,13 +1655,13 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_PRECOMMIT_RESOURCE_DELETED(void.class,
|
STORAGE_PRECOMMIT_RESOURCE_DELETED(
|
||||||
|
void.class,
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
|
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
|
||||||
"ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"
|
"ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1696,11 +1693,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* @see #STORAGE_TRANSACTION_PROCESSED
|
* @see #STORAGE_TRANSACTION_PROCESSED
|
||||||
* @since 6.2.0
|
* @since 6.2.0
|
||||||
*/
|
*/
|
||||||
STORAGE_TRANSACTION_PROCESSING(void.class,
|
STORAGE_TRANSACTION_PROCESSING(
|
||||||
|
void.class,
|
||||||
"org.hl7.fhir.instance.model.api.IBaseBundle",
|
"org.hl7.fhir.instance.model.api.IBaseBundle",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1736,14 +1733,13 @@ public enum Pointcut implements IPointcut {
|
||||||
*
|
*
|
||||||
* @see #STORAGE_TRANSACTION_PROCESSING
|
* @see #STORAGE_TRANSACTION_PROCESSING
|
||||||
*/
|
*/
|
||||||
STORAGE_TRANSACTION_PROCESSED(void.class,
|
STORAGE_TRANSACTION_PROCESSED(
|
||||||
|
void.class,
|
||||||
"org.hl7.fhir.instance.model.api.IBaseBundle",
|
"org.hl7.fhir.instance.model.api.IBaseBundle",
|
||||||
"ca.uhn.fhir.rest.api.server.storage.DeferredInterceptorBroadcasts",
|
"ca.uhn.fhir.rest.api.server.storage.DeferredInterceptorBroadcasts",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
|
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1764,10 +1760,10 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_TRANSACTION_WRITE_OPERATIONS_PRE(void.class,
|
STORAGE_TRANSACTION_WRITE_OPERATIONS_PRE(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails",
|
"ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
|
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1790,10 +1786,10 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_TRANSACTION_WRITE_OPERATIONS_POST(void.class,
|
STORAGE_TRANSACTION_WRITE_OPERATIONS_POST(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails",
|
"ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
|
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1834,8 +1830,7 @@ public enum Pointcut implements IPointcut {
|
||||||
"ca.uhn.fhir.jpa.api.model.DeleteConflictList",
|
"ca.uhn.fhir.jpa.api.model.DeleteConflictList",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
|
"ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1877,8 +1872,7 @@ public enum Pointcut implements IPointcut {
|
||||||
"org.hl7.fhir.instance.model.api.IIdType",
|
"org.hl7.fhir.instance.model.api.IIdType",
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1914,8 +1908,7 @@ public enum Pointcut implements IPointcut {
|
||||||
// Params
|
// Params
|
||||||
"java.util.concurrent.atomic.AtomicInteger",
|
"java.util.concurrent.atomic.AtomicInteger",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -1955,8 +1948,7 @@ public enum Pointcut implements IPointcut {
|
||||||
// Params
|
// Params
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -2000,8 +1992,7 @@ public enum Pointcut implements IPointcut {
|
||||||
// Params
|
// Params
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails"
|
"ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -2046,8 +2037,7 @@ public enum Pointcut implements IPointcut {
|
||||||
"ca.uhn.fhir.interceptor.model.RequestPartitionId",
|
"ca.uhn.fhir.interceptor.model.RequestPartitionId",
|
||||||
// Params
|
// Params
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -2088,9 +2078,7 @@ public enum Pointcut implements IPointcut {
|
||||||
// Params
|
// Params
|
||||||
"ca.uhn.fhir.interceptor.model.RequestPartitionId",
|
"ca.uhn.fhir.interceptor.model.RequestPartitionId",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -2136,8 +2124,7 @@ public enum Pointcut implements IPointcut {
|
||||||
"ca.uhn.fhir.interceptor.model.RequestPartitionId",
|
"ca.uhn.fhir.interceptor.model.RequestPartitionId",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.context.RuntimeResourceDefinition"
|
"ca.uhn.fhir.context.RuntimeResourceDefinition"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
|
@ -2172,8 +2159,7 @@ public enum Pointcut implements IPointcut {
|
||||||
STORAGE_VERSION_CONFLICT(
|
STORAGE_VERSION_CONFLICT(
|
||||||
"ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy",
|
"ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Validation Hook:</b>
|
* <b>Validation Hook:</b>
|
||||||
|
@ -2199,11 +2185,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* </p>
|
* </p>
|
||||||
* Hook methods may return an instance of {@link ca.uhn.fhir.validation.ValidationResult} if they wish to override the validation results, or they may return <code>null</code> or <code>void</code> otherwise.
|
* Hook methods may return an instance of {@link ca.uhn.fhir.validation.ValidationResult} if they wish to override the validation results, or they may return <code>null</code> or <code>void</code> otherwise.
|
||||||
*/
|
*/
|
||||||
VALIDATION_COMPLETED(ValidationResult.class,
|
VALIDATION_COMPLETED(
|
||||||
|
ValidationResult.class,
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource",
|
"org.hl7.fhir.instance.model.api.IBaseResource",
|
||||||
"java.lang.String",
|
"java.lang.String",
|
||||||
"ca.uhn.fhir.validation.ValidationResult"
|
"ca.uhn.fhir.validation.ValidationResult"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>MDM(EMPI) Hook:</b>
|
* <b>MDM(EMPI) Hook:</b>
|
||||||
|
@ -2220,8 +2206,7 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
MDM_BEFORE_PERSISTED_RESOURCE_CHECKED(void.class,
|
MDM_BEFORE_PERSISTED_RESOURCE_CHECKED(void.class, "org.hl7.fhir.instance.model.api.IBaseResource"),
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource"),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>MDM(EMPI) Hook:</b>
|
* <b>MDM(EMPI) Hook:</b>
|
||||||
|
@ -2239,12 +2224,12 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
MDM_AFTER_PERSISTED_RESOURCE_CHECKED(void.class,
|
MDM_AFTER_PERSISTED_RESOURCE_CHECKED(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage",
|
"ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage",
|
||||||
"ca.uhn.fhir.rest.server.TransactionLogMessages",
|
"ca.uhn.fhir.rest.server.TransactionLogMessages",
|
||||||
"ca.uhn.fhir.mdm.api.MdmLinkEvent"),
|
"ca.uhn.fhir.mdm.api.MdmLinkEvent"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>JPA Hook:</b>
|
* <b>JPA Hook:</b>
|
||||||
* This hook is invoked when a cross-partition reference is about to be
|
* This hook is invoked when a cross-partition reference is about to be
|
||||||
|
@ -2265,7 +2250,8 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_RESOLVE_CROSS_PARTITION_REFERENCE("ca.uhn.fhir.jpa.model.cross.IResourceLookup",
|
JPA_RESOLVE_CROSS_PARTITION_REFERENCE(
|
||||||
|
"ca.uhn.fhir.jpa.model.cross.IResourceLookup",
|
||||||
"ca.uhn.fhir.jpa.searchparam.extractor.CrossPartitionReferenceDetails"),
|
"ca.uhn.fhir.jpa.searchparam.extractor.CrossPartitionReferenceDetails"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2300,11 +2286,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_PERFTRACE_INFO(void.class,
|
JPA_PERFTRACE_INFO(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"
|
"ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Performance Tracing Hook:</b>
|
* <b>Performance Tracing Hook:</b>
|
||||||
|
@ -2338,11 +2324,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_PERFTRACE_WARNING(void.class,
|
JPA_PERFTRACE_WARNING(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"
|
"ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Performance Tracing Hook:</b>
|
* <b>Performance Tracing Hook:</b>
|
||||||
|
@ -2377,11 +2363,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_PERFTRACE_SEARCH_FIRST_RESULT_LOADED(void.class,
|
JPA_PERFTRACE_SEARCH_FIRST_RESULT_LOADED(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
|
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Performance Tracing Hook:</b>
|
* <b>Performance Tracing Hook:</b>
|
||||||
|
@ -2418,12 +2404,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_PERFTRACE_SEARCH_SELECT_COMPLETE(void.class,
|
JPA_PERFTRACE_SEARCH_SELECT_COMPLETE(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
|
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Performance Tracing Hook:</b>
|
* <b>Performance Tracing Hook:</b>
|
||||||
|
@ -2457,11 +2442,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_PERFTRACE_SEARCH_FAILED(void.class,
|
JPA_PERFTRACE_SEARCH_FAILED(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
|
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Performance Tracing Hook:</b>
|
* <b>Performance Tracing Hook:</b>
|
||||||
|
@ -2497,11 +2482,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_PERFTRACE_SEARCH_PASS_COMPLETE(void.class,
|
JPA_PERFTRACE_SEARCH_PASS_COMPLETE(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
|
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Performance Tracing Hook:</b>
|
* <b>Performance Tracing Hook:</b>
|
||||||
|
@ -2535,11 +2520,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_PERFTRACE_INDEXSEARCH_QUERY_COMPLETE(void.class,
|
JPA_PERFTRACE_INDEXSEARCH_QUERY_COMPLETE(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
|
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Performance Tracing Hook:</b>
|
* <b>Performance Tracing Hook:</b>
|
||||||
|
@ -2575,11 +2560,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_PERFTRACE_SEARCH_REUSING_CACHED(boolean.class,
|
JPA_PERFTRACE_SEARCH_REUSING_CACHED(
|
||||||
|
boolean.class,
|
||||||
"ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
|
"ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Performance Tracing Hook:</b>
|
* <b>Performance Tracing Hook:</b>
|
||||||
|
@ -2614,12 +2599,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_PERFTRACE_SEARCH_COMPLETE(void.class,
|
JPA_PERFTRACE_SEARCH_COMPLETE(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
|
"ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Performance Tracing Hook:</b>
|
* <b>Performance Tracing Hook:</b>
|
||||||
|
@ -2648,11 +2632,7 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_PERFTRACE_SEARCH_FOUND_ID(void.class,
|
JPA_PERFTRACE_SEARCH_FOUND_ID(void.class, "java.lang.Integer", "java.lang.Object"),
|
||||||
"java.lang.Integer",
|
|
||||||
"java.lang.Object"
|
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Performance Tracing Hook:</b>
|
* <b>Performance Tracing Hook:</b>
|
||||||
|
@ -2687,11 +2667,11 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>void</code>.
|
* Hooks should return <code>void</code>.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
JPA_PERFTRACE_RAW_SQL(void.class,
|
JPA_PERFTRACE_RAW_SQL(
|
||||||
|
void.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
|
||||||
"ca.uhn.fhir.jpa.util.SqlQueryList"
|
"ca.uhn.fhir.jpa.util.SqlQueryList"),
|
||||||
),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b> Binary Blob Prefix Assigning Hook:</b>
|
* <b> Binary Blob Prefix Assigning Hook:</b>
|
||||||
|
@ -2714,11 +2694,10 @@ public enum Pointcut implements IPointcut {
|
||||||
* Hooks should return <code>String</code>, which represents the full prefix to be applied to the blob.
|
* Hooks should return <code>String</code>, which represents the full prefix to be applied to the blob.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
STORAGE_BINARY_ASSIGN_BLOB_ID_PREFIX(String.class,
|
STORAGE_BINARY_ASSIGN_BLOB_ID_PREFIX(
|
||||||
|
String.class,
|
||||||
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
"ca.uhn.fhir.rest.api.server.RequestDetails",
|
||||||
"org.hl7.fhir.instance.model.api.IBaseResource"
|
"org.hl7.fhir.instance.model.api.IBaseResource"),
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This pointcut is used only for unit tests. Do not use in production code as it may be changed or
|
* This pointcut is used only for unit tests. Do not use in production code as it may be changed or
|
||||||
|
@ -2744,7 +2723,10 @@ public enum Pointcut implements IPointcut {
|
||||||
this(toReturnTypeClass(theReturnType), new ExceptionHandlingSpec(), theParameterTypes);
|
this(toReturnTypeClass(theReturnType), new ExceptionHandlingSpec(), theParameterTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointcut(@Nonnull Class<?> theReturnType, @Nonnull ExceptionHandlingSpec theExceptionHandlingSpec, String... theParameterTypes) {
|
Pointcut(
|
||||||
|
@Nonnull Class<?> theReturnType,
|
||||||
|
@Nonnull ExceptionHandlingSpec theExceptionHandlingSpec,
|
||||||
|
String... theParameterTypes) {
|
||||||
myReturnType = theReturnType;
|
myReturnType = theReturnType;
|
||||||
myExceptionHandlingSpec = theExceptionHandlingSpec;
|
myExceptionHandlingSpec = theExceptionHandlingSpec;
|
||||||
myParameterTypes = Collections.unmodifiableList(Arrays.asList(theParameterTypes));
|
myParameterTypes = Collections.unmodifiableList(Arrays.asList(theParameterTypes));
|
||||||
|
@ -2776,8 +2758,7 @@ public enum Pointcut implements IPointcut {
|
||||||
return myParameterTypes;
|
return myParameterTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class UnknownType {
|
private static class UnknownType {}
|
||||||
}
|
|
||||||
|
|
||||||
private static class ExceptionHandlingSpec {
|
private static class ExceptionHandlingSpec {
|
||||||
|
|
||||||
|
@ -2787,7 +2768,6 @@ public enum Pointcut implements IPointcut {
|
||||||
myTypesToLogAndSwallow.add(theType);
|
myTypesToLogAndSwallow.add(theType);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Class<?> toReturnTypeClass(String theReturnType) {
|
private static Class<?> toReturnTypeClass(String theReturnType) {
|
||||||
|
@ -2797,5 +2777,4 @@ public enum Pointcut implements IPointcut {
|
||||||
return UnknownType.class;
|
return UnknownType.class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,6 @@ import org.apache.commons.lang3.reflect.MethodUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.AnnotatedElement;
|
import java.lang.reflect.AnnotatedElement;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
@ -59,8 +57,11 @@ import java.util.Optional;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & IPointcut> implements IBaseInterceptorService<POINTCUT>, IBaseInterceptorBroadcaster<POINTCUT> {
|
public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & IPointcut>
|
||||||
|
implements IBaseInterceptorService<POINTCUT>, IBaseInterceptorBroadcaster<POINTCUT> {
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(BaseInterceptorService.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(BaseInterceptorService.class);
|
||||||
private final List<Object> myInterceptors = new ArrayList<>();
|
private final List<Object> myInterceptors = new ArrayList<>();
|
||||||
private final ListMultimap<POINTCUT, BaseInvoker> myGlobalInvokers = ArrayListMultimap.create();
|
private final ListMultimap<POINTCUT, BaseInvoker> myGlobalInvokers = ArrayListMultimap.create();
|
||||||
|
@ -110,7 +111,6 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
Validate.notNull(thePointcut);
|
Validate.notNull(thePointcut);
|
||||||
Validate.notNull(theInterceptor);
|
Validate.notNull(theInterceptor);
|
||||||
synchronized (myRegistryMutex) {
|
synchronized (myRegistryMutex) {
|
||||||
|
|
||||||
myAnonymousInvokers.put(thePointcut, theInvoker);
|
myAnonymousInvokers.put(thePointcut, theInvoker);
|
||||||
if (!isInterceptorAlreadyRegistered(theInterceptor)) {
|
if (!isInterceptorAlreadyRegistered(theInterceptor)) {
|
||||||
myInterceptors.add(theInterceptor);
|
myInterceptors.add(theInterceptor);
|
||||||
|
@ -168,7 +168,8 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
unregisterInterceptorsIf(theShouldUnregisterFunction, myAnonymousInvokers);
|
unregisterInterceptorsIf(theShouldUnregisterFunction, myAnonymousInvokers);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unregisterInterceptorsIf(Predicate<Object> theShouldUnregisterFunction, ListMultimap<POINTCUT, BaseInvoker> theGlobalInvokers) {
|
private void unregisterInterceptorsIf(
|
||||||
|
Predicate<Object> theShouldUnregisterFunction, ListMultimap<POINTCUT, BaseInvoker> theGlobalInvokers) {
|
||||||
synchronized (myRegistryMutex) {
|
synchronized (myRegistryMutex) {
|
||||||
for (Map.Entry<POINTCUT, BaseInvoker> nextInvoker : new ArrayList<>(theGlobalInvokers.entries())) {
|
for (Map.Entry<POINTCUT, BaseInvoker> nextInvoker : new ArrayList<>(theGlobalInvokers.entries())) {
|
||||||
if (theShouldUnregisterFunction.test(nextInvoker.getValue().getInterceptor())) {
|
if (theShouldUnregisterFunction.test(nextInvoker.getValue().getInterceptor())) {
|
||||||
|
@ -183,7 +184,6 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
@Override
|
@Override
|
||||||
public boolean registerInterceptor(Object theInterceptor) {
|
public boolean registerInterceptor(Object theInterceptor) {
|
||||||
synchronized (myRegistryMutex) {
|
synchronized (myRegistryMutex) {
|
||||||
|
|
||||||
if (isInterceptorAlreadyRegistered(theInterceptor)) {
|
if (isInterceptorAlreadyRegistered(theInterceptor)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,9 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
List<HookInvoker> addedInvokers = scanInterceptorAndAddToInvokerMultimap(theInterceptor, myGlobalInvokers);
|
List<HookInvoker> addedInvokers = scanInterceptorAndAddToInvokerMultimap(theInterceptor, myGlobalInvokers);
|
||||||
if (addedInvokers.isEmpty()) {
|
if (addedInvokers.isEmpty()) {
|
||||||
if (myWarnOnInterceptorWithNoHooks) {
|
if (myWarnOnInterceptorWithNoHooks) {
|
||||||
ourLog.warn("Interceptor registered with no valid hooks - Type was: {}", theInterceptor.getClass().getName());
|
ourLog.warn(
|
||||||
|
"Interceptor registered with no valid hooks - Type was: {}",
|
||||||
|
theInterceptor.getClass().getName());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -300,8 +302,7 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
List<Object> getInterceptorsWithInvokersForPointcut(POINTCUT thePointcut) {
|
List<Object> getInterceptorsWithInvokersForPointcut(POINTCUT thePointcut) {
|
||||||
return getInvokersForPointcut(thePointcut)
|
return getInvokersForPointcut(thePointcut).stream()
|
||||||
.stream()
|
|
||||||
.map(BaseInvoker::getInterceptor)
|
.map(BaseInvoker::getInterceptor)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
@ -361,13 +362,11 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
retVal = Arrays
|
retVal = Arrays.stream(theInvokersLists)
|
||||||
.stream(theInvokersLists)
|
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.flatMap(Collection::stream)
|
.flatMap(Collection::stream)
|
||||||
.sorted()
|
.sorted()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
@ -377,8 +376,17 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
* Only call this when assertions are enabled, it's expensive
|
* Only call this when assertions are enabled, it's expensive
|
||||||
*/
|
*/
|
||||||
final boolean haveAppropriateParams(POINTCUT thePointcut, HookParams theParams) {
|
final boolean haveAppropriateParams(POINTCUT thePointcut, HookParams theParams) {
|
||||||
if (theParams.getParamsForType().values().size() != thePointcut.getParameterTypes().size()) {
|
if (theParams.getParamsForType().values().size()
|
||||||
throw new IllegalArgumentException(Msg.code(1909) + String.format("Wrong number of params for pointcut %s - Wanted %s but found %s", thePointcut.name(), toErrorString(thePointcut.getParameterTypes()), theParams.getParamsForType().values().stream().map(t -> t != null ? t.getClass().getSimpleName() : "null").sorted().collect(Collectors.toList())));
|
!= thePointcut.getParameterTypes().size()) {
|
||||||
|
throw new IllegalArgumentException(Msg.code(1909)
|
||||||
|
+ String.format(
|
||||||
|
"Wrong number of params for pointcut %s - Wanted %s but found %s",
|
||||||
|
thePointcut.name(),
|
||||||
|
toErrorString(thePointcut.getParameterTypes()),
|
||||||
|
theParams.getParamsForType().values().stream()
|
||||||
|
.map(t -> t != null ? t.getClass().getSimpleName() : "null")
|
||||||
|
.sorted()
|
||||||
|
.collect(Collectors.toList())));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> wantedTypes = new ArrayList<>(thePointcut.getParameterTypes());
|
List<String> wantedTypes = new ArrayList<>(thePointcut.getParameterTypes());
|
||||||
|
@ -387,15 +395,26 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
for (Class<?> nextTypeClass : givenTypes.keySet()) {
|
for (Class<?> nextTypeClass : givenTypes.keySet()) {
|
||||||
String nextTypeName = nextTypeClass.getName();
|
String nextTypeName = nextTypeClass.getName();
|
||||||
for (Object nextParamValue : givenTypes.get(nextTypeClass)) {
|
for (Object nextParamValue : givenTypes.get(nextTypeClass)) {
|
||||||
Validate.isTrue(nextParamValue == null || nextTypeClass.isAssignableFrom(nextParamValue.getClass()), "Invalid params for pointcut %s - %s is not of type %s", thePointcut.name(), nextParamValue != null ? nextParamValue.getClass() : "null", nextTypeClass);
|
Validate.isTrue(
|
||||||
Validate.isTrue(wantedTypes.remove(nextTypeName), "Invalid params for pointcut %s - Wanted %s but found %s", thePointcut.name(), toErrorString(thePointcut.getParameterTypes()), nextTypeName);
|
nextParamValue == null || nextTypeClass.isAssignableFrom(nextParamValue.getClass()),
|
||||||
|
"Invalid params for pointcut %s - %s is not of type %s",
|
||||||
|
thePointcut.name(),
|
||||||
|
nextParamValue != null ? nextParamValue.getClass() : "null",
|
||||||
|
nextTypeClass);
|
||||||
|
Validate.isTrue(
|
||||||
|
wantedTypes.remove(nextTypeName),
|
||||||
|
"Invalid params for pointcut %s - Wanted %s but found %s",
|
||||||
|
thePointcut.name(),
|
||||||
|
toErrorString(thePointcut.getParameterTypes()),
|
||||||
|
nextTypeName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<HookInvoker> scanInterceptorAndAddToInvokerMultimap(Object theInterceptor, ListMultimap<POINTCUT, BaseInvoker> theInvokers) {
|
private List<HookInvoker> scanInterceptorAndAddToInvokerMultimap(
|
||||||
|
Object theInterceptor, ListMultimap<POINTCUT, BaseInvoker> theInvokers) {
|
||||||
Class<?> interceptorClass = theInterceptor.getClass();
|
Class<?> interceptorClass = theInterceptor.getClass();
|
||||||
int typeOrder = determineOrder(interceptorClass);
|
int typeOrder = determineOrder(interceptorClass);
|
||||||
|
|
||||||
|
@ -458,7 +477,8 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
private HookInvoker(HookDescriptor theHook, @Nonnull Object theInterceptor, @Nonnull Method theHookMethod, int theOrder) {
|
private HookInvoker(
|
||||||
|
HookDescriptor theHook, @Nonnull Object theInterceptor, @Nonnull Method theHookMethod, int theOrder) {
|
||||||
super(theInterceptor, theOrder);
|
super(theInterceptor, theOrder);
|
||||||
myPointcut = theHook.getPointcut();
|
myPointcut = theHook.getPointcut();
|
||||||
myParameterTypes = theHookMethod.getParameterTypes();
|
myParameterTypes = theHookMethod.getParameterTypes();
|
||||||
|
@ -466,11 +486,18 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
|
|
||||||
Class<?> returnType = theHookMethod.getReturnType();
|
Class<?> returnType = theHookMethod.getReturnType();
|
||||||
if (myPointcut.getReturnType().equals(boolean.class)) {
|
if (myPointcut.getReturnType().equals(boolean.class)) {
|
||||||
Validate.isTrue(boolean.class.equals(returnType) || void.class.equals(returnType), "Method does not return boolean or void: %s", theHookMethod);
|
Validate.isTrue(
|
||||||
|
boolean.class.equals(returnType) || void.class.equals(returnType),
|
||||||
|
"Method does not return boolean or void: %s",
|
||||||
|
theHookMethod);
|
||||||
} else if (myPointcut.getReturnType().equals(void.class)) {
|
} else if (myPointcut.getReturnType().equals(void.class)) {
|
||||||
Validate.isTrue(void.class.equals(returnType), "Method does not return void: %s", theHookMethod);
|
Validate.isTrue(void.class.equals(returnType), "Method does not return void: %s", theHookMethod);
|
||||||
} else {
|
} else {
|
||||||
Validate.isTrue(myPointcut.getReturnType().isAssignableFrom(returnType) || void.class.equals(returnType), "Method does not return %s or void: %s", myPointcut.getReturnType(), theHookMethod);
|
Validate.isTrue(
|
||||||
|
myPointcut.getReturnType().isAssignableFrom(returnType) || void.class.equals(returnType),
|
||||||
|
"Method does not return %s or void: %s",
|
||||||
|
myPointcut.getReturnType(),
|
||||||
|
theHookMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
myParameterIndexes = new int[myParameterTypes.length];
|
myParameterIndexes = new int[myParameterTypes.length];
|
||||||
|
@ -525,14 +552,14 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
if (targetException instanceof RuntimeException) {
|
if (targetException instanceof RuntimeException) {
|
||||||
throw ((RuntimeException) targetException);
|
throw ((RuntimeException) targetException);
|
||||||
} else {
|
} else {
|
||||||
throw new InternalErrorException(Msg.code(1910) + "Failure invoking interceptor for pointcut(s) " + getPointcut(), targetException);
|
throw new InternalErrorException(
|
||||||
|
Msg.code(1910) + "Failure invoking interceptor for pointcut(s) " + getPointcut(),
|
||||||
|
targetException);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new InternalErrorException(Msg.code(1911) + e);
|
throw new InternalErrorException(Msg.code(1911) + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class HookDescriptor {
|
protected class HookDescriptor {
|
||||||
|
@ -552,7 +579,6 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
int getOrder() {
|
int getOrder() {
|
||||||
return myOrder;
|
return myOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract static class BaseInvoker implements Comparable<BaseInvoker> {
|
protected abstract static class BaseInvoker implements Comparable<BaseInvoker> {
|
||||||
|
@ -577,7 +603,8 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static <T extends Annotation> Optional<T> findAnnotation(AnnotatedElement theObject, Class<T> theHookClass) {
|
protected static <T extends Annotation> Optional<T> findAnnotation(
|
||||||
|
AnnotatedElement theObject, Class<T> theHookClass) {
|
||||||
T annotation;
|
T annotation;
|
||||||
if (theObject instanceof Method) {
|
if (theObject instanceof Method) {
|
||||||
annotation = MethodUtils.getAnnotation((Method) theObject, theHookClass, true, true);
|
annotation = MethodUtils.getAnnotation((Method) theObject, theHookClass, true, true);
|
||||||
|
@ -594,10 +621,6 @@ public abstract class BaseInterceptorService<POINTCUT extends Enum<POINTCUT> & I
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String toErrorString(List<String> theParameterTypes) {
|
private static String toErrorString(List<String> theParameterTypes) {
|
||||||
return theParameterTypes
|
return theParameterTypes.stream().sorted().collect(Collectors.joining(","));
|
||||||
.stream()
|
|
||||||
.sorted()
|
|
||||||
.collect(Collectors.joining(","));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,8 @@ import org.apache.commons.lang3.Validate;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class InterceptorService extends BaseInterceptorService<Pointcut> implements IInterceptorService, IInterceptorBroadcaster {
|
public class InterceptorService extends BaseInterceptorService<Pointcut>
|
||||||
|
implements IInterceptorService, IInterceptorBroadcaster {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor which uses a default name of "default"
|
* Constructor which uses a default name of "default"
|
||||||
|
@ -55,7 +56,6 @@ public class InterceptorService extends BaseInterceptorService<Pointcut> impleme
|
||||||
return findAnnotation(nextMethod, Hook.class).map(t -> new HookDescriptor(t.value(), t.order()));
|
return findAnnotation(nextMethod, Hook.class).map(t -> new HookDescriptor(t.value(), t.order()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void registerAnonymousInterceptor(Pointcut thePointcut, IAnonymousInterceptor theInterceptor) {
|
public void registerAnonymousInterceptor(Pointcut thePointcut, IAnonymousInterceptor theInterceptor) {
|
||||||
|
@ -70,7 +70,6 @@ public class InterceptorService extends BaseInterceptorService<Pointcut> impleme
|
||||||
registerAnonymousInterceptor(thePointcut, theInterceptor, invoker);
|
registerAnonymousInterceptor(thePointcut, theInterceptor, invoker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class AnonymousLambdaInvoker extends BaseInvoker {
|
private static class AnonymousLambdaInvoker extends BaseInvoker {
|
||||||
private final IAnonymousInterceptor myHook;
|
private final IAnonymousInterceptor myHook;
|
||||||
private final Pointcut myPointcut;
|
private final Pointcut myPointcut;
|
||||||
|
@ -87,6 +86,4 @@ public class InterceptorService extends BaseInterceptorService<Pointcut> impleme
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,6 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -39,6 +37,8 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
||||||
|
|
||||||
|
@ -47,20 +47,26 @@ import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
||||||
*/
|
*/
|
||||||
public class RequestPartitionId implements IModelJson {
|
public class RequestPartitionId implements IModelJson {
|
||||||
private static final RequestPartitionId ALL_PARTITIONS = new RequestPartitionId();
|
private static final RequestPartitionId ALL_PARTITIONS = new RequestPartitionId();
|
||||||
private static final ObjectMapper ourObjectMapper = new ObjectMapper().registerModule(new com.fasterxml.jackson.datatype.jsr310.JavaTimeModule());
|
private static final ObjectMapper ourObjectMapper =
|
||||||
|
new ObjectMapper().registerModule(new com.fasterxml.jackson.datatype.jsr310.JavaTimeModule());
|
||||||
|
|
||||||
@JsonProperty("partitionDate")
|
@JsonProperty("partitionDate")
|
||||||
private final LocalDate myPartitionDate;
|
private final LocalDate myPartitionDate;
|
||||||
|
|
||||||
@JsonProperty("allPartitions")
|
@JsonProperty("allPartitions")
|
||||||
private final boolean myAllPartitions;
|
private final boolean myAllPartitions;
|
||||||
|
|
||||||
@JsonProperty("partitionIds")
|
@JsonProperty("partitionIds")
|
||||||
private final List<Integer> myPartitionIds;
|
private final List<Integer> myPartitionIds;
|
||||||
|
|
||||||
@JsonProperty("partitionNames")
|
@JsonProperty("partitionNames")
|
||||||
private final List<String> myPartitionNames;
|
private final List<String> myPartitionNames;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a single partition
|
* Constructor for a single partition
|
||||||
*/
|
*/
|
||||||
private RequestPartitionId(@Nullable String thePartitionName, @Nullable Integer thePartitionId, @Nullable LocalDate thePartitionDate) {
|
private RequestPartitionId(
|
||||||
|
@Nullable String thePartitionName, @Nullable Integer thePartitionId, @Nullable LocalDate thePartitionDate) {
|
||||||
myPartitionIds = toListOrNull(thePartitionId);
|
myPartitionIds = toListOrNull(thePartitionId);
|
||||||
myPartitionNames = toListOrNull(thePartitionName);
|
myPartitionNames = toListOrNull(thePartitionName);
|
||||||
myPartitionDate = thePartitionDate;
|
myPartitionDate = thePartitionDate;
|
||||||
|
@ -70,7 +76,10 @@ public class RequestPartitionId implements IModelJson {
|
||||||
/**
|
/**
|
||||||
* Constructor for a multiple partition
|
* Constructor for a multiple partition
|
||||||
*/
|
*/
|
||||||
private RequestPartitionId(@Nullable List<String> thePartitionName, @Nullable List<Integer> thePartitionId, @Nullable LocalDate thePartitionDate) {
|
private RequestPartitionId(
|
||||||
|
@Nullable List<String> thePartitionName,
|
||||||
|
@Nullable List<Integer> thePartitionId,
|
||||||
|
@Nullable LocalDate thePartitionDate) {
|
||||||
myPartitionIds = toListOrNull(thePartitionId);
|
myPartitionIds = toListOrNull(thePartitionId);
|
||||||
myPartitionNames = toListOrNull(thePartitionName);
|
myPartitionNames = toListOrNull(thePartitionName);
|
||||||
myPartitionDate = thePartitionDate;
|
myPartitionDate = thePartitionDate;
|
||||||
|
@ -180,7 +189,9 @@ public class RequestPartitionId implements IModelJson {
|
||||||
if (isAllPartitions()) {
|
if (isAllPartitions()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return hasPartitionIds() && getPartitionIds().size() == 1 && getPartitionIds().get(0) == null;
|
return hasPartitionIds()
|
||||||
|
&& getPartitionIds().size() == 1
|
||||||
|
&& getPartitionIds().get(0) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPartitionId(Integer thePartitionId) {
|
public boolean hasPartitionId(Integer thePartitionId) {
|
||||||
|
@ -253,7 +264,8 @@ public class RequestPartitionId implements IModelJson {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static RequestPartitionId fromPartitionId(@Nullable Integer thePartitionId, @Nullable LocalDate thePartitionDate) {
|
public static RequestPartitionId fromPartitionId(
|
||||||
|
@Nullable Integer thePartitionId, @Nullable LocalDate thePartitionDate) {
|
||||||
return new RequestPartitionId(null, Collections.singletonList(thePartitionId), thePartitionDate);
|
return new RequestPartitionId(null, Collections.singletonList(thePartitionId), thePartitionDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +275,8 @@ public class RequestPartitionId implements IModelJson {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static RequestPartitionId fromPartitionIds(@Nonnull Collection<Integer> thePartitionIds, @Nullable LocalDate thePartitionDate) {
|
public static RequestPartitionId fromPartitionIds(
|
||||||
|
@Nonnull Collection<Integer> thePartitionIds, @Nullable LocalDate thePartitionDate) {
|
||||||
return new RequestPartitionId(null, toListOrNull(thePartitionIds), thePartitionDate);
|
return new RequestPartitionId(null, toListOrNull(thePartitionIds), thePartitionDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +291,8 @@ public class RequestPartitionId implements IModelJson {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static RequestPartitionId fromPartitionName(@Nullable String thePartitionName, @Nullable LocalDate thePartitionDate) {
|
public static RequestPartitionId fromPartitionName(
|
||||||
|
@Nullable String thePartitionName, @Nullable LocalDate thePartitionDate) {
|
||||||
return new RequestPartitionId(thePartitionName, null, thePartitionDate);
|
return new RequestPartitionId(thePartitionName, null, thePartitionDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,17 +307,20 @@ public class RequestPartitionId implements IModelJson {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static RequestPartitionId fromPartitionIdAndName(@Nullable Integer thePartitionId, @Nullable String thePartitionName) {
|
public static RequestPartitionId fromPartitionIdAndName(
|
||||||
|
@Nullable Integer thePartitionId, @Nullable String thePartitionName) {
|
||||||
return new RequestPartitionId(thePartitionName, thePartitionId, null);
|
return new RequestPartitionId(thePartitionName, thePartitionId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static RequestPartitionId forPartitionIdAndName(@Nullable Integer thePartitionId, @Nullable String thePartitionName, @Nullable LocalDate thePartitionDate) {
|
public static RequestPartitionId forPartitionIdAndName(
|
||||||
|
@Nullable Integer thePartitionId, @Nullable String thePartitionName, @Nullable LocalDate thePartitionDate) {
|
||||||
return new RequestPartitionId(thePartitionName, thePartitionId, thePartitionDate);
|
return new RequestPartitionId(thePartitionName, thePartitionId, thePartitionDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static RequestPartitionId forPartitionIdsAndNames(List<String> thePartitionNames, List<Integer> thePartitionIds, LocalDate thePartitionDate) {
|
public static RequestPartitionId forPartitionIdsAndNames(
|
||||||
|
List<String> thePartitionNames, List<Integer> thePartitionIds, LocalDate thePartitionDate) {
|
||||||
return new RequestPartitionId(thePartitionNames, thePartitionIds, thePartitionDate);
|
return new RequestPartitionId(thePartitionNames, thePartitionIds, thePartitionDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,9 +333,7 @@ public class RequestPartitionId implements IModelJson {
|
||||||
String retVal = "(all)";
|
String retVal = "(all)";
|
||||||
if (!theRequestPartitionId.isAllPartitions()) {
|
if (!theRequestPartitionId.isAllPartitions()) {
|
||||||
assert theRequestPartitionId.hasPartitionIds();
|
assert theRequestPartitionId.hasPartitionIds();
|
||||||
retVal = theRequestPartitionId
|
retVal = theRequestPartitionId.getPartitionIds().stream()
|
||||||
.getPartitionIds()
|
|
||||||
.stream()
|
|
||||||
.map(t -> defaultIfNull(t, "null").toString())
|
.map(t -> defaultIfNull(t, "null").toString())
|
||||||
.collect(Collectors.joining(" "));
|
.collect(Collectors.joining(" "));
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,5 +44,4 @@ public class TransactionWriteOperationsDetails {
|
||||||
public void setUpdateRequestUrls(List<String> theUpdateRequestUrls) {
|
public void setUpdateRequestUrls(List<String> theUpdateRequestUrls) {
|
||||||
myUpdateRequestUrls = theUpdateRequestUrls;
|
myUpdateRequestUrls = theUpdateRequestUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,15 +33,35 @@ public abstract class BaseElement implements /*IElement, */ISupportsUndeclaredEx
|
||||||
private List<String> myFormatCommentsPre;
|
private List<String> myFormatCommentsPre;
|
||||||
private Map<String, Object> userData;
|
private Map<String, Object> userData;
|
||||||
|
|
||||||
@Child(name = "extension", type = {ExtensionDt.class}, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
|
@Child(
|
||||||
@Description(shortDefinition = "Additional Content defined by implementations", formalDefinition = "May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.")
|
name = "extension",
|
||||||
|
type = {ExtensionDt.class},
|
||||||
|
order = 0,
|
||||||
|
min = 0,
|
||||||
|
max = Child.MAX_UNLIMITED,
|
||||||
|
modifier = false,
|
||||||
|
summary = false)
|
||||||
|
@Description(
|
||||||
|
shortDefinition = "Additional Content defined by implementations",
|
||||||
|
formalDefinition =
|
||||||
|
"May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.")
|
||||||
private List<ExtensionDt> myUndeclaredExtensions;
|
private List<ExtensionDt> myUndeclaredExtensions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.
|
* May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.
|
||||||
*/
|
*/
|
||||||
@Child(name = "modifierExtension", type = {ExtensionDt.class}, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = true, summary = false)
|
@Child(
|
||||||
@Description(shortDefinition = "Extensions that cannot be ignored", formalDefinition = "May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.")
|
name = "modifierExtension",
|
||||||
|
type = {ExtensionDt.class},
|
||||||
|
order = 1,
|
||||||
|
min = 0,
|
||||||
|
max = Child.MAX_UNLIMITED,
|
||||||
|
modifier = true,
|
||||||
|
summary = false)
|
||||||
|
@Description(
|
||||||
|
shortDefinition = "Extensions that cannot be ignored",
|
||||||
|
formalDefinition =
|
||||||
|
"May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.")
|
||||||
private List<ExtensionDt> myUndeclaredModifierExtensions;
|
private List<ExtensionDt> myUndeclaredModifierExtensions;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -100,15 +120,13 @@ public abstract class BaseElement implements /*IElement, */ISupportsUndeclaredEx
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getFormatCommentsPost() {
|
public List<String> getFormatCommentsPost() {
|
||||||
if (myFormatCommentsPost == null)
|
if (myFormatCommentsPost == null) myFormatCommentsPost = new ArrayList<String>();
|
||||||
myFormatCommentsPost = new ArrayList<String>();
|
|
||||||
return myFormatCommentsPost;
|
return myFormatCommentsPost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getFormatCommentsPre() {
|
public List<String> getFormatCommentsPre() {
|
||||||
if (myFormatCommentsPre == null)
|
if (myFormatCommentsPre == null) myFormatCommentsPre = new ArrayList<String>();
|
||||||
myFormatCommentsPre = new ArrayList<String>();
|
|
||||||
return myFormatCommentsPre;
|
return myFormatCommentsPre;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,13 +160,13 @@ public abstract class BaseElement implements /*IElement, */ISupportsUndeclaredEx
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasFormatComment() {
|
public boolean hasFormatComment() {
|
||||||
return (myFormatCommentsPre != null && !myFormatCommentsPre.isEmpty()) || (myFormatCommentsPost != null && !myFormatCommentsPost.isEmpty());
|
return (myFormatCommentsPre != null && !myFormatCommentsPre.isEmpty())
|
||||||
|
|| (myFormatCommentsPost != null && !myFormatCommentsPost.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getUserData(String name) {
|
public Object getUserData(String name) {
|
||||||
if (userData == null)
|
if (userData == null) return null;
|
||||||
return null;
|
|
||||||
return userData.get(name);
|
return userData.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,5 +205,4 @@ public abstract class BaseElement implements /*IElement, */ISupportsUndeclaredEx
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,7 @@ public abstract class BaseIdentifiableElement extends BaseElement implements IId
|
||||||
private static class LockedId extends IdDt {
|
private static class LockedId extends IdDt {
|
||||||
|
|
||||||
@CoverageIgnore
|
@CoverageIgnore
|
||||||
public LockedId() {
|
public LockedId() {}
|
||||||
}
|
|
||||||
|
|
||||||
@CoverageIgnore
|
@CoverageIgnore
|
||||||
public LockedId(String theElementSpecificId) {
|
public LockedId(String theElementSpecificId) {
|
||||||
|
@ -94,15 +93,15 @@ public abstract class BaseIdentifiableElement extends BaseElement implements IId
|
||||||
@Override
|
@Override
|
||||||
@CoverageIgnore
|
@CoverageIgnore
|
||||||
public IdDt setValue(String theValue) throws DataFormatException {
|
public IdDt setValue(String theValue) throws DataFormatException {
|
||||||
throw new UnsupportedOperationException(Msg.code(1899) + "Use IElement#setElementSpecificId(String) to set the element ID for an element");
|
throw new UnsupportedOperationException(
|
||||||
|
Msg.code(1899) + "Use IElement#setElementSpecificId(String) to set the element ID for an element");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CoverageIgnore
|
@CoverageIgnore
|
||||||
public void setValueAsString(String theValue) throws DataFormatException {
|
public void setValueAsString(String theValue) throws DataFormatException {
|
||||||
throw new UnsupportedOperationException(Msg.code(1900) + "Use IElement#setElementSpecificId(String) to set the element ID for an element");
|
throw new UnsupportedOperationException(
|
||||||
|
Msg.code(1900) + "Use IElement#setElementSpecificId(String) to set the element ID for an element");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,18 +19,18 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.model.api;
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
import java.io.Externalizable;
|
import java.io.Externalizable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.ObjectInput;
|
import java.io.ObjectInput;
|
||||||
import java.io.ObjectOutput;
|
import java.io.ObjectOutput;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
public abstract class BasePrimitive<T> extends BaseIdentifiableElement
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
implements IPrimitiveDatatype<T>, Externalizable {
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
|
||||||
|
|
||||||
public abstract class BasePrimitive<T> extends BaseIdentifiableElement implements IPrimitiveDatatype<T>, Externalizable {
|
|
||||||
|
|
||||||
private T myCoercedValue;
|
private T myCoercedValue;
|
||||||
private String myStringValue;
|
private String myStringValue;
|
||||||
|
@ -136,5 +136,4 @@ public abstract class BasePrimitive<T> extends BaseIdentifiableElement implement
|
||||||
public boolean hasValue() {
|
public boolean hasValue() {
|
||||||
return !StringUtils.isBlank(getValueAsString());
|
return !StringUtils.isBlank(getValueAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@DatatypeDef(name = "Extension")
|
@DatatypeDef(name = "Extension")
|
||||||
public class ExtensionDt extends BaseIdentifiableElement implements ICompositeDatatype, IBaseExtension<ExtensionDt, IDatatype> {
|
public class ExtensionDt extends BaseIdentifiableElement
|
||||||
|
implements ICompositeDatatype, IBaseExtension<ExtensionDt, IDatatype> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6399491332783085935L;
|
private static final long serialVersionUID = 6399491332783085935L;
|
||||||
|
|
||||||
|
@ -45,8 +46,7 @@ public class ExtensionDt extends BaseIdentifiableElement implements ICompositeDa
|
||||||
@Child(name = "value", type = IDatatype.class, order = 1, min = 0, max = 1)
|
@Child(name = "value", type = IDatatype.class, order = 1, min = 0, max = 1)
|
||||||
private IBaseDatatype myValue;
|
private IBaseDatatype myValue;
|
||||||
|
|
||||||
public ExtensionDt() {
|
public ExtensionDt() {}
|
||||||
}
|
|
||||||
|
|
||||||
public ExtensionDt(boolean theIsModifier) {
|
public ExtensionDt(boolean theIsModifier) {
|
||||||
myModifier = theIsModifier;
|
myModifier = theIsModifier;
|
||||||
|
@ -115,7 +115,9 @@ public class ExtensionDt extends BaseIdentifiableElement implements ICompositeDa
|
||||||
*/
|
*/
|
||||||
public IPrimitiveDatatype<?> getValueAsPrimitive() {
|
public IPrimitiveDatatype<?> getValueAsPrimitive() {
|
||||||
if (!(getValue() instanceof IPrimitiveDatatype)) {
|
if (!(getValue() instanceof IPrimitiveDatatype)) {
|
||||||
throw new ClassCastException(Msg.code(1887) + "Extension with URL["+myUrl+"] can not be cast to primitive type, type is: "+ getClass().getCanonicalName());
|
throw new ClassCastException(
|
||||||
|
Msg.code(1887) + "Extension with URL[" + myUrl + "] can not be cast to primitive type, type is: "
|
||||||
|
+ getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return (IPrimitiveDatatype<?>) getValue();
|
return (IPrimitiveDatatype<?>) getValue();
|
||||||
}
|
}
|
||||||
|
@ -168,7 +170,4 @@ public class ExtensionDt extends BaseIdentifiableElement implements ICompositeDa
|
||||||
retVal.append("value", getValue());
|
retVal.append("value", getValue());
|
||||||
return retVal.build();
|
return retVal.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,4 @@ package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public interface IBoundCodeableConcept extends Serializable {
|
public interface IBoundCodeableConcept extends Serializable {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ package ca.uhn.fhir.model.api;
|
||||||
public interface ICodingEnum {
|
public interface ICodingEnum {
|
||||||
|
|
||||||
String getCode();
|
String getCode();
|
||||||
String getSystem();
|
|
||||||
String getDisplay();
|
|
||||||
|
|
||||||
|
String getSystem();
|
||||||
|
|
||||||
|
String getDisplay();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,4 @@ package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||||
|
|
||||||
|
public interface ICompositeDatatype extends IDatatype, ICompositeElement, ICompositeType {}
|
||||||
|
|
||||||
public interface ICompositeDatatype extends IDatatype, ICompositeElement, ICompositeType {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -36,7 +36,5 @@ public interface ICompositeElement extends IElement {
|
||||||
* a discussion about this.
|
* a discussion about this.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
<T extends IElement>
|
<T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType);
|
||||||
List<T> getAllPopulatedChildElementsOfType(Class<T> theType);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,4 @@ package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||||
|
|
||||||
public interface IDatatype extends IElement, IBaseDatatype {
|
public interface IDatatype extends IElement, IBaseDatatype {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -21,9 +21,4 @@ package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBase;
|
import org.hl7.fhir.instance.model.api.IBase;
|
||||||
|
|
||||||
|
public interface IElement extends IBase {}
|
||||||
|
|
||||||
public interface IElement extends IBase {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,14 +19,13 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.model.api;
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import ca.uhn.fhir.context.*;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.fhirpath.IFhirPath;
|
import ca.uhn.fhir.fhirpath.IFhirPath;
|
||||||
|
import ca.uhn.fhir.rest.api.IVersionSpecificBundleFactory;
|
||||||
import org.hl7.fhir.instance.model.api.*;
|
import org.hl7.fhir.instance.model.api.*;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.*;
|
import java.io.InputStream;
|
||||||
import ca.uhn.fhir.rest.api.IVersionSpecificBundleFactory;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each structure version JAR will have an implementation of this interface.
|
* Each structure version JAR will have an implementation of this interface.
|
||||||
|
@ -65,5 +64,4 @@ public interface IFhirVersion {
|
||||||
* JAR is on the classpath. Otherwise it will result in a {@link ClassNotFoundException}
|
* JAR is on the classpath. Otherwise it will result in a {@link ClassNotFoundException}
|
||||||
*/
|
*/
|
||||||
Object getServerVersion();
|
Object getServerVersion();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,5 +55,4 @@ public interface IIdentifiableElement extends IElement {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void setId(String theId);
|
void setId(String theId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,10 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@JsonAutoDetect(creatorVisibility = JsonAutoDetect.Visibility.NONE, fieldVisibility = JsonAutoDetect.Visibility.NONE, getterVisibility = JsonAutoDetect.Visibility.NONE, isGetterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
|
@JsonAutoDetect(
|
||||||
public interface IModelJson {
|
creatorVisibility = JsonAutoDetect.Visibility.NONE,
|
||||||
}
|
fieldVisibility = JsonAutoDetect.Visibility.NONE,
|
||||||
|
getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||||
|
isGetterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||||
|
setterVisibility = JsonAutoDetect.Visibility.NONE)
|
||||||
|
public interface IModelJson {}
|
||||||
|
|
|
@ -19,9 +19,8 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.model.api;
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||||
|
|
||||||
public interface IPrimitiveDatatype<T> extends IDatatype, IPrimitiveType<T> {
|
public interface IPrimitiveDatatype<T> extends IDatatype, IPrimitiveType<T> {
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,13 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.model.api;
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.rest.api.QualifiedParamList;
|
import ca.uhn.fhir.rest.api.QualifiedParamList;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface IQueryParameterAnd<T extends IQueryParameterOr<?>> extends Serializable {
|
public interface IQueryParameterAnd<T extends IQueryParameterOr<?>> extends Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +38,8 @@ public interface IQueryParameterAnd<T extends IQueryParameterOr<?>> extends Seri
|
||||||
* @param theContext TODO
|
* @param theContext TODO
|
||||||
* @param theParamName TODO
|
* @param theParamName TODO
|
||||||
*/
|
*/
|
||||||
void setValuesAsQueryTokens(FhirContext theContext, String theParamName, List<QualifiedParamList> theParameters) throws InvalidRequestException;
|
void setValuesAsQueryTokens(FhirContext theContext, String theParamName, List<QualifiedParamList> theParameters)
|
||||||
|
throws InvalidRequestException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -50,6 +50,4 @@ public interface IQueryParameterAnd<T extends IQueryParameterOr<?>> extends Seri
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
List<T> getValuesAsQueryTokens();
|
List<T> getValuesAsQueryTokens();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,15 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.model.api;
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.rest.api.QualifiedParamList;
|
import ca.uhn.fhir.rest.api.QualifiedParamList;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface IQueryParameterOr<T extends IQueryParameterType> extends Serializable {
|
public interface IQueryParameterOr<T extends IQueryParameterType> extends Serializable {
|
||||||
|
|
||||||
void setValuesAsQueryTokens(FhirContext theContext, String theParamName, QualifiedParamList theParameters);
|
void setValuesAsQueryTokens(FhirContext theContext, String theParamName, QualifiedParamList theParameters);
|
||||||
|
|
||||||
List<T> getValuesAsQueryTokens();
|
List<T> getValuesAsQueryTokens();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.model.api;
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
public interface IQueryParameterType extends Serializable {
|
public interface IQueryParameterType extends Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,5 +76,4 @@ public interface IQueryParameterType extends Serializable {
|
||||||
* @return Returns a reference to <code>this</code> for easier method chaining
|
* @return Returns a reference to <code>this</code> for easier method chaining
|
||||||
*/
|
*/
|
||||||
IQueryParameterType setMissing(Boolean theMissing);
|
IQueryParameterType setMissing(Boolean theMissing);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,13 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.model.api;
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseMetaType;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||||
import ca.uhn.fhir.model.base.composite.BaseContainedDt;
|
import ca.uhn.fhir.model.base.composite.BaseContainedDt;
|
||||||
import ca.uhn.fhir.model.base.composite.BaseNarrativeDt;
|
import ca.uhn.fhir.model.base.composite.BaseNarrativeDt;
|
||||||
import ca.uhn.fhir.model.base.resource.ResourceMetadataMap;
|
import ca.uhn.fhir.model.base.resource.ResourceMetadataMap;
|
||||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseMetaType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is the parent interface for all FHIR Resource definition classes. Classes implementing this interface should be annotated with the {@link ResourceDef @ResourceDef} annotation.
|
* This interface is the parent interface for all FHIR Resource definition classes. Classes implementing this interface should be annotated with the {@link ResourceDef @ResourceDef} annotation.
|
||||||
|
@ -122,5 +121,4 @@ public interface IResource extends ICompositeElement, org.hl7.fhir.instance.mode
|
||||||
* The map must not be null
|
* The map must not be null
|
||||||
*/
|
*/
|
||||||
void setResourceMetadata(ResourceMetadataMap theMap);
|
void setResourceMetadata(ResourceMetadataMap theMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,5 +27,4 @@ import java.io.Writer;
|
||||||
public interface IStreamingDatatype<T> extends IPrimitiveType<T> {
|
public interface IStreamingDatatype<T> extends IPrimitiveType<T> {
|
||||||
|
|
||||||
void writeAsText(Writer theWriter) throws IOException;
|
void writeAsText(Writer theWriter) throws IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,5 +84,4 @@ public interface ISupportsUndeclaredExtensions extends IElement {
|
||||||
* @see #getUndeclaredExtensions() To return a mutable list which may be used to remove extensions
|
* @see #getUndeclaredExtensions() To return a mutable list which may be used to remove extensions
|
||||||
*/
|
*/
|
||||||
ExtensionDt addUndeclaredExtension(boolean theIsModifier, String theUrl);
|
ExtensionDt addUndeclaredExtension(boolean theIsModifier, String theUrl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.model.api;
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public interface IValueSetEnumBinder<T extends Enum<?>> extends Serializable {
|
public interface IValueSetEnumBinder<T extends Enum<?>> extends Serializable {
|
||||||
|
@ -31,6 +30,4 @@ public interface IValueSetEnumBinder<T extends Enum<?>> extends Serializable {
|
||||||
String toSystemString(T theEnum);
|
String toSystemString(T theEnum);
|
||||||
|
|
||||||
T fromCodeString(String theCodeString, String theSystemString);
|
T fromCodeString(String theCodeString, String theSystemString);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,6 @@ public class Include implements Serializable {
|
||||||
*/
|
*/
|
||||||
public String getParamTargetType() {
|
public String getParamTargetType() {
|
||||||
return myParamTargetType;
|
return myParamTargetType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
|
@ -218,7 +217,6 @@ public class Include implements Serializable {
|
||||||
myParamName = paramName;
|
myParamName = paramName;
|
||||||
myParamTargetType = paramTargetType;
|
myParamTargetType = paramTargetType;
|
||||||
myValue = theValue;
|
myValue = theValue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -274,7 +272,8 @@ public class Include implements Serializable {
|
||||||
String paramType = getParamType();
|
String paramType = getParamType();
|
||||||
String paramName = getParamName();
|
String paramName = getParamName();
|
||||||
if (isBlank(paramType) || isBlank(paramName)) {
|
if (isBlank(paramType) || isBlank(paramName)) {
|
||||||
throw new IllegalStateException(Msg.code(1889) + "This include does not contain a value in the format [ResourceType]:[paramName]");
|
throw new IllegalStateException(
|
||||||
|
Msg.code(1889) + "This include does not contain a value in the format [ResourceType]:[paramName]");
|
||||||
}
|
}
|
||||||
b.append(paramType);
|
b.append(paramType);
|
||||||
b.append(":");
|
b.append(":");
|
||||||
|
@ -287,5 +286,4 @@ public class Include implements Serializable {
|
||||||
Include retVal = new Include(b.toString(), myIterate, myImmutable);
|
Include retVal = new Include(b.toString(), myIterate, myImmutable);
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,8 +65,8 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
* Values for this key are of type <b>{@link InstantDt}</b>
|
* Values for this key are of type <b>{@link InstantDt}</b>
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public static final ResourceMetadataKeyEnum<IPrimitiveType<Date>> DELETED_AT = new ResourceMetadataKeyEnum<>("DELETED_AT", IPrimitiveType.class) {
|
public static final ResourceMetadataKeyEnum<IPrimitiveType<Date>> DELETED_AT =
|
||||||
};
|
new ResourceMetadataKeyEnum<>("DELETED_AT", IPrimitiveType.class) {};
|
||||||
/**
|
/**
|
||||||
* If present and populated with a {@link BundleEntrySearchModeEnum}, contains the "bundle entry search mode", which is the value of the status field in the Bundle entry containing this resource.
|
* If present and populated with a {@link BundleEntrySearchModeEnum}, contains the "bundle entry search mode", which is the value of the status field in the Bundle entry containing this resource.
|
||||||
* The value for this key corresponds to field <code>Bundle.entry.search.mode</code>. This value can be set to provide a status value of "include" for included resources being returned by a
|
* The value for this key corresponds to field <code>Bundle.entry.search.mode</code>. This value can be set to provide a status value of "include" for included resources being returned by a
|
||||||
|
@ -78,8 +78,8 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
* Values for this key are of type <b>{@link BundleEntrySearchModeEnum}</b>
|
* Values for this key are of type <b>{@link BundleEntrySearchModeEnum}</b>
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public static final ResourceMetadataKeyEnum<BundleEntrySearchModeEnum> ENTRY_SEARCH_MODE = new ResourceMetadataKeyEnum<>("ENTRY_SEARCH_MODE", BundleEntrySearchModeEnum.class) {
|
public static final ResourceMetadataKeyEnum<BundleEntrySearchModeEnum> ENTRY_SEARCH_MODE =
|
||||||
};
|
new ResourceMetadataKeyEnum<>("ENTRY_SEARCH_MODE", BundleEntrySearchModeEnum.class) {};
|
||||||
/**
|
/**
|
||||||
* If present and populated with a {@link BundleEntryTransactionMethodEnum}, contains the "bundle entry transaction operation", which is the value of the status field in the Bundle entry
|
* If present and populated with a {@link BundleEntryTransactionMethodEnum}, contains the "bundle entry transaction operation", which is the value of the status field in the Bundle entry
|
||||||
* containing this resource. The value for this key corresponds to field <code>Bundle.entry.transaction.operation</code>. This value can be set in resources being transmitted to a server to
|
* containing this resource. The value for this key corresponds to field <code>Bundle.entry.transaction.operation</code>. This value can be set in resources being transmitted to a server to
|
||||||
|
@ -92,8 +92,8 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
* Values for this key are of type <b>{@link BundleEntryTransactionMethodEnum}</b>
|
* Values for this key are of type <b>{@link BundleEntryTransactionMethodEnum}</b>
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public static final ResourceMetadataKeyEnum<BundleEntryTransactionMethodEnum> ENTRY_TRANSACTION_METHOD = new ResourceMetadataKeyEnum<>("ENTRY_TRANSACTION_OPERATION", BundleEntryTransactionMethodEnum.class) {
|
public static final ResourceMetadataKeyEnum<BundleEntryTransactionMethodEnum> ENTRY_TRANSACTION_METHOD =
|
||||||
};
|
new ResourceMetadataKeyEnum<>("ENTRY_TRANSACTION_OPERATION", BundleEntryTransactionMethodEnum.class) {};
|
||||||
/**
|
/**
|
||||||
* The value for this key represents a {@link List} of profile IDs that this resource claims to conform to.
|
* The value for this key represents a {@link List} of profile IDs that this resource claims to conform to.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -101,8 +101,8 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
* Values for this key are of type <b>List<IdDt></b>. Note that the returned list is <i>unmodifiable</i>, so you need to create a new list and call <code>put</code> to change its value.
|
* Values for this key are of type <b>List<IdDt></b>. Note that the returned list is <i>unmodifiable</i>, so you need to create a new list and call <code>put</code> to change its value.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public static final ResourceMetadataKeyEnum<List<IdDt>> PROFILES = new ResourceMetadataKeyEnum<>("PROFILES", List.class) {
|
public static final ResourceMetadataKeyEnum<List<IdDt>> PROFILES =
|
||||||
};
|
new ResourceMetadataKeyEnum<>("PROFILES", List.class) {};
|
||||||
/**
|
/**
|
||||||
* The value for this key is the bundle entry <b>Published</b> time. This is defined by FHIR as "Time resource copied into the feed", which is generally best left to the current time.
|
* The value for this key is the bundle entry <b>Published</b> time. This is defined by FHIR as "Time resource copied into the feed", which is generally best left to the current time.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -114,10 +114,11 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
*
|
*
|
||||||
* @see InstantDt
|
* @see InstantDt
|
||||||
*/
|
*/
|
||||||
public static final ResourceMetadataKeyEnum<InstantDt> PUBLISHED = new ResourceMetadataKeyEnum<>("PUBLISHED", InstantDt.class) {
|
public static final ResourceMetadataKeyEnum<InstantDt> PUBLISHED =
|
||||||
};
|
new ResourceMetadataKeyEnum<>("PUBLISHED", InstantDt.class) {};
|
||||||
public static final ResourceMetadataKeyEnum<List<BaseCodingDt>> SECURITY_LABELS = new ResourceMetadataKeyEnum<>("SECURITY_LABELS", List.class) {
|
|
||||||
};
|
public static final ResourceMetadataKeyEnum<List<BaseCodingDt>> SECURITY_LABELS =
|
||||||
|
new ResourceMetadataKeyEnum<>("SECURITY_LABELS", List.class) {};
|
||||||
/**
|
/**
|
||||||
* The value for this key is the list of tags associated with this resource
|
* The value for this key is the list of tags associated with this resource
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -126,8 +127,8 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
*
|
*
|
||||||
* @see TagList
|
* @see TagList
|
||||||
*/
|
*/
|
||||||
public static final ResourceMetadataKeyEnum<TagList> TAG_LIST = new ResourceMetadataKeyEnum<>("TAG_LIST", TagList.class) {
|
public static final ResourceMetadataKeyEnum<TagList> TAG_LIST =
|
||||||
};
|
new ResourceMetadataKeyEnum<>("TAG_LIST", TagList.class) {};
|
||||||
/**
|
/**
|
||||||
* The value for this key is the bundle entry <b>Updated</b> time. This is defined by FHIR as "Last Updated for resource". This value is also used for populating the "Last-Modified" header in the
|
* The value for this key is the bundle entry <b>Updated</b> time. This is defined by FHIR as "Last Updated for resource". This value is also used for populating the "Last-Modified" header in the
|
||||||
* case of methods that return a single resource (read, vread, etc.)
|
* case of methods that return a single resource (read, vread, etc.)
|
||||||
|
@ -137,8 +138,8 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
*
|
*
|
||||||
* @see InstantDt
|
* @see InstantDt
|
||||||
*/
|
*/
|
||||||
public static final ResourceMetadataKeyEnum<InstantDt> UPDATED = new ResourceMetadataKeyEnum<>("UPDATED", InstantDt.class) {
|
public static final ResourceMetadataKeyEnum<InstantDt> UPDATED =
|
||||||
};
|
new ResourceMetadataKeyEnum<>("UPDATED", InstantDt.class) {};
|
||||||
/**
|
/**
|
||||||
* The value for this key is the version ID of the resource object.
|
* The value for this key is the version ID of the resource object.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -148,8 +149,8 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
* @deprecated The {@link IResource#getId()} resource ID will now be populated with the version ID via the {@link IdDt#getVersionIdPart()} method
|
* @deprecated The {@link IResource#getId()} resource ID will now be populated with the version ID via the {@link IdDt#getVersionIdPart()} method
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final ResourceMetadataKeyEnum<String> VERSION = new ResourceMetadataKeyEnum<>("VERSION", String.class) {
|
public static final ResourceMetadataKeyEnum<String> VERSION =
|
||||||
};
|
new ResourceMetadataKeyEnum<>("VERSION", String.class) {};
|
||||||
/**
|
/**
|
||||||
* The value for this key is the version ID of the resource object.
|
* The value for this key is the version ID of the resource object.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -159,8 +160,9 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
* @deprecated The {@link IResource#getId()} resource ID will now be populated with the version ID via the {@link IdDt#getVersionIdPart()} method
|
* @deprecated The {@link IResource#getId()} resource ID will now be populated with the version ID via the {@link IdDt#getVersionIdPart()} method
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final ResourceMetadataKeyEnum<IdDt> VERSION_ID = new ResourceMetadataKeyEnum<>("VERSION_ID", IdDt.class) {
|
public static final ResourceMetadataKeyEnum<IdDt> VERSION_ID =
|
||||||
};
|
new ResourceMetadataKeyEnum<>("VERSION_ID", IdDt.class) {};
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private final String myValue;
|
private final String myValue;
|
||||||
private final Class<?> myType;
|
private final Class<?> myType;
|
||||||
|
@ -180,7 +182,8 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retVal != null && !myType.isAssignableFrom(retVal.getClass())) {
|
if (retVal != null && !myType.isAssignableFrom(retVal.getClass())) {
|
||||||
throw new InternalErrorException(Msg.code(1890) + "Found an object of type '" + retVal.getClass().getCanonicalName()
|
throw new InternalErrorException(Msg.code(1890) + "Found an object of type '"
|
||||||
|
+ retVal.getClass().getCanonicalName()
|
||||||
+ "' in resource metadata for key " + this.name() + " - Expected "
|
+ "' in resource metadata for key " + this.name() + " - Expected "
|
||||||
+ myType.getCanonicalName());
|
+ myType.getCanonicalName());
|
||||||
}
|
}
|
||||||
|
@ -191,7 +194,8 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
|
|
||||||
public void put(IBaseResource theResource, T theValue) {
|
public void put(IBaseResource theResource, T theValue) {
|
||||||
if (theValue != null && !myType.isAssignableFrom(theValue.getClass())) {
|
if (theValue != null && !myType.isAssignableFrom(theValue.getClass())) {
|
||||||
throw new InternalErrorException(Msg.code(1891) + "Can not put object of type '" + theValue.getClass().getCanonicalName()
|
throw new InternalErrorException(Msg.code(1891) + "Can not put object of type '"
|
||||||
|
+ theValue.getClass().getCanonicalName()
|
||||||
+ "' in resource metadata for key " + this.name() + " - Expected "
|
+ "' in resource metadata for key " + this.name() + " - Expected "
|
||||||
+ myType.getCanonicalName());
|
+ myType.getCanonicalName());
|
||||||
}
|
}
|
||||||
|
@ -205,12 +209,9 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj)
|
if (this == obj) return true;
|
||||||
return true;
|
if (obj == null) return false;
|
||||||
if (obj == null)
|
if (getClass() != obj.getClass()) return false;
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
ResourceMetadataKeyEnum<?> other = (ResourceMetadataKeyEnum<?>) obj;
|
ResourceMetadataKeyEnum<?> other = (ResourceMetadataKeyEnum<?>) obj;
|
||||||
if (myValue == null) {
|
if (myValue == null) {
|
||||||
return other.myValue == null;
|
return other.myValue == null;
|
||||||
|
|
|
@ -26,16 +26,20 @@ package ca.uhn.fhir.model.api;
|
||||||
* This is used in CRUD response OperationOutcome resources.
|
* This is used in CRUD response OperationOutcome resources.
|
||||||
*/
|
*/
|
||||||
public enum StorageResponseCodeEnum implements ICodingEnum {
|
public enum StorageResponseCodeEnum implements ICodingEnum {
|
||||||
|
|
||||||
SUCCESSFUL_CREATE("Create succeeded."),
|
SUCCESSFUL_CREATE("Create succeeded."),
|
||||||
SUCCESSFUL_CREATE_NO_CONDITIONAL_MATCH("Conditional create succeeded: no existing resource matched the conditional URL."),
|
SUCCESSFUL_CREATE_NO_CONDITIONAL_MATCH(
|
||||||
SUCCESSFUL_CREATE_WITH_CONDITIONAL_MATCH("Conditional create succeeded: an existing resource matched the conditional URL so no action was taken."),
|
"Conditional create succeeded: no existing resource matched the conditional URL."),
|
||||||
|
SUCCESSFUL_CREATE_WITH_CONDITIONAL_MATCH(
|
||||||
|
"Conditional create succeeded: an existing resource matched the conditional URL so no action was taken."),
|
||||||
SUCCESSFUL_UPDATE("Update succeeded."),
|
SUCCESSFUL_UPDATE("Update succeeded."),
|
||||||
SUCCESSFUL_UPDATE_AS_CREATE("Update as create succeeded."),
|
SUCCESSFUL_UPDATE_AS_CREATE("Update as create succeeded."),
|
||||||
SUCCESSFUL_UPDATE_NO_CHANGE("Update succeeded: No changes were detected so no action was taken."),
|
SUCCESSFUL_UPDATE_NO_CHANGE("Update succeeded: No changes were detected so no action was taken."),
|
||||||
SUCCESSFUL_UPDATE_NO_CONDITIONAL_MATCH("Conditional update succeeded: no existing resource matched the conditional URL so a new resource was created."),
|
SUCCESSFUL_UPDATE_NO_CONDITIONAL_MATCH(
|
||||||
SUCCESSFUL_UPDATE_WITH_CONDITIONAL_MATCH("Conditional update succeeded: an existing resource matched the conditional URL and was updated."),
|
"Conditional update succeeded: no existing resource matched the conditional URL so a new resource was created."),
|
||||||
SUCCESSFUL_UPDATE_WITH_CONDITIONAL_MATCH_NO_CHANGE("Conditional update succeeded: an existing resource matched the conditional URL and was updated, but no changes were detected so no action was taken."),
|
SUCCESSFUL_UPDATE_WITH_CONDITIONAL_MATCH(
|
||||||
|
"Conditional update succeeded: an existing resource matched the conditional URL and was updated."),
|
||||||
|
SUCCESSFUL_UPDATE_WITH_CONDITIONAL_MATCH_NO_CHANGE(
|
||||||
|
"Conditional update succeeded: an existing resource matched the conditional URL and was updated, but no changes were detected so no action was taken."),
|
||||||
SUCCESSFUL_DELETE("Delete succeeded."),
|
SUCCESSFUL_DELETE("Delete succeeded."),
|
||||||
SUCCESSFUL_DELETE_ALREADY_DELETED("Delete succeeded: Resource was already deleted so no action was taken."),
|
SUCCESSFUL_DELETE_ALREADY_DELETED("Delete succeeded: Resource was already deleted so no action was taken."),
|
||||||
SUCCESSFUL_DELETE_NOT_FOUND("Delete succeeded: No existing resource was found so no action was taken."),
|
SUCCESSFUL_DELETE_NOT_FOUND("Delete succeeded: No existing resource was found so no action was taken."),
|
||||||
|
@ -44,7 +48,8 @@ public enum StorageResponseCodeEnum implements ICodingEnum {
|
||||||
|
|
||||||
SUCCESSFUL_PATCH_NO_CHANGE("Patch succeeded: No changes were detected so no action was taken."),
|
SUCCESSFUL_PATCH_NO_CHANGE("Patch succeeded: No changes were detected so no action was taken."),
|
||||||
SUCCESSFUL_CONDITIONAL_PATCH("Conditional patch succeeded."),
|
SUCCESSFUL_CONDITIONAL_PATCH("Conditional patch succeeded."),
|
||||||
SUCCESSFUL_CONDITIONAL_PATCH_NO_CHANGE("Conditional patch succeeded: No changes were detected so no action was taken.");
|
SUCCESSFUL_CONDITIONAL_PATCH_NO_CHANGE(
|
||||||
|
"Conditional patch succeeded: No changes were detected so no action was taken.");
|
||||||
|
|
||||||
public static final String SYSTEM = "https://hapifhir.io/fhir/CodeSystem/hapi-fhir-storage-response-code";
|
public static final String SYSTEM = "https://hapifhir.io/fhir/CodeSystem/hapi-fhir-storage-response-code";
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,7 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
|
||||||
private String myVersion;
|
private String myVersion;
|
||||||
private Boolean myUserSelected;
|
private Boolean myUserSelected;
|
||||||
|
|
||||||
public Tag() {
|
public Tag() {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated There is no reason to create a tag with a term and not a scheme, so this constructor will be removed
|
* @deprecated There is no reason to create a tag with a term and not a scheme, so this constructor will be removed
|
||||||
|
@ -93,7 +92,6 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
|
||||||
myLabel = theLabel;
|
myLabel = theLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return myLabel;
|
return myLabel;
|
||||||
}
|
}
|
||||||
|
@ -108,19 +106,15 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj)
|
if (this == obj) return true;
|
||||||
return true;
|
if (obj == null) return false;
|
||||||
if (obj == null)
|
if (getClass() != obj.getClass()) return false;
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
Tag other = (Tag) obj;
|
Tag other = (Tag) obj;
|
||||||
|
|
||||||
return
|
return Objects.equals(myScheme, other.myScheme)
|
||||||
Objects.equals(myScheme, other.myScheme) &&
|
&& Objects.equals(myTerm, other.myTerm)
|
||||||
Objects.equals(myTerm, other.myTerm) &&
|
&& Objects.equals(myVersion, other.myVersion)
|
||||||
Objects.equals(myVersion, other.myVersion) &&
|
&& Objects.equals(myUserSelected, other.myUserSelected);
|
||||||
Objects.equals(myUserSelected, other.myUserSelected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -211,7 +205,9 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVersion() { return myVersion; }
|
public String getVersion() {
|
||||||
|
return myVersion;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBaseCoding setVersion(String theVersion) {
|
public IBaseCoding setVersion(String theVersion) {
|
||||||
|
@ -220,9 +216,13 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getUserSelected() { return myUserSelected != null && myUserSelected; }
|
public boolean getUserSelected() {
|
||||||
|
return myUserSelected != null && myUserSelected;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getUserSelectedBoolean() { return myUserSelected; }
|
public Boolean getUserSelectedBoolean() {
|
||||||
|
return myUserSelected;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBaseCoding setUserSelected(boolean theUserSelected) {
|
public IBaseCoding setUserSelected(boolean theUserSelected) {
|
||||||
|
@ -233,5 +233,4 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
|
||||||
public void setUserSelectedBoolean(Boolean theUserSelected) {
|
public void setUserSelectedBoolean(Boolean theUserSelected) {
|
||||||
myUserSelected = theUserSelected;
|
myUserSelected = theUserSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,18 +153,13 @@ public class TagList implements Set<Tag>, Serializable, IBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj)
|
if (this == obj) return true;
|
||||||
return true;
|
if (obj == null) return false;
|
||||||
if (obj == null)
|
if (getClass() != obj.getClass()) return false;
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
TagList other = (TagList) obj;
|
TagList other = (TagList) obj;
|
||||||
if (myTagSet == null) {
|
if (myTagSet == null) {
|
||||||
if (other.myTagSet != null)
|
if (other.myTagSet != null) return false;
|
||||||
return false;
|
} else if (!myTagSet.equals(other.myTagSet)) return false;
|
||||||
} else if (!myTagSet.equals(other.myTagSet))
|
|
||||||
return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,5 +285,4 @@ public class TagList implements Set<Tag>, Serializable, IBase {
|
||||||
public void setUserData(String theName, Object theValue) {
|
public void setUserData(String theName, Object theValue) {
|
||||||
throw new UnsupportedOperationException(Msg.code(1898));
|
throw new UnsupportedOperationException(Msg.code(1898));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,12 @@
|
||||||
*/
|
*/
|
||||||
package ca.uhn.fhir.model.api;
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.apache.commons.lang3.time.DateUtils;
|
|
||||||
|
|
||||||
public enum TemporalPrecisionEnum {
|
public enum TemporalPrecisionEnum {
|
||||||
|
|
||||||
YEAR(Calendar.YEAR) {
|
YEAR(Calendar.YEAR) {
|
||||||
@Override
|
@Override
|
||||||
public Date add(Date theInput, int theAmount) {
|
public Date add(Date theInput, int theAmount) {
|
||||||
|
@ -50,7 +49,6 @@ public enum TemporalPrecisionEnum {
|
||||||
public Date add(Date theInput, int theAmount) {
|
public Date add(Date theInput, int theAmount) {
|
||||||
return DateUtils.addMinutes(theInput, theAmount);
|
return DateUtils.addMinutes(theInput, theAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
SECOND(Calendar.SECOND) {
|
SECOND(Calendar.SECOND) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -65,7 +63,6 @@ public enum TemporalPrecisionEnum {
|
||||||
return DateUtils.addMilliseconds(theInput, theAmount);
|
return DateUtils.addMilliseconds(theInput, theAmount);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private int myCalendarConstant;
|
private int myCalendarConstant;
|
||||||
|
@ -85,12 +82,18 @@ public enum TemporalPrecisionEnum {
|
||||||
*/
|
*/
|
||||||
public int stringLength() {
|
public int stringLength() {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case YEAR: return 4;
|
case YEAR:
|
||||||
case MONTH: return 7;
|
return 4;
|
||||||
case DAY: return 10;
|
case MONTH:
|
||||||
case MINUTE: return 16;
|
return 7;
|
||||||
case SECOND: return 19;
|
case DAY:
|
||||||
case MILLI: return 23;
|
return 10;
|
||||||
|
case MINUTE:
|
||||||
|
return 16;
|
||||||
|
case SECOND:
|
||||||
|
return 19;
|
||||||
|
case MILLI:
|
||||||
|
return 23;
|
||||||
}
|
}
|
||||||
return 0; // ??
|
return 0; // ??
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue