Decision Center API

ilog.rules.webui
Class IlrWBRLSyntacticRuleElement

java.lang.Object
  extended by ilog.rules.teamserver.common.IlrBRLParseableRuleElement
      extended by ilog.rules.webui.IlrWBRLSyntacticRuleElement
All Implemented Interfaces:
ilog.rules.brl.IlrBRLElement, ilog.rules.brl.IlrBRLParserInput, ilog.rules.brl.IlrBRLRuleElement, ilog.rules.brl.IlrMutableBRLElement, ilog.rules.brl.IlrMutableBRLRuleElement, ilog.rules.brl.tokenmodel.TokenModelListener, Serializable, EventListener

public class IlrWBRLSyntacticRuleElement
extends ilog.rules.teamserver.common.IlrBRLParseableRuleElement
implements ilog.rules.brl.tokenmodel.TokenModelListener

IlrWBRLSyntacticRuleElement is an implementation of a BRL rule element to be used in conjunction with the web syntactic editor.

Overview

An IlrWBRLSyntacticRuleElement instance is initialized with a:

You must then set either the definition or the syntax tree. If you provide the definition, the syntax tree is automatically computed. If you provide the syntax tree, the definition is automatically generated.

IlrWBRLSyntacticRuleElement offers some convenience methods that you convert the rule to a given locale. You can:

Code example

The following code example shows you how to return the HTML definition of a rule element:

 private static String getHTMLDefinition(IlrBusinessRule element) throws IlrApplicationException {
        IlrWBRLSyntacticRuleElement ruleElement = getRuleElement(element.getSession(), (IlrActionRule) element);
        if (ruleElement != null) {
                return ruleElement.getHTMLText(element.getSession().getUserLocale());
        }
        return "";
 }
 

See Also:
IlrWSyntacticEditor.setBRLRuleElement(IlrWBRLSyntacticRuleElement, java.util.Locale), IlrDTWTableComponent, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class ilog.rules.teamserver.common.IlrBRLParseableRuleElement
ilog.rules.teamserver.common.IlrBRLParseableRuleElement.NoVocabularyException, ilog.rules.teamserver.common.IlrBRLParseableRuleElement.ParserConfiguration
 
Constructor Summary
IlrWBRLSyntacticRuleElement(ilog.rules.vocabulary.model.IlrVocabularyManager vocabularyManager, ilog.rules.brl.brldf.IlrBRLVariableProvider variableProvider, String languageDefinitionPath, Locale locale)
          Constructs a new syntactic rule element.
 
Method Summary
 void convert(Locale targetLocale, boolean throwSentenceException)
          Convert this rule element to the given target locale.
 String getDefinition()
           
 String getHTMLText(Locale targetLocale)
          Gets the HTML definition of this rule in the given locale.
 ilog.rules.brl.syntaxtree.IlrSyntaxTree getSyntaxTree()
           
static List parseTemplateInfo(String templateInfo)
          Parses the template info string and returns a list of template info.
 void setDefinition(String definition)
           
 void setSyntaxTree(ilog.rules.brl.syntaxtree.IlrSyntaxTree syntaxTree)
           
 void tokenAdded(ilog.rules.brl.tokenmodel.TokenAddedEvent event)
           
 void tokenChanged(ilog.rules.brl.tokenmodel.TokenChangedEvent event)
           
 void tokenRemoved(ilog.rules.brl.tokenmodel.TokenRemovedEvent event)
           
 
Methods inherited from class ilog.rules.teamserver.common.IlrBRLParseableRuleElement
clearParserManager, convert, forceSemanticParser, getBRLParserManager, getCategoryFilter, getDefinition, getDefinitionField, getDefinitionInfo, getDocumentation, getElement, getLanguageDefinition, getLanguageDefinition, getLanguageDefinitionPathField, getLocale, getName, getPackageName, getParser, getParsingErrors, getParsingErrorsField, getPropertyValue, getRootFilter, getRootName, getSyntaxTreeField, getTemplateConsistencyErrors, getTemplateInfo, getTemplateInfoField, getTranslationProperties, getVariableProviderField, getVocabulary, getVocabularyManagerField, hasParsingErrors, isTemplate, parse, setCategoryFilter, setDefinitionfield, setDefinitionInfo, setDocumentation, setElement, setLanguageDefinition, setLanguageDefinitionPathField, setName, setPackageName, setParsingErrorsField, setPropertyValue, setRootFilter, setRootName, setSyntaxTreeField, setTemplate, setTemplateAST, setTemplateInfo, setTemplateInfoField, setTranslationProperties, templateInfoToString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlrWBRLSyntacticRuleElement

