use of org.hl7.fhir.r4b.model.StructureMap.StructureMapGroupRuleSourceComponent in project org.hl7.fhir.core by hapifhir.
the class StructureMapUtilities method parseSource.
private void parseSource(StructureMapGroupRuleComponent rule, FHIRLexer lexer) throws FHIRException {
StructureMapGroupRuleSourceComponent source = rule.addSource();
if (lexer.hasToken("optional"))
lexer.next();
else
source.setRequired(true);
source.setContext(lexer.take());
if (lexer.hasToken(".")) {
lexer.token(".");
source.setElement(lexer.take());
}
if (Utilities.existsInList(lexer.getCurrent(), "first", "last", "only_one"))
if (lexer.getCurrent().equals("only_one")) {
source.setListMode(StructureMapListMode.SHARE);
lexer.take();
} else
source.setListMode(StructureMapListMode.fromCode(lexer.take()));
if (lexer.hasToken("as")) {
lexer.take();
source.setVariable(lexer.take());
}
if (lexer.hasToken("where")) {
lexer.take();
ExpressionNode node = fpe.parse(lexer);
source.setUserData(MAP_WHERE_EXPRESSION, node);
source.setCondition(node.toString());
}
if (lexer.hasToken("check")) {
lexer.take();
ExpressionNode node = fpe.parse(lexer);
source.setUserData(MAP_WHERE_CHECK, node);
source.setCheck(node.toString());
}
}
Aggregations