b.append(gi.getMode().toCode()); b.append(" "); b.append(gi.getName()); if (gi.hasType()) { b.append(" : ");
private void executeDependency(String indent, TransformContext context, StructureMap map, Variables vin, StructureMapGroupComponent group, StructureMapGroupRuleDependentComponent dependent) throws FHIRException { ResolvedGroup rg = resolveGroupReference(map, group, dependent.getName()); if (rg.target.getInput().size() != dependent.getVariable().size()) { throw new FHIRException("Rule '"+dependent.getName()+"' has "+Integer.toString(rg.target.getInput().size())+" but the invocation has "+Integer.toString(dependent.getVariable().size())+" variables"); } Variables v = new Variables(); for (int i = 0; i < rg.target.getInput().size(); i++) { StructureMapGroupInputComponent input = rg.target.getInput().get(i); StringType rdp = dependent.getVariable().get(i); String var = rdp.asStringValue(); VariableMode mode = input.getMode() == StructureMapInputMode.SOURCE ? VariableMode.INPUT : VariableMode.OUTPUT; Base vv = vin.get(mode, var); if (vv == null && mode == VariableMode.INPUT) //* once source, always source. but target can be treated as source at user convenient vv = vin.get(VariableMode.OUTPUT, var); if (vv == null) throw new FHIRException("Rule '"+dependent.getName()+"' "+mode.toString()+" variable '"+input.getName()+"' named as '"+var+"' has no value (vars = "+vin.summary()+")"); v.add(mode, input.getName(), vv); } executeGroup(indent+" ", context, rg.targetMap, v, rg.target, false); }
ResolvedGroup defGroup = resolveGroupByTypes(map, rule.getName(), group, srcType, tgtType); Variables vdef = new Variables(); vdef.add(VariableMode.INPUT, defGroup.target.getInput().get(0).getName(), src); vdef.add(VariableMode.OUTPUT, defGroup.target.getInput().get(1).getName(), tgt); executeGroup(indent+" ", context, defGroup.targetMap, vdef, defGroup.target, false);
b.append(gi.getMode().toCode()); b.append(" "); b.append(gi.getName()); if (gi.hasType()) { b.append(" : ");
ResolvedGroup defGroup = resolveGroupByTypes(map, rule.getName(), group, srcType, tgtType); Variables vdef = new Variables(); vdef.add(VariableMode.INPUT, defGroup.target.getInput().get(0).getName(), src); vdef.add(VariableMode.OUTPUT, defGroup.target.getInput().get(1).getName(), tgt); executeGroup(indent+" ", context, defGroup.targetMap, vdef, defGroup.target, false);
private void executeDependency(String indent, TransformContext context, StructureMap map, Variables vin, StructureMapGroupComponent group, StructureMapGroupRuleDependentComponent dependent) throws FHIRException { ResolvedGroup rg = resolveGroupReference(map, group, dependent.getName()); if (rg.target.getInput().size() != dependent.getVariable().size()) { throw new FHIRException("Rule '"+dependent.getName()+"' has "+Integer.toString(rg.target.getInput().size())+" but the invocation has "+Integer.toString(dependent.getVariable().size())+" variables"); } Variables v = new Variables(); for (int i = 0; i < rg.target.getInput().size(); i++) { StructureMapGroupInputComponent input = rg.target.getInput().get(i); StringType rdp = dependent.getVariable().get(i); String var = rdp.asStringValue(); VariableMode mode = input.getMode() == StructureMapInputMode.SOURCE ? VariableMode.INPUT : VariableMode.OUTPUT; Base vv = vin.get(mode, var); if (vv == null && mode == VariableMode.INPUT) //* once source, always source. but target can be treated as source at user convenient vv = vin.get(VariableMode.OUTPUT, var); if (vv == null) throw new FHIRException("Rule '"+dependent.getName()+"' "+mode.toString()+" variable '"+input.getName()+"' named as '"+var+"' has no value (vars = "+vin.summary()+")"); v.add(mode, input.getName(), vv); } executeGroup(indent+" ", context, rg.targetMap, v, rg.target, false); }
public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent(); copyElement(src, tgt); tgt.setName(src.getName()); if (src.hasType()) tgt.setType(src.getType()); tgt.setMode(convertStructureMapInputMode(src.getMode())); if (src.hasDocumentation()) tgt.setDocumentation(src.getDocumentation()); return tgt; }
private String getInputName(StructureMapGroupComponent g, StructureMapInputMode mode, String def) throws DefinitionException { String name = null; for (StructureMapGroupInputComponent inp : g.getInput()) { if (inp.getMode() == mode) if (name != null) throw new DefinitionException("This engine does not support multiple source inputs"); else name = inp.getName(); } return name == null ? def : name; }
public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent(); copyElement(src, tgt); tgt.setName(src.getName()); if (src.hasType()) tgt.setType(src.getType()); tgt.setMode(convertStructureMapInputMode(src.getMode())); if (src.hasDocumentation()) tgt.setDocumentation(src.getDocumentation()); return tgt; }
private String getInputName(StructureMapGroupComponent g, StructureMapInputMode mode, String def) throws DefinitionException { String name = null; for (StructureMapGroupInputComponent inp : g.getInput()) { if (inp.getMode() == mode) if (name != null) throw new DefinitionException("This engine does not support multiple source inputs"); else name = inp.getName(); } return name == null ? def : name; }