class KiePMMLDescrRhsFactory {

    protected void commonDeclareThen(final KiePMMLDroolsRule rule, final StringJoiner joiner) {
        if (rule.getFocusedAgendaGroup() != null) {
            joiner.add(String.format(FOCUS_AGENDA_GROUP, rule.getFocusedAgendaGroup()));
        }
        if (rule.getToAccumulate() != null) {
            joiner.add(String.format(UPDATE_STATUS_HOLDER_ACCUMULATE, rule.getToAccumulate()));
        }
        if (rule.isAccumulationResult()) {
            joiner.add(RETURN_ACCUMULATION);
        }
        if (rule.getResultCode() != null) {
            joiner.add(String.format(SET_PMML4_RESULT_CODE, rule.getResultCode()));
        }
        if (rule.getResult() != null) {
            joiner.add(String.format(ADD_PMML4_RESULT_VARIABLE, rule.getResult()));
        }
        if (rule.getReasonCodeAndValue() != null) {
            final KiePMMLReasonCodeAndValue reasonCodeAndValue = rule.getReasonCodeAndValue();
            joiner.add(String.format(ADD_OUTPUTFIELD_VALUE, reasonCodeAndValue.getReasonCode(), reasonCodeAndValue.getValue()));
        }
        if (rule.getOutputFields() != null) {
            if (rule.getResult() != null) {
                commonDeclareOutputFields(rule.getOutputFields(), rule.getResult(), joiner);
            } else if (rule.isAccumulationResult()) {
                commonDeclareOutputFields(rule.getOutputFields(), "$statusHolder.getAccumulator()", joiner);
            }
        }
    }

    private  KiePMMLDescrRhsFactory(final RuleDescrBuilder builder);

}