Search in sources :

Example 1 with StructureMapGroupRuleTargetParameterComponent

use of org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent in project org.hl7.fhir.core by hapifhir.

the class StructureMap30_50 method convertStructureMapGroupRuleDependentComponent.

public static org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
    if (src.hasName())
        tgt.setNameElement(Id30_50.convertId(src.getNameElement()));
    for (StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addVariable(t.getValue().primitiveValue());
    return tgt;
}
Also used : StructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent)

Example 2 with StructureMapGroupRuleTargetParameterComponent

use of org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent in project org.hl7.fhir.core by hapifhir.

the class StructureMap40_50 method convertStructureMapGroupRuleDependentComponent.

// DIRTY
public static org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleDependentComponent();
    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
    if (src.hasName())
        tgt.setNameElement(Id40_50.convertId(src.getNameElement()));
    for (StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) {
        tgt.getVariable().add(convertStructureMapGroupRuleTargetParameterComponentToString(t));
    }
    return tgt;
}
Also used : org.hl7.fhir.r5.model(org.hl7.fhir.r5.model) StructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent)

Example 3 with StructureMapGroupRuleTargetParameterComponent

use of org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent in project org.hl7.fhir.core by hapifhir.

the class StructureMapUtilities method translate.

private Base translate(TransformContext context, StructureMap map, Variables vars, List<StructureMapGroupRuleTargetParameterComponent> parameter) throws FHIRException {
    Base src = getParam(vars, parameter.get(0));
    String id = getParamString(vars, parameter.get(1));
    String fld = getParamString(vars, parameter.get(2));
    return translate(context, map, src, id, fld);
}
Also used : Base(org.hl7.fhir.dstu2016may.model.Base)

Example 4 with StructureMapGroupRuleTargetParameterComponent

use of org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent in project org.hl7.fhir.core by hapifhir.

the class StructureMapUtilities method renderTarget.

private static void renderTarget(StringBuilder b, StructureMapGroupRuleTargetComponent rt, boolean abbreviate) {
    if (rt.hasContext()) {
        if (rt.getContextType() == StructureMapContextType.TYPE)
            b.append("@");
        b.append(rt.getContext());
        if (rt.hasElement()) {
            b.append('.');
            b.append(rt.getElement());
        }
    }
    if (!abbreviate && rt.hasTransform()) {
        if (rt.hasContext())
            b.append(" = ");
        if (rt.getTransform() == StructureMapTransform.COPY && rt.getParameter().size() == 1) {
            renderTransformParam(b, rt.getParameter().get(0));
        } else if (rt.getTransform() == StructureMapTransform.EVALUATE && rt.getParameter().size() == 1) {
            b.append("(");
            b.append("\"" + ((StringType) rt.getParameter().get(0).getValue()).asStringValue() + "\"");
            b.append(")");
        } else if (rt.getTransform() == StructureMapTransform.EVALUATE && rt.getParameter().size() == 2) {
            b.append(rt.getTransform().toCode());
            b.append("(");
            b.append(((IdType) rt.getParameter().get(0).getValue()).asStringValue());
            b.append("\"" + ((StringType) rt.getParameter().get(1).getValue()).asStringValue() + "\"");
            b.append(")");
        } else {
            b.append(rt.getTransform().toCode());
            b.append("(");
            boolean first = true;
            for (StructureMapGroupRuleTargetParameterComponent rtp : rt.getParameter()) {
                if (first)
                    first = false;
                else
                    b.append(", ");
                renderTransformParam(b, rtp);
            }
            b.append(")");
        }
    }
    if (!abbreviate && rt.hasVariable()) {
        b.append(" as ");
        b.append(rt.getVariable());
    }
    for (Enumeration<StructureMapTargetListMode> lm : rt.getListMode()) {
        b.append(" ");
        b.append(lm.getValue().toCode());
        if (lm.getValue() == StructureMapTargetListMode.SHARE) {
            b.append(" ");
            b.append(rt.getListRuleId());
        }
    }
}
Also used : StructureMapTargetListMode(org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode) StringType(org.hl7.fhir.dstu3.model.StringType) StructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent)

Example 5 with StructureMapGroupRuleTargetParameterComponent

use of org.hl7.fhir.r4.model.StructureMap.StructureMapGroupRuleTargetParameterComponent in project org.hl7.fhir.core by hapifhir.

the class StructureMapUtilities method paramToString.

public static String paramToString(StructureMapGroupRuleTargetParameterComponent rtp) {
    StringBuilder b = new StringBuilder();
    renderTransformParam(b, rtp);
    return b.toString();
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Aggregations

DefinitionException (org.hl7.fhir.exceptions.DefinitionException)9 NodeType (org.hl7.fhir.utilities.xhtml.NodeType)6 FHIRException (org.hl7.fhir.exceptions.FHIRException)5 StringType (org.hl7.fhir.dstu3.model.StringType)4 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)4 StringType (org.hl7.fhir.r4.model.StringType)4 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)4 BooleanType (org.hl7.fhir.dstu3.model.BooleanType)3 CodeType (org.hl7.fhir.dstu3.model.CodeType)3 DecimalType (org.hl7.fhir.dstu3.model.DecimalType)3 IdType (org.hl7.fhir.dstu3.model.IdType)3 IntegerType (org.hl7.fhir.dstu3.model.IntegerType)3 PrimitiveType (org.hl7.fhir.dstu3.model.PrimitiveType)3 StructureMapContextType (org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType)3 Type (org.hl7.fhir.dstu3.model.Type)3 ProfiledType (org.hl7.fhir.dstu3.model.TypeDetails.ProfiledType)3 UriType (org.hl7.fhir.dstu3.model.UriType)3 BooleanType (org.hl7.fhir.r4.model.BooleanType)3 CanonicalType (org.hl7.fhir.r4.model.CanonicalType)3 CodeType (org.hl7.fhir.r4.model.CodeType)3