public IlrWBRLSyntacticRuleElement(ilog.rules.vocabulary.model.IlrVocabularyManager vocabularyManager,
                                   ilog.rules.brl.brldf.IlrBRLVariableProvider variableProvider,
                                   String languageDefinitionPath,
                                   Locale locale)
Constructs a new syntactic rule element.

Parameters:
vocabularyManager - The vocabulary manager to be used for this rule.
variableProvider - The variable provider to be used for this rule.
languageDefinitionPath - The path of the language definition, for instance "ilog/rules/brl/bal60/bal".
locale - The locale of the rule to be edited.
Method Detail

getDefinition

public String getDefinition()
Specified by:
getDefinition in interface ilog.rules.brl.IlrBRLParserInput
Overrides:
getDefinition in class ilog.rules.teamserver.common.IlrBRLParseableRuleElement

setDefinition

public void setDefinition(String definition)
Specified by:
setDefinition in interface ilog.rules.brl.IlrMutableBRLRuleElement
Overrides:
setDefinition in class ilog.rules.teamserver.common.IlrBRLParseableRuleElement

setSyntaxTree

public void setSyntaxTree(ilog.rules.brl.syntaxtree.IlrSyntaxTree syntaxTree)
Specified by:
setSyntaxTree in interface ilog.rules.brl.IlrMutableBRLRuleElement
Overrides:
setSyntaxTree in class ilog.rules.teamserver.common.IlrBRLParseableRuleElement

getSyntaxTree

public ilog.rules.brl.syntaxtree.IlrSyntaxTree getSyntaxTree()
Specified by:
getSyntaxTree in interface ilog.rules.brl.IlrBRLRuleElement
Overrides:
getSyntaxTree in class ilog.rules.teamserver.common.IlrBRLParseableRuleElement

getHTMLText

public String getHTMLText(Locale targetLocale)
Gets the HTML definition of this rule in the given locale. As opposed to convert(Locale), this method does not convert the inner implementation of the rule element.

Overrides:
getHTMLText in class ilog.rules.teamserver.common.IlrBRLParseableRuleElement
Parameters:
targetLocale - the target locale
Returns:
the HTML definition of the rule, in the given locale.

tokenChanged

public void tokenChanged(ilog.rules.brl.tokenmodel.TokenChangedEvent event)
Specified by:
tokenChanged in interface ilog.rules.brl.tokenmodel.TokenModelListener

tokenAdded

public void tokenAdded(ilog.rules.brl.tokenmodel.TokenAddedEvent event)
Specified by:
tokenAdded in interface ilog.rules.brl.tokenmodel.TokenModelListener

tokenRemoved

public void tokenRemoved(ilog.rules.brl.tokenmodel.TokenRemovedEvent event)
Specified by:
tokenRemoved in interface ilog.rules.brl.tokenmodel.TokenModelListener

convert

public void convert(Locale targetLocale,
                    boolean throwSentenceException)
Convert this rule element to the given target locale. This will convert the definition and the syntax tree associated to this rule element.

Overrides:
convert in class ilog.rules.teamserver.common.IlrBRLParseableRuleElement
Parameters:
targetLocale - the target locale.

parseTemplateInfo

public static List parseTemplateInfo(String templateInfo)
Parses the template info string and returns a list of template info.

Parameters:
templateInfo - the template info as a string, as it comes from the database
Returns:
the list of template info

Decision Center API

© Copyright IBM Corp. 1987, 2013