Skip to content

Commit 077676f

Browse files
committed
Bring DSTU3 structs up to FHIR R3
Squashed commit of the following: commit 65b70d3 Author: James <[email protected]> Date: Tue Apr 18 07:44:08 2017 -0400 More work on bringing structs up to date commit 1df2de0 Author: James <[email protected]> Date: Tue Apr 18 07:12:45 2017 -0400 Working commit 9a51323 Author: James <[email protected]> Date: Mon Apr 17 22:18:24 2017 -0400 Updates to STU3 commit 40aebba Author: James <[email protected]> Date: Mon Apr 17 18:30:26 2017 -0400 Fix regression caused by #610
1 parent 6a5d0f9 commit 077676f

File tree

1,582 files changed

+187233
-194262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,582 files changed

+187233
-194262
lines changed

examples/src/main/java/example/ConverterExamples.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import org.hl7.fhir.convertors.NullVersionConverterAdvisor;
44
import org.hl7.fhir.convertors.VersionConvertorAdvisor;
5-
import org.hl7.fhir.convertors.VersionConvertor_10_20;
6-
import org.hl7.fhir.convertors.VersionConvertor_14_20;
5+
import org.hl7.fhir.convertors.VersionConvertor_10_30;
6+
import org.hl7.fhir.convertors.VersionConvertor_14_30;
77
import org.hl7.fhir.exceptions.FHIRException;
88

