make sure logical models get a snapshot generated
This commit is contained in:
parent
c83b232f7c
commit
2cc40452d7
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue