Drools Workbench - Common Model 6.1.0.Beta3

org.drools.workbench.models.commons.backend.rule
Class RuleModelDRLPersistenceImpl

java.lang.Object
  extended by org.drools.workbench.models.commons.backend.rule.RuleModelDRLPersistenceImpl
All Implemented Interfaces:
RuleModelPersistence

public class RuleModelDRLPersistenceImpl
extends Object
implements RuleModelPersistence

This class persists the rule model to DRL and back


Nested Class Summary
static class RuleModelDRLPersistenceImpl.LHSPatternVisitor
           
static class RuleModelDRLPersistenceImpl.RHSActionVisitor
           
static class RuleModelDRLPersistenceImpl.RHSClassDependencyVisitor
           
 
Field Summary
protected  Map<String,FieldConstraint> bindingsFields
           
protected  Map<String,IFactPattern> bindingsPatterns
           
protected  DRLConstraintValueBuilder constraintValueBuilder
           
static String DEFAULT_DIALECT
           
 
Constructor Summary
protected RuleModelDRLPersistenceImpl()
           
 
Method Summary
protected  void fixActionInsertFactBindings(IAction[] rhs)
           
static RuleModelPersistence getInstance()
           
protected  RuleModelDRLPersistenceImpl.LHSPatternVisitor getLHSPatternVisitor(boolean isDSLEnhanced, StringBuilder buf, String nestedIndentation, boolean isNegated, GeneratorContextFactory generatorContextFactory)
           
protected  RuleModelDRLPersistenceImpl.RHSActionVisitor getRHSActionVisitor(boolean isDSLEnhanced, StringBuilder buf, String indentation)
           
 String marshal(RuleModel model)
           
protected  void marshalAttributes(StringBuilder buf, RuleModel model)
          Marshal model attributes
protected  void marshalFooter(StringBuilder buf)
           
protected  void marshalLHS(StringBuilder buf, RuleModel model, boolean isDSLEnhanced, GeneratorContextFactory generatorContextFactory)
          Marshal LHS patterns
protected  void marshalMetadata(StringBuilder buf, RuleModel model)
          Marshal model metadata
protected  void marshalPackageHeader(RuleModel model, StringBuilder buf)
           
protected  void marshalRHS(StringBuilder buf, RuleModel model, boolean isDSLEnhanced)
           
protected  String marshalRule(RuleModel model)
           
protected  void marshalRuleHeader(RuleModel model, StringBuilder buf)
           
protected  String marshalRuleName(RuleModel model)
           
 RuleModel unmarshal(String str, List<String> globals, PackageDataModelOracle dmo)
           
 RuleModel unmarshalUsingDSL(String str, List<String> globals, PackageDataModelOracle dmo, String... dsls)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DIALECT

public static final String DEFAULT_DIALECT
See Also:
Constant Field Values

constraintValueBuilder

protected DRLConstraintValueBuilder constraintValueBuilder

bindingsPatterns

protected Map<String,IFactPattern> bindingsPatterns

bindingsFields

protected Map<String,FieldConstraint> bindingsFields
Constructor Detail

RuleModelDRLPersistenceImpl

protected RuleModelDRLPersistenceImpl()
Method Detail

getInstance

public static RuleModelPersistence getInstance()

marshal

public String marshal(RuleModel model)
Specified by:
marshal in interface RuleModelPersistence

marshalRule

protected String marshalRule(RuleModel model)

fixActionInsertFactBindings

protected void fixActionInsertFactBindings(IAction[] rhs)

marshalFooter

protected void marshalFooter(StringBuilder buf)

marshalPackageHeader

protected void marshalPackageHeader(RuleModel model,
                                    StringBuilder buf)

marshalRuleHeader

protected void marshalRuleHeader(RuleModel model,
                                 StringBuilder buf)

marshalRuleName

protected String marshalRuleName(RuleModel model)

marshalAttributes

protected void marshalAttributes(StringBuilder buf,
                                 RuleModel model)
Marshal model attributes

Parameters:
buf -
model -

marshalMetadata

protected void marshalMetadata(StringBuilder buf,
                               RuleModel model)
Marshal model metadata

Parameters:
buf -
model -

marshalLHS

protected void marshalLHS(StringBuilder buf,
                          RuleModel model,
                          boolean isDSLEnhanced,
                          GeneratorContextFactory generatorContextFactory)
Marshal LHS patterns

Parameters:
buf -
model -

getLHSPatternVisitor

protected RuleModelDRLPersistenceImpl.LHSPatternVisitor getLHSPatternVisitor(boolean isDSLEnhanced,
                                                                             StringBuilder buf,
                                                                             String nestedIndentation,
                                                                             boolean isNegated,
                                                                             GeneratorContextFactory generatorContextFactory)

marshalRHS

protected void marshalRHS(StringBuilder buf,
                          RuleModel model,
                          boolean isDSLEnhanced)

getRHSActionVisitor

protected RuleModelDRLPersistenceImpl.RHSActionVisitor getRHSActionVisitor(boolean isDSLEnhanced,
                                                                           StringBuilder buf,
                                                                           String indentation)

unmarshal

public RuleModel unmarshal(String str,
                           List<String> globals,
                           PackageDataModelOracle dmo)
Specified by:
unmarshal in interface RuleModelPersistence
See Also:
RuleModelPersistence.unmarshal(String, List, PackageDataModelOracle)

unmarshalUsingDSL

public RuleModel unmarshalUsingDSL(String str,
                                   List<String> globals,
                                   PackageDataModelOracle dmo,
                                   String... dsls)
Specified by:
unmarshalUsingDSL in interface RuleModelPersistence

Drools Workbench - Common Model 6.1.0.Beta3

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.