autofix slice names

This commit is contained in:
Grahame Grieve 2020-01-27 21:09:02 +11:00
parent 06d6d9452a
commit 33d5462bcd

View File

@ -660,6 +660,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
List<ValidationMessage> msgs = new ArrayList<ValidationMessage>(); List<ValidationMessage> msgs = new ArrayList<ValidationMessage>();
List<String> errors = new ArrayList<String>(); List<String> errors = new ArrayList<String>();
ProfileUtilities pu = new ProfileUtilities(this, msgs, this); ProfileUtilities pu = new ProfileUtilities(this, msgs, this);
pu.setAutoFixSliceNames(true);
pu.setThrowException(false); pu.setThrowException(false);
if (sd.getDerivation() == TypeDerivationRule.CONSTRAINT) { if (sd.getDerivation() == TypeDerivationRule.CONSTRAINT) {
pu.sortDifferential(sd, p, p.getUrl(), errors, true); pu.sortDifferential(sd, p, p.getUrl(), errors, true);
@ -670,7 +671,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
pu.generateSnapshot(sd, p, p.getUrl(), Utilities.extractBaseUrl(sd.getUserString("path")), p.getName()); pu.generateSnapshot(sd, p, p.getUrl(), Utilities.extractBaseUrl(sd.getUserString("path")), p.getName());
for (ValidationMessage msg : msgs) { for (ValidationMessage msg : msgs) {
if ((!ignoreProfileErrors && msg.getLevel() == ValidationMessage.IssueSeverity.ERROR) || msg.getLevel() == ValidationMessage.IssueSeverity.FATAL) if ((!ignoreProfileErrors && msg.getLevel() == ValidationMessage.IssueSeverity.ERROR) || msg.getLevel() == ValidationMessage.IssueSeverity.FATAL)
throw new DefinitionException("Profile "+p.getName()+" ("+p.getUrl()+"). Error generating snapshot: "+msg.getMessage()); throw new DefinitionException("Profile "+p.getName()+" ("+p.getUrl()+"), element "+msg.getLocation()+". Error generating snapshot: "+msg.getMessage());
} }
if (!p.hasSnapshot()) if (!p.hasSnapshot())
throw new FHIRException("Profile "+p.getName()+" ("+p.getUrl()+"). Error generating snapshot"); throw new FHIRException("Profile "+p.getName()+" ("+p.getUrl()+"). Error generating snapshot");