public void addAncestorProfiles(StructureDefinition sd) { if (sd.getDerivation().equals(StructureDefinition.TypeDerivationRule.CONSTRAINT)) { StructureDefinition parentSd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); if (parentSd != null && !profiles.containsKey(parentSd)) { ProfileUsage pu = new ProfileUsage(parentSd); pu.setChecked(); // We're going to check the child, so no need to check the parent profiles.put(parentSd, pu); } } }
private boolean isCompatibleType(String t, String code) { if (t.equals(code)) return true; if (t.equals("string")) { StructureDefinition sd = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code); if (sd != null && sd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/string")) return true; } return false; }
public void addAncestorProfiles(StructureDefinition sd) { if (sd.getDerivation().equals(StructureDefinition.TypeDerivationRule.CONSTRAINT)) { StructureDefinition parentSd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); if (parentSd != null && !profiles.containsKey(parentSd)) { ProfileUsage pu = new ProfileUsage(parentSd); pu.setChecked(); // We're going to check the child, so no need to check the parent profiles.put(parentSd, pu); } } }
public boolean hasType(IWorkerContext context, String... tn) { for (String n: tn) { String t = ProfiledType.ns(n); if (typesContains(t)) return true; } for (String n: tn) { String id = n.contains("#") ? n.substring(0, n.indexOf("#")) : n; String tail = null; if (n.contains("#")) { tail = n.substring( n.indexOf("#")+1); tail = tail.substring(tail.indexOf(".")); } String t = ProfiledType.ns(n); StructureDefinition sd = context.fetchResource(StructureDefinition.class, t); while (sd != null) { if (tail == null && typesContains(sd.getUrl())) return true; if (tail != null && typesContains(sd.getUrl()+"#"+sd.getType()+tail)) return true; if (sd.hasBaseDefinition()) sd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); else sd = null; } } return false; }
tgt.addContext(t.getValue()); tgt.setConstrainedType(src.getType()); tgt.setBase(src.getBaseDefinition()); tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
public void populateLogicalSnapshot(StructureDefinition sd) throws FHIRException { sd.getSnapshot().getElement().add(sd.getDifferential().getElementFirstRep().copy()); if (sd.hasBaseDefinition()) { StructureDefinition base = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); if (base == null) throw new FHIRException("Unable to find base definition for logical model: "+sd.getBaseDefinition()+" from "+sd.getUrl()); copyElements(sd, base.getSnapshot().getElement()); } copyElements(sd, sd.getDifferential().getElement()); }
public void generateSchematrons(OutputStream dest, StructureDefinition structure) throws IOException, DefinitionException { if (structure.getDerivation() != TypeDerivationRule.CONSTRAINT) throw new DefinitionException("not the right kind of structure to generate schematrons for"); if (!structure.hasSnapshot()) throw new DefinitionException("needs a snapshot"); StructureDefinition base = context.fetchResource(StructureDefinition.class, structure.getBaseDefinition()); SchematronWriter sch = new SchematronWriter(dest, SchematronType.PROFILE, base.getName()); ElementDefinition ed = structure.getSnapshot().getElement().get(0); generateForChildren(sch, "f:"+ed.getPath(), ed, structure, base); sch.dump(); }
tgt.addContext(t.getValue()); if (src.hasBaseDefinition()) tgt.setBaseDefinition(src.getBaseDefinition()); if (src.hasType() && src.getDerivation() == org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) tgt.setBaseType(src.getType());
if (sd != null) { if (!sd.hasSnapshot()) { StructureDefinition sdb = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); if (sdb == null) throw new DefinitionException("no base for "+sd.getBaseDefinition()); generateSnapshot(sdb, sd, sd.getUrl(), sd.getName());
tgt.addContext(t.getValue()); tgt.setConstrainedType(src.getType()); tgt.setBase(src.getBaseDefinition()); tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
tgt.addContext(t.getValue()); if (src.hasBaseDefinition()) tgt.setBaseDefinition(src.getBaseDefinition()); if (src.hasType() && src.getDerivation() == org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) tgt.setBaseType(src.getType());