protected String marshalRule(final RuleModel model) {
boolean isDSLEnhanced = model.hasDSLSentences();
bindingsPatterns = new HashMap<String, IFactPattern>();
bindingsFields = new HashMap<String, FieldConstraint>();
fixActionInsertFactBindings(model.rhs);
StringBuilder buf = new StringBuilder();
this.marshalPackageHeader(model,
buf);
this.marshalRuleHeader(model,
buf);
this.marshalMetadata(buf,
model);
this.marshalAttributes(buf,
model);
buf.append("\twhen\n");
this.marshalLHS(buf,
model,
isDSLEnhanced,
new LHSGeneratorContextFactory());
buf.append("\tthen\n");
this.marshalRHS(buf,
model,
isDSLEnhanced,
new RHSGeneratorContextFactory());
this.marshalFooter(buf);
return buf.toString();
}