private static void renderUses(StringBuilder b, StructureMap map) { for (StructureMapStructureComponent s : map.getStructure()) { b.append("uses \""); b.append(s.getUrl()); b.append("\" "); if (s.hasAlias()) { b.append("alias "); b.append(s.getAlias()); b.append(" "); } b.append("as "); b.append(s.getMode().toCode()); b.append("\r\n"); renderDoco(b, s.getDocumentation()); } if (map.hasStructure()) b.append("\r\n"); }
private PropertyWithType resolveType(StructureMap map, String type, StructureMapInputMode mode) throws Exception { for (StructureMapStructureComponent imp : map.getStructure()) { if ((imp.getMode() == StructureMapModelMode.SOURCE && mode == StructureMapInputMode.SOURCE) || (imp.getMode() == StructureMapModelMode.TARGET && mode == StructureMapInputMode.TARGET)) { StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl()); if (sd == null) throw new Exception("Import "+imp.getUrl()+" cannot be resolved"); if (sd.getId().equals(type)) { return new PropertyWithType(sd.getType(), new Property(worker, sd.getSnapshot().getElement().get(0), sd), null, new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl())); } } } throw new Exception("Unable to find structure definition for "+type+" in imports"); }
tn = uses.getUrl(); break;
tn = uses.getUrl(); break;
private boolean matchesType(StructureMap map, String actualType, String statedType) throws FHIRException { // check the aliases for (StructureMapStructureComponent imp : map.getStructure()) { if (imp.hasAlias() && statedType.equals(imp.getAlias())) { StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl()); if (sd != null) statedType = sd.getType(); break; } } if (Utilities.isAbsoluteUrl(actualType)) { StructureDefinition sd = worker.fetchResource(StructureDefinition.class, actualType); if (sd != null) actualType = sd.getType(); } if (Utilities.isAbsoluteUrl(statedType)) { StructureDefinition sd = worker.fetchResource(StructureDefinition.class, statedType); if (sd != null) statedType = sd.getType(); } return actualType.equals(statedType); }
private static void renderUses(StringBuilder b, StructureMap map) { for (StructureMapStructureComponent s : map.getStructure()) { b.append("uses \""); b.append(s.getUrl()); b.append("\" "); if (s.hasAlias()) { b.append("alias "); b.append(s.getAlias()); b.append(" "); } b.append("as "); b.append(s.getMode().toCode()); b.append("\r\n"); renderDoco(b, s.getDocumentation()); } if (map.hasStructure()) b.append("\r\n"); }
public StructureDefinition getTargetType(StructureMap map) throws FHIRException { boolean found = false; StructureDefinition res = null; for (StructureMapStructureComponent uses : map.getStructure()) { if (uses.getMode() == StructureMapModelMode.TARGET) { if (found) throw new FHIRException("Multiple targets found in map "+map.getUrl()); found = true; res = worker.fetchResource(StructureDefinition.class, uses.getUrl()); if (res == null) throw new FHIRException("Unable to find "+uses.getUrl()+" referenced from map "+map.getUrl()); } } if (res == null) throw new FHIRException("No targets found in map "+map.getUrl()); return res; }
private PropertyWithType resolveType(StructureMap map, String type, StructureMapInputMode mode) throws Exception { for (StructureMapStructureComponent imp : map.getStructure()) { if ((imp.getMode() == StructureMapModelMode.SOURCE && mode == StructureMapInputMode.SOURCE) || (imp.getMode() == StructureMapModelMode.TARGET && mode == StructureMapInputMode.TARGET)) { StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl()); if (sd == null) throw new Exception("Import "+imp.getUrl()+" cannot be resolved"); if (sd.getId().equals(type)) { return new PropertyWithType(sd.getType(), new Property(worker, sd.getSnapshot().getElement().get(0), sd), null, new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl())); } } } throw new Exception("Unable to find structure definition for "+type+" in imports"); }
private String getActualType(StructureMap map, String statedType) throws FHIRException { // check the aliases for (StructureMapStructureComponent imp : map.getStructure()) { if (imp.hasAlias() && statedType.equals(imp.getAlias())) { StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl()); if (sd == null) throw new FHIRException("Unable to resolve structure "+imp.getUrl()); return sd.getId(); // should be sd.getType(), but R2... } } return statedType; }
public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent(); copyElement(src, tgt); tgt.setUrl(src.getUrl()); tgt.setMode(convertStructureMapStructureMode(src.getMode())); if (src.hasDocumentation()) tgt.setDocumentation(src.getDocumentation()); return tgt; }
private boolean matchesType(StructureMap map, String actualType, String statedType) throws FHIRException { // check the aliases for (StructureMapStructureComponent imp : map.getStructure()) { if (imp.hasAlias() && statedType.equals(imp.getAlias())) { StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl()); if (sd != null) statedType = sd.getType(); break; } } if (Utilities.isAbsoluteUrl(actualType)) { StructureDefinition sd = worker.fetchResource(StructureDefinition.class, actualType); if (sd != null) actualType = sd.getType(); } if (Utilities.isAbsoluteUrl(statedType)) { StructureDefinition sd = worker.fetchResource(StructureDefinition.class, statedType); if (sd != null) statedType = sd.getType(); } return actualType.equals(statedType); }
public StructureDefinition getTargetType(StructureMap map) throws FHIRException { boolean found = false; StructureDefinition res = null; for (StructureMapStructureComponent uses : map.getStructure()) { if (uses.getMode() == StructureMapModelMode.TARGET) { if (found) throw new FHIRException("Multiple targets found in map "+map.getUrl()); found = true; res = worker.fetchResource(StructureDefinition.class, uses.getUrl()); if (res == null) throw new FHIRException("Unable to find "+uses.getUrl()+" referenced from map "+map.getUrl()); } } if (res == null) throw new FHIRException("No targets found in map "+map.getUrl()); return res; }
public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapStructureComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent(); copyElement(src, tgt); tgt.setUrl(src.getUrl()); tgt.setMode(convertStructureMapStructureMode(src.getMode())); if (src.hasDocumentation()) tgt.setDocumentation(src.getDocumentation()); return tgt; }
private String getActualType(StructureMap map, String statedType) throws FHIRException { // check the aliases for (StructureMapStructureComponent imp : map.getStructure()) { if (imp.hasAlias() && statedType.equals(imp.getAlias())) { StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl()); if (sd == null) throw new FHIRException("Unable to resolve structure "+imp.getUrl()); return sd.getId(); // should be sd.getType(), but R2... } } return statedType; }