suppress spurious error message

This commit is contained in:
Grahame Grieve 2023-07-18 11:08:09 +10:00
parent 55c12301ba
commit 8c0539136c
1 changed files with 15 additions and 9 deletions

View File

@ -2292,13 +2292,17 @@ public class ProfileUtilities extends TranslatingUtilities {
}
// Before applying changes, apply them to what's in the profile
StructureDefinition profile = null;
boolean msg = true;
if (base.hasSliceName()) {
profile = base.getType().size() == 1 && base.getTypeFirstRep().hasProfile() ? context.fetchResource(StructureDefinition.class, base.getTypeFirstRep().getProfile().get(0).getValue(), srcSD) : null;
}
if (profile==null) {
profile = source.getType().size() == 1 && source.getTypeFirstRep().hasProfile() ? context.fetchResource(StructureDefinition.class, source.getTypeFirstRep().getProfile().get(0).getValue(), derivedSrc) : null;
if (profile != null && !"Extension".equals(profile.getType()) && profile.getKind() != StructureDefinitionKind.RESOURCE && profile.getKind() != StructureDefinitionKind.LOGICAL) {
// this is a problem - we're kind of hacking things here. The problem is that we sometimes want the details from the profile to override the
// inherited attributes, and sometimes not
profile = null;
msg = false;
}
}
if (profile != null) {
@ -2320,6 +2324,7 @@ public class ProfileUtilities extends TranslatingUtilities {
} else if (source.getType().size() == 1 && source.getTypeFirstRep().hasProfile() && !source.getTypeFirstRep().getProfile().get(0).hasExtension(ToolingExtensions.EXT_PROFILE_ELEMENT)) {
// todo: should we change down the profile_element if there's one?
String type = source.getTypeFirstRep().getWorkingCode();
if (msg) {
if ("Extension".equals(type)) {
System.out.println("Can't find Extension definition for "+source.getTypeFirstRep().getProfile().get(0).asStringValue()+" but trying to go on");
if (allowUnknownProfile != AllowUnknownProfile.ALL_TYPES) {
@ -2332,6 +2337,7 @@ public class ProfileUtilities extends TranslatingUtilities {
}
}
}
}
if (derived != null) {
if (derived.hasSliceName()) {
base.setSliceName(derived.getSliceName());