Merge pull request #1456 from hapifhir/2023-10-gg-snapshot-fix

2023 10 gg snapshot fix
This commit is contained in:
Grahame Grieve 2023-10-10 19:39:41 +11:00 committed by GitHub
commit c9d9fd209b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 10 additions and 22 deletions

View File

@ -41,7 +41,7 @@ public class VersionConvertorConstants {
public final static String MODIFIER_REASON_LEGACY = "No Modifier Reason provideed in previous versions of FHIR";
public final static String PROFILE_EXTENSION = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ElementDefinition.type.profile";
public final static String IG_CONFORMANCE_MESSAGE_EVENT = "http://hl7.org/fhir/1.0/StructureDefinition/extension-Conformance.messaging.event";
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.group.element.target.equivalence";
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence";
public static final String EXT_ACTUAL_RESOURCE_NAME = "http://hl7.org/fhir/tools/StructureDefinition/original-resource-name";
public static final String EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL = QuestionnaireRenderer.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL;
public static final String EXT_NAMINGSYSTEM_TITLE = "http://hl7.org/fhir/5.0/StructureDefinition/extension-NamingSystem.title";

View File

@ -183,7 +183,7 @@ public class ToolingExtensions {
public static final String EXT_FHIR_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type";
public static final String EXT_XML_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type";
public static final String EXT_RENDERED_VALUE = "http://hl7.org/fhir/StructureDefinition/rendered-value";
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.group.element.target.equivalence";
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence";
public static final String EXT_EXP_TOOCOSTLY = "http://hl7.org/fhir/StructureDefinition/valueset-toocostly";
public static final String EXT_MUST_SUPPORT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support";
public static final String EXT_TRANSLATABLE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable";

View File

@ -250,11 +250,7 @@ public class ContextUtilities implements ProfileKnowledgeProvider {
* @throws FHIRException
*/
public void generateSnapshot(StructureDefinition p) throws DefinitionException, FHIRException {
generateSnapshot(p, false);
}
public void generateSnapshot(StructureDefinition p, boolean ifLogical) {
if ((!p.hasSnapshot() || isProfileNeedsRegenerate(p) ) && (ifLogical || p.getKind() != StructureDefinitionKind.LOGICAL)) {
if ((!p.hasSnapshot() || isProfileNeedsRegenerate(p))) {
if (!p.hasBaseDefinition())
throw new DefinitionException(context.formatMessage(I18nConstants.PROFILE___HAS_NO_BASE_AND_NO_SNAPSHOT, p.getName(), p.getUrl()));
StructureDefinition sd = context.fetchResource(StructureDefinition.class, p.getBaseDefinition(), p);

View File

@ -206,7 +206,7 @@ public class ToolingExtensions {
public static final String EXT_VS_KEYWORD = "http://hl7.org/fhir/StructureDefinition/valueset-keyWord";
public static final String EXT_WORKGROUP = "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg";
public static final String EXT_XML_NAMESPACE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace";
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.group.element.target.equivalence";
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence";
public static final String EXT_Q_IS_SUBJ = "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject";
public static final String EXT_Q_HIDDEN = "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden";
public static final String EXT_Q_OTP_DISP = "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay";

View File

@ -43,7 +43,7 @@ public class CDARoundTripTests {
for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) {
if (!sd.hasSnapshot()) {
// System.out.println("generate snapshot for " + sd.getUrl());
new ContextUtilities(context).generateSnapshot(sd, true);
new ContextUtilities(context).generateSnapshot(sd);
}
}
}

View File

@ -41,7 +41,7 @@ public class XmlParserTests {
for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) {
if (!sd.hasSnapshot()) {
System.out.println("generate snapshot for " + sd.getUrl());
new ContextUtilities(context).generateSnapshot(sd, true);
new ContextUtilities(context).generateSnapshot(sd);
}
}
}

View File

@ -366,11 +366,7 @@ public class ValidationService {
List<StructureDefinition> structures = cu.allStructures();
for (StructureDefinition sd : structures) {
if (!sd.hasSnapshot()) {
if (sd.getKind() != null && sd.getKind() == StructureDefinitionKind.LOGICAL) {
cu.generateSnapshot(sd, true);
} else {
cu.generateSnapshot(sd, false);
}
cu.generateSnapshot(sd);
}
}
validator.setMapLog(cliContext.getMapLog());
@ -402,11 +398,7 @@ public class ValidationService {
List<StructureDefinition> structures = cu.allStructures();
for (StructureDefinition sd : structures) {
if (!sd.hasSnapshot()) {
if (sd.getKind() != null && sd.getKind() == StructureDefinitionKind.LOGICAL) {
cu.generateSnapshot(sd, true);
} else {
cu.generateSnapshot(sd, false);
}
cu.generateSnapshot(sd);
}
}
validator.setMapLog(cliContext.getMapLog());

View File

@ -76,7 +76,7 @@ public class StructureMappingTests {
for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) {
if (!sd.hasSnapshot()) {
System.out.println("generate snapshot for " + sd.getUrl());
new ContextUtilities(context).generateSnapshot(sd, true);
new ContextUtilities(context).generateSnapshot(sd);
}
}
if (context.getValidatorFactory() == null) {

View File

@ -384,7 +384,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
String contents = TestingUtilities.loadTestResource("validator", filename);
CanonicalResource mr = (CanonicalResource) loadResource(filename, contents);
if (mr instanceof StructureDefinition) {
new ContextUtilities(val.getContext()).generateSnapshot((StructureDefinition) mr, true);
new ContextUtilities(val.getContext()).generateSnapshot((StructureDefinition) mr);
}
logOutput("load resource "+mr.getUrl());
val.getContext().cacheResource(mr);