private static void renderTarget(StringBuilder b, StructureMapGroupRuleTargetComponent rt, boolean abbreviate) { if (rt.hasContext()) { if (rt.getContextType() == StructureMapContextType.TYPE) b.append("@"); if (rt.hasContext()) b.append(" = "); if (rt.getTransform() == StructureMapTransform.COPY && rt.getParameter().size() == 1) {
private boolean isSimpleSyntax(StructureMapGroupRuleComponent rule) { return (rule.getSource().size() == 1 && rule.getSourceFirstRep().hasContext() && rule.getSourceFirstRep().hasElement() && !rule.getSourceFirstRep().hasVariable()) && (rule.getTarget().size() == 1 && rule.getTargetFirstRep().hasContext() && rule.getTargetFirstRep().hasElement() && !rule.getTargetFirstRep().hasVariable() && !rule.getTargetFirstRep().hasParameter()) && (rule.getDependent().size() == 0 && rule.getRule().size() == 0); }
private void processTarget(String ruleId, TransformContext context, Variables vars, StructureMap map, StructureMapGroupComponent group, StructureMapGroupRuleTargetComponent tgt, String srcVar, boolean atRoot) throws FHIRException { Base dest = null; if (tgt.hasContext()) { dest = vars.get(VariableMode.OUTPUT, tgt.getContext()); if (dest == null) throw new FHIRException("Rule \""+ruleId+"\": target context not known: "+tgt.getContext()); if (!tgt.hasElement()) throw new FHIRException("Rule \""+ruleId+"\": Not supported yet"); } Base v = null; if (tgt.hasTransform()) { v = runTransform(ruleId, context, map, group, tgt, vars, dest, tgt.getElement(), srcVar, atRoot); if (v != null && dest != null) v = dest.setProperty(tgt.getElement().hashCode(), tgt.getElement(), v); // reset v because some implementations may have to rewrite v when setting the value } else if (dest != null) v = dest.makeProperty(tgt.getElement().hashCode(), tgt.getElement()); if (tgt.hasVariable() && v != null) vars.add(VariableMode.OUTPUT, tgt.getVariable(), v); }
private static void renderTarget(StringBuilder b, StructureMapGroupRuleTargetComponent rt, boolean abbreviate) { if (rt.hasContext()) { if (rt.getContextType() == StructureMapContextType.TYPE) b.append("@"); if (rt.hasContext()) b.append(" = "); if (rt.getTransform() == StructureMapTransform.COPY && rt.getParameter().size() == 1) {
public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent(); copyElement(src, tgt); if (src.hasContext()) tgt.setContext(src.getContext()); if (src.hasContextType()) tgt.setContextType(convertStructureMapContextType(src.getContextType())); if (src.hasElement()) tgt.setElement(src.getElement()); if (src.hasVariable()) tgt.setVariable(src.getVariable()); for (Enumeration<org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode> t : src.getListMode()) tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); if (src.hasListRuleId()) tgt.setListRuleId(src.getListRuleId()); if (src.hasTransform()) tgt.setTransform(convertStructureMapTransform(src.getTransform())); for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); return tgt; }
private void processTarget(String ruleId, TransformContext context, Variables vars, StructureMap map, StructureMapGroupComponent group, StructureMapGroupRuleTargetComponent tgt, String srcVar, boolean atRoot) throws FHIRException { Base dest = null; if (tgt.hasContext()) { dest = vars.get(VariableMode.OUTPUT, tgt.getContext()); if (dest == null) throw new FHIRException("Rule \""+ruleId+"\": target context not known: "+tgt.getContext()); if (!tgt.hasElement()) throw new FHIRException("Rule \""+ruleId+"\": Not supported yet"); } Base v = null; if (tgt.hasTransform()) { v = runTransform(ruleId, context, map, group, tgt, vars, dest, tgt.getElement(), srcVar, atRoot); if (v != null && dest != null) v = dest.setProperty(tgt.getElement().hashCode(), tgt.getElement(), v); // reset v because some implementations may have to rewrite v when setting the value } else if (dest != null) v = dest.makeProperty(tgt.getElement().hashCode(), tgt.getElement()); if (tgt.hasVariable() && v != null) vars.add(VariableMode.OUTPUT, tgt.getVariable(), v); }
private boolean isSimpleSyntax(StructureMapGroupRuleComponent rule) { return (rule.getSource().size() == 1 && rule.getSourceFirstRep().hasContext() && rule.getSourceFirstRep().hasElement() && !rule.getSourceFirstRep().hasVariable()) && (rule.getTarget().size() == 1 && rule.getTargetFirstRep().hasContext() && rule.getTargetFirstRep().hasElement() && !rule.getTargetFirstRep().hasVariable() && !rule.getTargetFirstRep().hasParameter()) && (rule.getDependent().size() == 0 && rule.getRule().size() == 0); }
public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent(); copyElement(src, tgt); if (src.hasContext()) tgt.setContext(src.getContext()); if (src.hasContextType()) tgt.setContextType(convertStructureMapContextType(src.getContextType())); if (src.hasElement()) tgt.setElement(src.getElement()); if (src.hasVariable()) tgt.setVariable(src.getVariable()); for (Enumeration<org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode> t : src.getListMode()) tgt.addListMode(convertStructureMapTargetListMode(t.getValue())); if (src.hasListRuleId()) tgt.setListRuleId(src.getListRuleId()); if (src.hasTransform()) tgt.setTransform(convertStructureMapTransform(src.getTransform())); for (org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t)); return tgt; }