99
public class ConverterExamples {
@@ -13,7 +13,7 @@ public void c1020() throws FHIRException {
1313
//START SNIPPET: 1020
1414
// Create a converter
1515
VersionConvertorAdvisor advisor = new NullVersionConverterAdvisor();
16-
VersionConvertor_10_20 converter = new VersionConvertor_10_20(advisor);
16+
VersionConvertor_10_30 converter = new VersionConvertor_10_30(advisor);
1717

1818
// Create an input resource to convert
1919
org.hl7.fhir.instance.model.Observation input = new org.hl7.fhir.instance.model.Observation();
@@ -33,7 +33,7 @@ public void c1420() throws FHIRException {
3333
input.setTitle("My title");
3434

3535
// Convert the resource
36-
org.hl7.fhir.dstu3.model.Questionnaire output = VersionConvertor_14_20.convertQuestionnaire(input);
36+
org.hl7.fhir.dstu3.model.Questionnaire output = VersionConvertor_14_30.convertQuestionnaire(input);
3737
String context = output.getTitle();
3838
//END SNIPPET: 1420
3939
}

hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java

+14-11
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public class FhirContext {
8282
private Map<String, Class<? extends IBaseResource>> myDefaultTypeForProfile = new HashMap<String, Class<? extends IBaseResource>>();
8383
private volatile Map<String, RuntimeResourceDefinition> myIdToResourceDefinition = Collections.emptyMap();
8484
private boolean myInitialized;
85+
private boolean myInitializing = false;
8586
private HapiLocalizer myLocalizer = new HapiLocalizer();
8687
private volatile Map<String, BaseRuntimeElementDefinition<?>> myNameToElementDefinition = Collections.emptyMap();
8788
private volatile Map<String, RuntimeResourceDefinition> myNameToResourceDefinition = Collections.emptyMap();
@@ -94,6 +95,7 @@ public class FhirContext {
9495
private volatile IRestfulClientFactory myRestfulClientFactory;
9596
private volatile RuntimeChildUndeclaredExtensionDefinition myRuntimeChildUndeclaredExtensionDefinition;
9697
private IContextValidationSupport<?, ?, ?, ?, ?, ?> myValidationSupport;
98+
9799
private final IFhirVersion myVersion;
98100

99101
private Map<FhirVersionEnum, Map<String, Class<? extends IBaseResource>>> myVersionToNameToResourceType = Collections.emptyMap();
@@ -384,15 +386,6 @@ public RuntimeResourceDefinition getResourceDefinition(String theResourceName) {
384386
return retVal;
385387
}
386388

387-
/**
388-
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed
389-
* for extending the core library.
390-
*/
391-
public RuntimeResourceDefinition getResourceDefinitionById(String theId) {
392-
validateInitialized();
393-
return myIdToResourceDefinition.get(theId);
394-
}
395-
396389
// /**
397390
// * Return an unmodifiable collection containing all known resource definitions
398391
// */
@@ -407,6 +400,15 @@ public RuntimeResourceDefinition getResourceDefinitionById(String theId) {
407400
// return Collections.unmodifiableCollection(myIdToResourceDefinition.values());
408401
// }
409402

403+
/**
404+
* Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed
405+
* for extending the core library.
406+
*/
407+
public RuntimeResourceDefinition getResourceDefinitionById(String theId) {
408+
validateInitialized();
409+
return myIdToResourceDefinition.get(theId);
410+
}
411+
410412
/**
411413
* Returns the scanned runtime models. This is an advanced feature which is generally only needed for extending the
412414
* core library.
@@ -842,12 +844,13 @@ private List<Class<? extends IElement>> toElementList(Collection<Class<? extends
842844
}
843845
return resTypes;
844846
}
845-
847+
846848
private void validateInitialized() {
847849
// See #610
848850
if (!myInitialized) {
849851
synchronized (this) {
850-
if (!myInitialized) {
852+
if (!myInitialized && !myInitializing) {
853+
myInitializing = true;
851854
scanResourceTypes(toElementList(myResourceTypesToScan));
852855
}
853856
}

hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java

+14
Original file line numberDiff line numberDiff line change
@@ -1817,6 +1817,20 @@ public void write(RuntimeResourceDefinition theResDef, IBaseResource theResource
18171817
* See #327
18181818
*/
18191819
List<? extends IBase> preProcessedValue = preProcessValues(myDef, theResource, Collections.singletonList(myValue), myChildElem);
1820+
1821+
// // Check for undeclared extensions on the declared extension
1822+
// // (grrrrrr....)
1823+
// if (myValue instanceof ISupportsUndeclaredExtensions) {
1824+
// ISupportsUndeclaredExtensions value = (ISupportsUndeclaredExtensions)myValue;
1825+
// List<ExtensionDt> exts = value.getUndeclaredExtensions();
1826+
// if (exts.size() > 0) {
1827+
// ArrayList<IBase> newValueList = new ArrayList<IBase>();
1828+
// newValueList.addAll(preProcessedValue);
1829+
// newValueList.addAll(exts);
1830+
// preProcessedValue = newValueList;
1831+
// }
1832+
// }
1833+
18201834
myValue = preProcessedValue.get(0);
18211835

18221836
BaseRuntimeElementDefinition<?> def = myDef.getChildElementDefinitionByDatatype(myValue.getClass());
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,17 @@
1-
package org.hl7.fhir.convertors;
2-
3-
/*
4-
* #%L
5-
* HAPI FHIR - Converter
6-
* %%
7-
* Copyright (C) 2014 - 2017 University Health Network
8-
* %%
9-
* Licensed under the Apache License, Version 2.0 (the "License");
10-
* you may not use this file except in compliance with the License.
11-
* You may obtain a copy of the License at
12-
*
13-
* http://www.apache.org/licenses/LICENSE-2.0
14-
*
15-
* Unless required by applicable law or agreed to in writing, software
16-
* distributed under the License is distributed on an "AS IS" BASIS,
17-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18-
* See the License for the specific language governing permissions and
19-
* limitations under the License.
20-
* #L%
21-
*/
22-
23-
24-
import org.hl7.fhir.dstu3.model.CodeSystem;
25-
import org.hl7.fhir.dstu3.model.ValueSet;
26-
import org.hl7.fhir.exceptions.FHIRException;
27-
28-
public interface VersionConvertorAdvisor {
29-
boolean ignoreEntry(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src);
30-
31-
// called ?
32-
org.hl7.fhir.instance.model.Resource convert(org.hl7.fhir.dstu3.model.Resource resource) throws FHIRException;
33-
34-
// called when an r2 value set has a codeSystem in it
35-
void handleCodeSystem(CodeSystem tgtcs, ValueSet source);
36-
37-
CodeSystem getCodeSystem(ValueSet src);
38-
}
1+
package org.hl7.fhir.convertors;
2+
3+
import org.hl7.fhir.dstu3.model.CodeSystem;
4+
import org.hl7.fhir.dstu3.model.ValueSet;
5+
import org.hl7.fhir.exceptions.FHIRException;
6+
7+
public interface VersionConvertorAdvisor {
8+
boolean ignoreEntry(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src);
9+
10+
// called ?
11+
org.hl7.fhir.instance.model.Resource convert(org.hl7.fhir.dstu3.model.Resource resource) throws FHIRException;
12+
13+
// called when an r2 value set has a codeSystem in it
14+
void handleCodeSystem(CodeSystem tgtcs, ValueSet source);
15+
16+
CodeSystem getCodeSystem(ValueSet src);
17+
}

0 commit comments

Comments
 (0)