"The element " + ei.name + " is illegal. Valid types at this point are " + describeTypes(ei.definition.getType())); } else if (ei.definition.getContentReference() != null) { typeDefn = resolveNameReference(profile.getSnapshot(), ei.definition.getContentReference());
private int find(String path) { String actual = base+path.substring(prefixLength); for (int i = 0; i < snapshot.size(); i++) { String p = snapshot.get(i).getPath(); if (p.equals(actual)) { return i; } if (p.endsWith("[x]") && actual.startsWith(p.substring(0, p.length()-3)) && !(actual.endsWith("[x]")) && !actual.substring(p.length()-3).contains(".")) { return i; } if (path.startsWith(p+".") && snapshot.get(i).hasContentReference()) { actual = base+(snapshot.get(i).getContentReference().substring(1)+"."+path.substring(p.length()+1)).substring(prefixLength); i = 0; } } if (prefixLength == 0) errors.add("Differential contains path "+path+" which is not found in the base"); else errors.add("Differential contains path "+path+" which is actually "+actual+", which is not found in the base"); return 0; }
public static List<ElementDefinition> getChildMap(StructureDefinition profile, ElementDefinition element) throws DefinitionException { if (element.getContentReference()!=null) { for (ElementDefinition e : profile.getSnapshot().getElement()) { if (element.getContentReference().equals("#"+e.getId())) return getChildMap(profile, e); } throw new DefinitionException("Unable to resolve name reference "+element.getContentReference()+" at path "+element.getPath()); } else { List<ElementDefinition> res = new ArrayList<ElementDefinition>(); List<ElementDefinition> elements = profile.getSnapshot().getElement(); String path = element.getPath(); for (int index = elements.indexOf(element) + 1; index < elements.size(); index++) { ElementDefinition e = elements.get(index); if (e.getPath().startsWith(path + ".")) { // We only want direct children, not all descendants if (!e.getPath().substring(path.length()+1).contains(".")) res.add(e); } else break; } return res; } }
String p = e.getPath(); if (!Utilities.noString(e.getContentReference()) && path.startsWith(p)) { if (path.length() > p.length()) return getChildList(profile, e.getContentReference()+"."+path.substring(p.length()+1), null); else return getChildList(profile, e.getContentReference(), null);
paths.add(t); if (ed.hasContentReference()) { String s = ed.getContentReference().substring(1); if (idMap.containsKey(s)) ed.setContentReference("#"+idMap.get(s));
ElementDefinition ed = definition; if (definition.hasContentReference()) { if (!definition.getContentReference().startsWith("#")) throw new Error("not handled yet"); boolean found = false; for (ElementDefinition d : structure.getSnapshot().getElement()) { if (d.hasId() && d.getId().equals(definition.getContentReference().substring(1))) { found = true; ed = d; throw new Error("Unable to resolve "+definition.getContentReference()+" at "+definition.getPath()+" on "+structure.getUrl());
if (ed.getPath().equals(path)) { if (ed.hasContentReference()) { return getElementDefinitionById(sd, ed.getContentReference()); } else return new ElementDefinitionMatch(ed, null); ElementDefinitionMatch m = getElementDefinitionById(sd, ed.getContentReference()); return getElementDefinition(sd, m.definition.getPath() + path.substring(ed.getPath().length()), allowTypedName);
tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); if (src.hasContentReference()) tgt.setNameReference(src.getContentReference().substring(1)); for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) tgt.addType(convertElementDefinitionTypeComponent(t));
tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); if (src.hasContentReference()) tgt.setContentReference(src.getContentReference()); for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) tgt.addType(convertTypeRefComponent(t));
diffCursor++; if (outcome.hasContentReference()) { ElementDefinition tgt = getElementById(base.getElement(), outcome.getContentReference()); if (tgt == null) throw new DefinitionException("Unable to resolve reference to "+outcome.getContentReference()); replaceFromContentReference(outcome, tgt); int nbc = base.getElement().indexOf(tgt)+1;
"The element " + ei.name + " is illegal. Valid types at this point are " + describeTypes(ei.definition.getType())); } else if (ei.definition.getContentReference() != null) { typeDefn = resolveNameReference(profile.getSnapshot(), ei.definition.getContentReference());
ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); if (ed == null) c.getPieces().add(gen.new Piece(null, "Unknown reference to "+definition.getContentReference(), null)); else c.getPieces().add(gen.new Piece("#"+ed.getPath(), "See "+ed.getPath(), null));
ElementDefinition ed = getElementByName(profile.getSnapshot().getElement(), definition.getContentReference()); if (ed == null) c.getPieces().add(gen.new Piece(null, translate("sd.table", "Unknown reference to %s", definition.getContentReference()), null)); else c.getPieces().add(gen.new Piece("#"+ed.getPath(), translate("sd.table", "See %s", ed.getPath()), null));
tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); if (src.hasContentReference()) tgt.setNameReference(src.getContentReference().substring(1)); for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) tgt.addType(convertElementDefinitionTypeComponent(t));
tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); if (src.hasContentReference()) tgt.setContentReference(src.getContentReference()); for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) tgt.addType(convertTypeRefComponent(t));