mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-03-09 14:31:17 +00:00
hack workaround for bad SDC build: rebuild a particular profile when it's first used
This commit is contained in:
parent
17c7879122
commit
3e050853e4
@ -755,7 +755,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateSnapshot(StructureDefinition p, boolean logical) throws DefinitionException, FHIRException {
|
public void generateSnapshot(StructureDefinition p, boolean logical) throws DefinitionException, FHIRException {
|
||||||
if (!p.hasSnapshot() && (logical || p.getKind() != StructureDefinitionKind.LOGICAL)) {
|
if ((!p.hasSnapshot() || isProfileNeedsRegenerate(p) ) && (logical || p.getKind() != StructureDefinitionKind.LOGICAL)) {
|
||||||
if (!p.hasBaseDefinition())
|
if (!p.hasBaseDefinition())
|
||||||
throw new DefinitionException(formatMessage(I18nConstants.PROFILE___HAS_NO_BASE_AND_NO_SNAPSHOT, p.getName(), p.getUrl()));
|
throw new DefinitionException(formatMessage(I18nConstants.PROFILE___HAS_NO_BASE_AND_NO_SNAPSHOT, p.getName(), p.getUrl()));
|
||||||
StructureDefinition sd = fetchResource(StructureDefinition.class, p.getBaseDefinition());
|
StructureDefinition sd = fetchResource(StructureDefinition.class, p.getBaseDefinition());
|
||||||
@ -791,6 +791,15 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// work around the fact that some Implementation guides were published with old snapshot generators that left invalid snapshots behind.
|
||||||
|
private boolean isProfileNeedsRegenerate(StructureDefinition p) {
|
||||||
|
boolean needs = !p.hasUserData("hack.regnerated") && Utilities.existsInList(p.getUrl(), "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaireresponse");
|
||||||
|
if (needs) {
|
||||||
|
p.setUserData("hack.regnerated", "yes");
|
||||||
|
}
|
||||||
|
return needs;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isIgnoreProfileErrors() {
|
public boolean isIgnoreProfileErrors() {
|
||||||
return ignoreProfileErrors;
|
return ignoreProfileErrors;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user