public StructureMapGroupInputComponent addInput() { //3 StructureMapGroupInputComponent t = new StructureMapGroupInputComponent(); if (this.input == null) this.input = new ArrayList<StructureMapGroupInputComponent>(); this.input.add(t); return t; }
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); }
private void parseInput(StructureMapGroupComponent group, FHIRLexer lexer, boolean newFmt) throws FHIRException { StructureMapGroupInputComponent input = group.addInput(); if (newFmt) { input.setMode(StructureMapInputMode.fromCode(lexer.take())); } else lexer.token("input"); input.setName(lexer.take()); if (lexer.hasToken(":")) { lexer.token(":"); input.setType(lexer.take()); } if (!newFmt) { lexer.token("as"); input.setMode(StructureMapInputMode.fromCode(lexer.take())); if (lexer.hasComment()) { input.setDocumentation(lexer.take().substring(2).trim()); } lexer.skipToken(";"); lexer.skipComments(); } }
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.r4.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.r4.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r4.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; }
public StructureMapGroupInputComponent addInput() { //3 StructureMapGroupInputComponent t = new StructureMapGroupInputComponent(); if (this.input == null) this.input = new ArrayList<StructureMapGroupInputComponent>(); this.input.add(t); return t; }
private boolean matchesByType(StructureMap map, StructureMapGroupComponent grp, String srcType, String tgtType) throws FHIRException { if (grp.getTypeMode() == StructureMapGroupTypeMode.NONE) return false; if (grp.getInput().size() != 2 || grp.getInput().get(0).getMode() != StructureMapInputMode.SOURCE || grp.getInput().get(1).getMode() != StructureMapInputMode.TARGET) return false; if (!grp.getInput().get(0).hasType() || !grp.getInput().get(1).hasType()) return false; return matchesType(map, srcType, grp.getInput().get(0).getType()) && matchesType(map, tgtType, grp.getInput().get(1).getType()); }
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; }
public boolean hasInput() { if (this.input == null) return false; for (StructureMapGroupInputComponent item : this.input) if (!item.isEmpty()) return true; return false; }
public StructureMapGroupInputComponent copy() { StructureMapGroupInputComponent dst = new StructureMapGroupInputComponent(); copyValues(dst); dst.name = name == null ? null : name.copy(); dst.type = type == null ? null : type.copy(); dst.mode = mode == null ? null : mode.copy(); dst.documentation = documentation == null ? null : documentation.copy(); return dst; }
private boolean matchesByType(StructureMap map, StructureMapGroupComponent grp, String type) throws FHIRException { if (grp.getTypeMode() != StructureMapGroupTypeMode.TYPEANDTYPES) return false; if (grp.getInput().size() != 2 || grp.getInput().get(0).getMode() != StructureMapInputMode.SOURCE || grp.getInput().get(1).getMode() != StructureMapInputMode.TARGET) return false; return matchesType(map, type, grp.getInput().get(0).getType()); }
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 parseInput(StructureMapGroupComponent group, FHIRLexer lexer, boolean newFmt) throws FHIRException { StructureMapGroupInputComponent input = group.addInput(); if (newFmt) { input.setMode(StructureMapInputMode.fromCode(lexer.take())); } else lexer.token("input"); input.setName(lexer.take()); if (lexer.hasToken(":")) { lexer.token(":"); input.setType(lexer.take()); } if (!newFmt) { lexer.token("as"); input.setMode(StructureMapInputMode.fromCode(lexer.take())); if (lexer.hasComment()) { input.setDocumentation(lexer.take().substring(2).trim()); } lexer.skipToken(";"); lexer.skipComments(); } }
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); }
private boolean matchesByType(StructureMap map, StructureMapGroupComponent grp, String type) throws FHIRException { if (grp.getTypeMode() != StructureMapGroupTypeMode.TYPEANDTYPES) return false; if (grp.getInput().size() != 2 || grp.getInput().get(0).getMode() != StructureMapInputMode.SOURCE || grp.getInput().get(1).getMode() != StructureMapInputMode.TARGET) return false; return matchesType(map, type, grp.getInput().get(0).getType()); }