use of org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode 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());
}
}
}
use of org.hl7.fhir.r4.model.StructureMap.StructureMapTargetListMode 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());
}
}
}
Aggregations