use of org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent in project org.hl7.fhir.core by hapifhir.
the class StructureMapUtilities method getTargetType.
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;
}
use of org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent in project org.hl7.fhir.core by hapifhir.
the class StructureMapUtilities method renderUses.
private void renderUses(StringBuilder b, StructureMap map) {
for (StructureMapStructureComponent s : map.getStructure()) {
b.append("uses \"");
b.append(s.getUrl());
b.append("\" as ");
b.append(s.getMode().toCode());
b.append("\r\n");
renderDoco(b, s.getDocumentation());
}
if (map.hasStructure())
b.append("\r\n");
}
use of org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent in project org.hl7.fhir.core by hapifhir.
the class SimpleWorkerContext method findTransformsforSource.
public List<StructureMap> findTransformsforSource(String url) {
List<StructureMap> res = new ArrayList<StructureMap>();
for (StructureMap map : listTransforms()) {
boolean match = false;
boolean ok = true;
for (StructureMapStructureComponent t : map.getStructure()) {
if (t.getMode() == StructureMapModelMode.SOURCE) {
match = match || t.getUrl().equals(url);
ok = ok && t.getUrl().equals(url);
}
}
if (match && ok)
res.add(map);
}
return res;
}
Aggregations