support suppress examples when generating snapshots
This commit is contained in:
parent
ec2076bb04
commit
b657823373
|
@ -2508,18 +2508,36 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
derived.getPattern().setUserData(UD_DERIVATION_EQUALS, true);
|
derived.getPattern().setUserData(UD_DERIVATION_EQUALS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<ElementDefinitionExampleComponent> toDelB = new ArrayList<>();
|
||||||
|
List<ElementDefinitionExampleComponent> toDelD = new ArrayList<>();
|
||||||
for (ElementDefinitionExampleComponent ex : derived.getExample()) {
|
for (ElementDefinitionExampleComponent ex : derived.getExample()) {
|
||||||
boolean found = false;
|
boolean delete = ex.hasExtension(ToolingExtensions.EXT_ED_SUPPRESS);
|
||||||
for (ElementDefinitionExampleComponent exS : base.getExample())
|
if (delete && "$all".equals(ex.getLabel())) {
|
||||||
if (Base.compareDeep(ex, exS, false))
|
toDelB.addAll(base.getExample());
|
||||||
found = true;
|
} else {
|
||||||
if (!found)
|
boolean found = false;
|
||||||
base.addExample(ex.copy());
|
for (ElementDefinitionExampleComponent exS : base.getExample()) {
|
||||||
else if (trimDifferential)
|
if (Base.compareDeep(ex.getLabel(), exS.getLabel(), false) && Base.compareDeep(ex.getValue(), exS.getValue(), false)) {
|
||||||
derived.getExample().remove(ex);
|
if (delete) {
|
||||||
else
|
toDelB.add(exS);
|
||||||
ex.setUserData(UD_DERIVATION_EQUALS, true);
|
} else {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (delete) {
|
||||||
|
toDelD.add(ex);
|
||||||
|
} else if (!found) {
|
||||||
|
base.addExample(ex.copy());
|
||||||
|
} else if (trimDifferential) {
|
||||||
|
derived.getExample().remove(ex);
|
||||||
|
} else {
|
||||||
|
ex.setUserData(UD_DERIVATION_EQUALS, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
base.getExample().removeAll(toDelB);
|
||||||
|
derived.getExample().removeAll(toDelD);
|
||||||
|
|
||||||
if (derived.hasMaxLengthElement()) {
|
if (derived.hasMaxLengthElement()) {
|
||||||
if (!Base.compareDeep(derived.getMaxLengthElement(), base.getMaxLengthElement(), false))
|
if (!Base.compareDeep(derived.getMaxLengthElement(), base.getMaxLengthElement(), false))
|
||||||
|
|
Loading…
Reference in New Issue