public interface FirstUseAssembler
FirstUseAssembler
interface defines a toolkit for
use by implementations of the JavaGenerator
interface. A
distinct instance of FirstUseAssembler
is associated with each
instance of JavaGenerator
when it is instantiated. This
instance provides the information needed to drive the Java generation,
support facilities to standardize and simplify some common processing, and
a repository to receive the resulting generated code.
addCode
methods. The support code buffer,
accessed using the addToSupport
methods, is for complete Java
declarations -- methods, inner classes, class and instance variables -- used
to facilitate the direct processing added to the primary code buffer.
FirstUseAssembler
maintains two lists of rules. The first is the list of rule dependencies.
When a Java implementation is generated for a rule, PegaRULES remembers the list
of rule dependencies for that rule. Whenever any rule on that list changes,
the generated rule is invalidated.
The second list is the list of used rules. This list contains the keys and update date/time of every rule which is used to generate a rule. This list is used to help PegaRULES determine whether users with different ruleset lists can share the same Java implementation of a rule.
Most often, these two lists contain the same rules. A rule is usually added to
one or both of these lists with the noteInstanceUsed(com.pega.pegarules.pub.util.StringMap, com.pega.pegarules.pub.generator.PageDescriptor)
method, though
other methods might also add rules to the lists.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT |
static java.lang.String |
VERSION |
Modifier and Type | Method and Description |
---|---|
void |
addCode(ExpressionMap aKeys)
Deprecated.
this method may be used only if the rule in question has a single
aspect defined. It it has more than one, then an error will occur. Use
addCode(ExpressionMap, String) instead. |
void |
addCode(ExpressionMap aKeys,
java.lang.String aAspect)
Adds execution of the specified Rule- reference for the specified aspect
to the primary code buffer.
|
void |
addCode(ExpressionMap aKeys,
java.lang.String aAspect,
PageDescriptor aPageDesc)
Adds execution of the specified Rule- reference for the specified aspect
to the primary code buffer.
|
java.lang.StringBuffer |
addCode(java.lang.String aCode)
Adds specified code fragment to primary buffer.
|
boolean |
addErrorMessages(ClipboardProperty aProp,
CodeGenerator aGenCode)
Checks for error messages in
aGenCode and adds them
to aProp |
void |
addImport(java.lang.String aImport)
Add to the set of import statements required for the generated Java.
|
void |
addKnownPageDescriptor(java.lang.String aPageName,
java.lang.String aClassName)
Add a page to the "known page" list so that subsequent processing
will be able to identify the class of a page created by Page-New,
Obj-Open, etc.
|
IMethod |
addMethod(java.lang.String aProposedName)
Begin construction of a generated method.
|
void |
addToSupport(ExpressionMap aKeys)
Deprecated.
this method may be used only if the rule in question has a single
aspect defined. It it has more than one, then an error will occur. Use
addToSupport(ExpressionMap, String) instead. |
void |
addToSupport(ExpressionMap aKeys,
java.lang.String aAspect)
Adds execution of the specified Rule- reference for the specified aspect
to the support code buffer.
|
java.lang.StringBuffer |
addToSupport(java.lang.String aCode)
Adds specified code fragment to support-code buffer.
|
boolean |
checkModelInstance(java.lang.String aStepPPageClass,
java.lang.String aPPageClass,
java.lang.String aModelName,
ClipboardProperty aModelRef)
Validates that the specified model exists and is accessible to the user's
context.
|
boolean |
checkWhenInstance(java.lang.String aStepPPageClass,
java.lang.String aPPageClass,
java.lang.String aWhenName,
ClipboardProperty aWhenRef)
Validates that the specified when block exists and is accessible to the user's
context.
|
IGeneratedMethod |
createMethod(java.lang.String aProposedName,
boolean aCaptureAddCode)
Begin construction of a generated method.
|
IGeneratedMethod |
createMethod(java.lang.String aProposedName,
boolean aCaptureAddCode,
java.lang.String aInsKey)
Begin construction of a generated method.
|
PageDescriptor |
createPageDescriptor(java.lang.String aPageName,
java.lang.String aClassName,
boolean aIsExact,
boolean aIsParameter)
Create a
PageDescriptor . |
PageDescriptor |
createPageDescriptor(java.lang.String aPageName,
java.lang.String aClassName,
boolean aIsExact,
boolean aIsParameter,
boolean aIsPrimaryPageForAssembly)
Create a
PageDescriptor . |
ICodeBuffer |
decreaseIndent()
Decreases the indentation level by one.
|
ICodeBuffer |
decreaseIndent(int aLevels)
Decreases the indentation level.
|
ICodeBuffer |
decreaseIndentAS()
Decreases the indentation level by one for "appendString" content.
|
ICodeBuffer |
decreaseIndentAS(int aLevels)
Decreases the indentation level for "appendString" content.
|
ICodeBuffer |
emit(java.lang.String aContent)
Adds specified content fragment to primary buffer.
|
ICodeBuffer |
emitAS(java.lang.String aContent)
Accumulates the specified content which will be added to the primary
buffer at the end of sequence of "emitAS*" method calls as the parameter
to the "tools.appendString()" method.
|
ICodeBuffer |
emitASconst(java.lang.String aContent)
Accumulates the specified content which will be added to the primary
buffer at the end of sequence of "emitAS*" method calls as the parameter
to the "tools.appendString()" method.
|
ICodeBuffer |
emitASconstln(java.lang.String aContent)
Accumulates the specified content which will be added to the primary
buffer at the end of sequence of "emitAS*" method calls as the parameter
to the "tools.appendString()" method.
|
ICodeBuffer |
emitAScsf(java.lang.String aContent)
Accumulates the specified content which will be added to the primary
buffer at the end of sequence of "emitAS*" method calls as the parameter
to the "tools.appendString()" method.
|
ICodeBuffer |
emitASln(java.lang.String aContent)
Accumulates the specified content which will be added to the primary
buffer at the end of sequence of "emitAS*" method calls as the parameter
to the "tools.appendString()" method.
|
ICodeBuffer |
emitASraw(java.lang.String aContent)
Accumulates the specified content which will be added to the primary
buffer at the end of sequence of "emitAS*" method calls as the parameter
to the "tools.appendString()" method.
|
ICodeBuffer |
emitCSF(java.lang.String aContent)
Adds specified content fragment to primary buffer after processing it
through StringUtils.crossScriptingFilter.
|
ICodeBuffer |
emitCSFln(java.lang.String aContent)
Adds specified content fragment to primary buffer after processing it
through StringUtils.crossScriptingFilter and then appends a newline character.
|
ICodeBuffer |
emitEscaped(java.lang.String aContent)
Adds specified content fragment to primary buffer after processing it
through StringUtils.escapeIntoJavaString.
|
ICodeBuffer |
emitEscapedln(java.lang.String aContent)
Adds specified content fragment to primary buffer after processing it
through StringUtils.escapeIntoJavaString and then appends a newline character.
|
ICodeBuffer |
emitln(java.lang.String aContent)
Adds specified content fragment to primary buffer followed by a
newline character.
|
void |
focusOnSupport()
Adjusts the code buffers to make the current support buffer primary and
provide a new support buffer.
|
java.lang.String |
generateJavaForPropertySet(ClipboardProperty aLHS,
ClipboardProperty aRHS)
Generates code for a property set.
|
java.lang.String[] |
generateStepPageReference(ClipboardProperty theProp,
java.lang.String aVarName,
boolean aIfPresent)
Creates a reference to the current step page.
|
CodeGenerator |
getBooleanCodeGenerator()
Accessor for the expected type Boolean instance.
|
CodeGenerator |
getBooleanWithVariableCodeGenerator()
Accessor for the expected type Boolean with intermediate variable instance.
|
GenericAssembler |
getBuilder()
Identifies the rule assembler that is being used during this assembly.
|
FirstUseAssembler |
getCaller()
Identifies the
FirstUseAssembler instance assocaited with
the Rule- that referenced this Rule-. |
java.lang.String |
getClassForPage(java.lang.String aPage,
boolean aIsPrimaryReference)
Gets the class for a specified page, if known.
|
CodeGenerator |
getCodeGenerator()
Provides an instance of CodeGenerator that may be used to specify the
requried return type of an expression
|
CodeGenerator |
getCodeGeneratorInstance()
Returns a newly constructed instance of
CodeGenerator |
Database |
getDatabase()
Provides access to the appropriate
Database instance for
this execution context. |
ClipboardPage |
getDefinition()
Supplies the definition being processed.
|
Dictionary |
getDictionary()
Provides access to the appropriate
Dictionary instance for
this execution context and edit/runtime processing mode. |
RulesetContext |
getEditContext()
Supplies the
RulesetContext that corresponds to the
design time environment for the Rule instance being assembled. |
java.lang.String |
getIdentification()
Provides a string value that can be used in message descriptors to
identify the Rule- reference of this instance.
|
boolean |
getInThunkGeneration()
return the state of virtual rule generation to disable inlining
|
JavaGenerator |
getJavaBuilder()
Identifies the rule assembler that is being used during this assembly.
|
CodeGenerator |
getJavaForExpression(java.lang.String aExpression,
ClipboardProperty aProp,
CodeGenerator aExpectedType,
boolean aProcessBlank)
Adds execution logic for the expression to the primary and support buffers,
and provides an instance of CodeGenerator from which one can retrieve
a reference to the value of the expression via getTertiary().
|
CodeGenerator |
getJavaForExpression(java.lang.String aExpression,
ClipboardProperty aProp,
CodeGenerator aExpectedType,
boolean aProcessBlank,
boolean aSupportLinkedReference)
Adds execution logic for the expression to the primary and support buffers,
and provides an instance of CodeGenerator from which one can retrieve
a reference to the value of the expression via getTertiary().
|
java.lang.String |
getJavaName()
Provides a string value that is the name of the Java class assigned
by First Use Assembly for this Rule instance.
|
java.lang.String |
getJavaTypeForPegaType(char aPegaType)
Returns the "preferred" Java type for the specified PegaRULES data type
|
StringMap |
getKeys()
Identifies the key information for this instance.
|
ClipboardProperty |
getLocalParameters()
Supplies the LocalParameters property for this definition, for use
by expression parsing and reference resolution interfaces.
|
java.lang.String |
getMethodName()
Provide unique mnemonic name to
mBuilder.methodAccess method
for a local implementation of this Rule- that can be reused within this
implementation class. |
java.lang.String |
getMethodNameForKey(java.lang.String aInsKey)
Return the method name which has been generated for this pzInsKey, or
null
if no such method has been generated yet. |
PageDescriptor |
getPageDescriptor(java.lang.String aPageName,
boolean aFlagMissing)
Provides the information known about the named page.
|
ClipboardProperty |
getParameters()
Supplies the Parameters property for this definition, for use
by expression parsing and reference resolution interfaces.
|
PageDescriptor |
getPrimaryDescriptor()
Provides the information known about the current Primary Page.
|
ClipboardPage |
getRuleBasis()
Supplies the basis, if any, for the Rule- instance being edited.
|
PageDescriptor |
getStepPage()
Provides the information known about the current Step Page.
|
CodeGenerator |
getStringCodeGenerator()
Accessor for the expected type String instance.
|
CodeGenerator |
getStringWithVariableCodeGenerator()
Accessor for the expected type String with intermediate variable instance.
|
PRThread |
getThread()
Provides access to the appropriate
PRThread instance for
this execution context. |
java.lang.String |
getUniqueID(java.lang.String aPrefix)
Identifies a unique Java identifier, using a specified prefix.
|
java.util.List |
getWhenChangeDeclarativeReferences()
Gets the list of RHS property references for change tracking.
|
java.util.List |
getWillChangeDeclarativeReferences()
Gets the list of LHS property references for change tracking.
|
boolean |
haveRuleBasis()
Indicates whether this Rule- instance has a basis instance.
|
ICodeBuffer |
increaseIndent()
Increases the indentation level by one.
|
ICodeBuffer |
increaseIndent(int aLevels)
Increases the indentation level.
|
ICodeBuffer |
increaseIndentAS()
Increases the indentation level by one for "appendString" content.
|
ICodeBuffer |
increaseIndentAS(int aLevels)
Increases the indentation level for "appendString" content.
|
boolean |
isDeclarativeInvoked()
Is this rule type called by declarative rules?
|
boolean |
isDeclarativeRule()
Is this rule type used for declarative processing?
|
boolean |
isEditing()
Identifies whether the current processing is for design-time editing of
an instance defined for First-Use Assembly.
|
boolean |
isEmbedded()
Identifies whether this definition is being referenced within the
First-Use Assembly of another definition.
|
boolean |
isMyStepPageChecked()
Gets the flag to check for null myStepPage
|
boolean |
isPrimary()
Identifies whether this is the originating reference to First-Use
Assembly, defining the top-level processing of the desired
GeneratedJava instance. |
boolean |
isRuntime()
Identifies whether the current processing is assembling Java for runtime
execution.
|
StringExpression |
newStringExpression()
Provides a new
StringExpression instance, initially
representing an empty String . |
StringExpression |
newStringExpression(java.lang.String aInitial,
boolean aIsLiteral)
Provides a new
StringExpression instance, initially
representing a value specified by either a String literal
or a String -valued Java expression. |
StringExpression |
newStringExpression(StringExpression aOriginal)
Provides a new
StringExpression instance, initially
representing a copy of the argument instance. |
boolean |
noInlining() |
void |
noteClassDependence(java.lang.String aClassName)
Includes the specified class among those that might affect the
generated Java.
|
void |
noteInstanceUsed(StringMap aKeys)
Adds the specified instance to the list of rule dependencies, and
optionally to the list of used rules.
|
void |
noteInstanceUsed(StringMap aKeys,
PageDescriptor pageDesc)
Adds the specified instance to the list of rule dependencies, and
optionally to the list of used rules.
|
void |
notePropertyUsed(java.lang.String aClassName,
java.lang.String aPropertyName)
Deprecated.
Instead use: notePropertyUsed(String aClassName, String aPropertyName, PageDescriptor aPageDesc).
|
void |
notePropertyUsed(java.lang.String aClassName,
java.lang.String aPropertyName,
PageDescriptor aPageDesc)
Includes the specified Rule-Obj-Property instance among those that might affect
the generated Java.
|
ClipboardPage |
openRule(StringMap aKeyPage,
boolean aForceDBOpen)
Opens the specified database instance, using either the RulesetContext
(at design time) or Database (at runtime) so that referenced rule tracking
is properly performed.
|
void |
popStepPage()
Unwinds one call to
pushStepPage . |
java.lang.String |
preprocessExpression(java.lang.String aExpression)
Applies pre-processing heuristics to the specified expression and modifies the expression
if required to a form that can be consumed by the expression parsing framework.
|
java.lang.String |
preprocessExpression(java.lang.String expression,
CodeGenerator aExpectedTypeInfo,
java.util.List aErrorList)
Method preProcess would validate the coming expression.
|
void |
pushStepPage(java.lang.String aPageName,
boolean aNewPrimary)
Establishes information about a new Step Page (which might also
be a new Primary Page), based on the name of the page.
|
void |
pushStepPage(java.lang.String aPageName,
java.lang.String aClassName,
boolean aIsExact,
boolean aNewPrimary)
Establishes information about a new Step Page (which might also
be a new Primary Page), based on information known about the class
of the page.
|
void |
resetDefaultDefinition()
Restores the original definition(s) (and clears temp containers) being processed.
|
void |
restoreFocus()
Restores the current primary code buffer to its previous role as support
buffer.
|
void |
setCurrentRepeatType(java.lang.String currentRepeatType) |
void |
setDeclarativeInvoked(boolean aIsDeclarativeInvoked)
Instruct the parser to treat this rule type as a declarative rule.
|
void |
setDeclarativeRule(boolean aIsDeclarativeRule)
Instruct the parser to treat this rule type as a declarative rule.
|
ICodeBuffer |
setIndentContent(java.lang.String aIndentContent)
Sets the desired String to use for each indentation level.
|
ICodeBuffer |
setIndentContentAS(java.lang.String aIndentContent)
Sets the desired String to use for each indentation level for "appendString"
content.
|
ICodeBuffer |
setIndentLevel(int aLevel)
Sets the desired indentation level (e.g.
|
ICodeBuffer |
setIndentLevelAS(int aLevel)
Sets the desired indentation level (e.g.
|
void |
setMyStepPageChecked(boolean aMyStepPageChecked)
Sets the flag to check for null myStepPage
|
void |
setOverrideDefinition(ClipboardPage aDef)
Overrides the definition being processed, original definitions are saved for
resetDefaultDefinition() . |
void |
setWhenChangeDeclarativeReferences(java.util.List aWhenChangeRefs)
Sets the list of RHS property references for change tracking.
|
void |
setWillChangeDeclarativeReferences(java.util.List aWillChangeRefs)
Sets the list of LHS property references for change tracking.
|
void |
summarizeGeneratedMethods(java.lang.String aIdentifier)
Outputs summary information about the methods generated and the number
of times that each method has been (re-)used during this assembly.
|
java.lang.String |
translateCodeBlock(java.lang.String aCodeBlock,
java.util.Map<java.lang.String,ClipboardPage> actionPagesForErrorMessages,
boolean aSupportLinkedReference,
java.util.List<java.lang.String> aErrorList)
Translates a block of statements for a single rule as a unit.
|
java.lang.Object |
translateExpression(java.lang.String aExpression,
ClipboardProperty aProp,
CodeGenerator aExpectedType) |
CodeGenerator |
translateExpression(java.lang.String aExpression,
ClipboardProperty aProp,
CodeGenerator aExpectedType,
boolean aProcessBlank)
Provides execution logic for the expression and returns an instance of a
CodeGenerator from which one can retrieve the assembled Java (via
CodeGenerator.getPrimary() and
CodeGenerator.getSecondary() ) and a reference to the value of
the expression (via CodeGenerator.getTertiary() ). |
CodeGenerator |
translateExpression(java.lang.String aExpression,
ClipboardProperty aProp,
CodeGenerator aExpectedType,
boolean aProcessBlank,
boolean aSupportLinkedReference) |
static final java.lang.String VERSION
static final java.lang.String COPYRIGHT
boolean isRuntime()
true
when Java is being assembled for runtime
execution; false
when Java is being assembled for a
compilation test at design timeboolean getInThunkGeneration()
true
if inlining should be suppressedboolean isEditing()
true
when Java is being assembled for a compilation
test at design time; false
when Java is being assembled for
runtime executionboolean isPrimary()
GeneratedJava
instance.true
if this is the originating reference to
First-Use Assembly; false
if this definition is referenced
within anotherboolean isEmbedded()
true
if this definition is referenced within
another; false
if this is the originating reference to
First-Use AssemblyGenericAssembler getBuilder()
JavaGenerator getJavaBuilder()
FirstUseAssembler getCaller()
FirstUseAssembler
instance assocaited with
the Rule- that referenced this Rule-.FirstUseAssembler
; or
null
when isPrimary
returns true
Database getDatabase()
Database
instance for
this execution context.Database
instanceDictionary getDictionary()
Dictionary
instance for
this execution context and edit/runtime processing mode.Dictionary
instancePRThread getThread()
PRThread
instance for
this execution context.PRThread
instanceStringMap getKeys()
isEditing
returns true
, the object returned
might be the ClipboardPage
instance being edited.StringMap
of key values that indentify this instancejava.lang.String getIdentification()
StringMap
specification.java.lang.String getJavaName()
CodeGenerator getCodeGenerator()
java.lang.String getJavaTypeForPegaType(char aPegaType)
aPegaType
- PropertyInfo.TYPE_* codeClipboardPage getDefinition()
void setOverrideDefinition(ClipboardPage aDef)
resetDefaultDefinition()
.
If called more than once (without calling resetDefaultDefinition()
) the old overrides are lost.aDef
- definition to using from now on.void resetDefaultDefinition()
setOverrideDefinition(ClipboardPage)
was called.ClipboardProperty getLocalParameters()
ClipboardProperty
of mode PageList and
class Embed-MethodParams or null
if no such property exists.ClipboardProperty getParameters()
ClipboardProperty
of mode PageList and
class Embed-MethodParams or null
if no such property exists.java.lang.String getMethodName()
mBuilder.methodAccess
method
for a local implementation of this Rule- that can be reused within this
implementation class.java.lang.String getUniqueID(java.lang.String aPrefix)
aPrefix
- suggested prefix for the Java class namevoid addImport(java.lang.String aImport)
aImport
- fully-qualified class name, or fully-qualified package
name that ends with ".*" or "."void noteClassDependence(java.lang.String aClassName)
aClassName
- identifies teh name of the classvoid noteInstanceUsed(StringMap aKeys, PageDescriptor pageDesc)
The aKeys
parameter identifies the instance. It must contain
the pxObjClass
and the key property values for the rule to
be added.
The rule identified by aKeys
is always added to the list of
rule dependencies.
The aKeys
map may also contain the instance's
pzInsKey
, pxUpdateDateTime
, and
pyRuleSet
properties. Iff these are included, then the rule
is added to list of used rules (as well as the rule dependency list).
aKeys
- identifies at least the key properties of the instance to be
includedpageDesc
- a page descriptorvoid noteInstanceUsed(StringMap aKeys)
The aKeys
parameter identifies the instance. It must contain
the pxObjClass
and the key property values for the rule to
be added.
The rule identified by aKeys
is always added to the list of
rule dependencies.
The aKeys
map may also contain the instance's
pzInsKey
, pxUpdateDateTime
, and
pyRuleSet
properties. Iff these are included, then the rule
is added to list of used rules (as well as the rule dependency list).
aKeys
- identifies at least the key properties of the instance to be
includedvoid notePropertyUsed(java.lang.String aClassName, java.lang.String aPropertyName)
aClassName
- pyClassName of the propertyaPropertyName
- pyPropertyName of the propertyvoid notePropertyUsed(java.lang.String aClassName, java.lang.String aPropertyName, PageDescriptor aPageDesc)
aClassName
- pyClassName of the propertyaPropertyName
- pyPropertyName of the propertyaPageDesc
- a page descriptorjava.lang.StringBuffer addCode(java.lang.String aCode)
aCode
- code fragment to addjava.lang.StringBuffer addToSupport(java.lang.String aCode)
aCode
- code fragment to addvoid addCode(ExpressionMap aKeys) throws FirstUseAssemblerException
addCode(ExpressionMap, String)
instead.isEditing
returns true
, then the
execution will be provided by a call to a separately assembled
implementation class. Otherwise, the JavaGenerator
for the
referenced Rule- class will determine whether the implementation is
incorporated into the implementation class being assembled.aKeys
- Map
of named Expression
s
identifying the referenced Rule-. A
StringExpression
with a literal value (isLiteral
returns true
) must be specified for
"pxObjClass"
. Any other key-property or
parameter values needed to identify and execute the referenced
Rule- must also be provided, but need not have literal values.FirstUseAssemblerException
- if unable to establish the indicated executionvoid addCode(ExpressionMap aKeys, java.lang.String aAspect) throws FirstUseAssemblerException
isEditing
returns
true
, then the execution will be provided by a call to a
separately assembled implementation class. Otherwise, the
JavaGenerator
for the referenced Rule- class will
determine whether the implementation is incorporated into the
implementation class being assembled.aKeys
- Map
of named Expression
s
identifying the referenced Rule-. A
StringExpression
with a literal value (isLiteral
returns true
) must be specified for
"pxObjClass"
. Any other key-property or
parameter values needed to identify and execute the referenced
Rule- must also be provided, but need not have literal values.aAspect
- the aspectFirstUseAssemblerException
- if unable to establish the indicated executionvoid addCode(ExpressionMap aKeys, java.lang.String aAspect, PageDescriptor aPageDesc) throws FirstUseAssemblerException
isEditing
returns
true
, then the execution will be provided by a call to a
separately assembled implementation class. Otherwise, the
JavaGenerator
for the referenced Rule- class will
determine whether the implementation is incorporated into the
implementation class being assembled.aKeys
- Map
of named Expression
s
identifying the referenced Rule-. A
StringExpression
with a literal value (isLiteral
returns true
) must be specified for
"pxObjClass"
. Any other key-property or
parameter values needed to identify and execute the referenced
Rule- must also be provided, but need not have literal values.aAspect
- the aspectaPageDesc
- the PageDescriptor
representing the class these rules are assembled againstFirstUseAssemblerException
- if unable to establish the indicated executionvoid addToSupport(ExpressionMap aKeys) throws FirstUseAssemblerException
addToSupport(ExpressionMap, String)
instead.isEditing
returns true
, then the
execution will be provided by a call to a separately assembled
implementation class. Otherwise, the JavaGenerator
for the
referenced Rule- class will determine whether the implementation is
incorporated into the implementation class being assembled.aKeys
- Map
of named Expression
s
identifying the referenced Rule-. A
StringExpression
with a literal value (isLiteral
returns true
) must be specified for
"pxObjClass"
. Any other key-property or
parameter values needed to identify and execute the referenced
Rule- must also be provided, but need not have literal values.FirstUseAssemblerException
- if unable to establish the indicated executionvoid addToSupport(ExpressionMap aKeys, java.lang.String aAspect) throws FirstUseAssemblerException
isEditing
returns
true
, then the execution will be provided by a call to a
separately assembled implementation class. Otherwise, the
JavaGenerator
for the referenced Rule- class will
determine whether the implementation is incorporated into the
implementation class being assembled.aKeys
- Map
of named Expression
s
identifying the referenced Rule-. A
StringExpression
with a literal value (isLiteral
returns true
) must be specified for
"pxObjClass"
. Any other key-property or
parameter values needed to identify and execute the referenced
Rule- must also be provided, but need not have literal values.aAspect
- the aspectFirstUseAssemblerException
- if unable to establish the indicated executionCodeGenerator getJavaForExpression(java.lang.String aExpression, ClipboardProperty aProp, CodeGenerator aExpectedType, boolean aProcessBlank)
aExpression
- String containing expression to be parsedaProp
- ClipboardProperty corresponding to the expression passed. If not null
, and the generator encounters a problem generating code for this expression, error messages will be added to this specified property for display.aExpectedType
- CodeGenerator specifying expected type of the expression, or null if unknown.aProcessBlank
- indicates that a blanks expression should be processed
and returned as empty strings.CodeGenerator getJavaForExpression(java.lang.String aExpression, ClipboardProperty aProp, CodeGenerator aExpectedType, boolean aProcessBlank, boolean aSupportLinkedReference)
aExpression
- String containing expression to be parsedaProp
- ClipboardProperty corresponding to the expression passed. If not null
, and the generator encounters a problem generating code for this expression, error messages will be added to this specified property for display.aExpectedType
- CodeGenerator specifying expected type of the expression, or null if unknown.aProcessBlank
- indicates that a blanks expression should be processed
and returned as empty strings.aSupportLinkedReference
- indicates that we should allow a linked reference in this expressionCodeGenerator translateExpression(java.lang.String aExpression, ClipboardProperty aProp, CodeGenerator aExpectedType, boolean aProcessBlank)
CodeGenerator
from which one can retrieve the assembled Java (via
CodeGenerator.getPrimary()
and
CodeGenerator.getSecondary()
) and a reference to the value of
the expression (via CodeGenerator.getTertiary()
). Type
information about the result of the expression is also contained in the
CodeGenerator instance.
This method is intended for use by the "ClipboardPage" interface to FUA.
It returns the translated Java in the CodeGenerator
instance, and it is the responsibility of the caller to move this logic
into the final code buffers if desired.
aExpression
- Expression to be parsed.aProp
- ClipboardProperty corresponding to the expression passed. If
not null
, and the generator encounters a
problem generating code for this expression, error messages
will be added to this specified property for display.aExpectedType
- CodeGenerator specifying expected type of the expression, or
null if unknown.aProcessBlank
- indicates that a blank expression should be processed and
returned as empty strings. If this flag is set to false and a
blank expression is passed, getPrimary()
returns java code that throws an
UnresolvedAssemblyError
if executed at runtime.CodeGenerator
containing result of parsing the
expressionCodeGenerator translateExpression(java.lang.String aExpression, ClipboardProperty aProp, CodeGenerator aExpectedType, boolean aProcessBlank, boolean aSupportLinkedReference)
java.lang.String translateCodeBlock(java.lang.String aCodeBlock, java.util.Map<java.lang.String,ClipboardPage> actionPagesForErrorMessages, boolean aSupportLinkedReference, java.util.List<java.lang.String> aErrorList)
aCodeBlock
- actionPagesForErrorMessages
- aSupportLinkedReference
- aErrorList
- returns errors detectedjava.lang.String preprocessExpression(java.lang.String aExpression)
aExpression
- Expression to be pre-processed.java.lang.String preprocessExpression(java.lang.String expression, CodeGenerator aExpectedTypeInfo, java.util.List aErrorList)
expression
- expression on which to apply heuristicsaExpectedTypeInfo
- optional
information about expected type of resulting expressionaErrorList
- non-null
list into which to place error messagesPageDescriptor getStepPage()
PageDescriptor getPageDescriptor(java.lang.String aPageName, boolean aFlagMissing)
aPageName
- name of the ClipboardPage
aFlagMissing
- true
if a missing page should result in an errorPageDescriptor getPrimaryDescriptor()
void pushStepPage(java.lang.String aPageName, boolean aNewPrimary)
PegaAPI.pushStackFrame
call in the generated Java.aPageName
- name of the new Step PageaNewPrimary
- true
when the new Step Page will
also be the new Primary Pagevoid pushStepPage(java.lang.String aPageName, java.lang.String aClassName, boolean aIsExact, boolean aNewPrimary)
PegaAPI.pushStackFrame
call in the generated Java.aPageName
- aClassName
- specified class of the new Step PageaIsExact
- true
if the actual class of the new Step
Page is known; false
if the actual class of the Step
Page might derive from the specified class nameaNewPrimary
- true
when the new Step Page will
also be the new Primary Pagevoid popStepPage()
pushStepPage
.RulesetContext getEditContext()
RulesetContext
that corresponds to the
design time environment for the Rule instance being assembled.RulesetContext
instance or null
if isRuntime()
is true
.ClipboardPage getRuleBasis()
null
boolean haveRuleBasis()
true
if this instance has a basis instance;
false
if the Rule- instance being edited does not override
another Rule- instance, and also if isEditing
returns
false
or isPrimary
returns false
StringExpression newStringExpression()
StringExpression
instance, initially
representing an empty String
.StringExpression
instanceStringExpression newStringExpression(StringExpression aOriginal)
StringExpression
instance, initially
representing a copy of the argument instance.aOriginal
- a StringExpression
instance to be copiedStringExpression
instanceStringExpression newStringExpression(java.lang.String aInitial, boolean aIsLiteral)
StringExpression
instance, initially
representing a value specified by either a String
literal
or a String
-valued Java expression.aInitial
- initial specificationaIsLiteral
- true
if aInitial
specifies a
String
literal; false
if it identifies a
String
-valued Java expression.StringExpression
instanceboolean addErrorMessages(ClipboardProperty aProp, CodeGenerator aGenCode)
aGenCode
and adds them
to aProp
aProp
- ClipboardProperty
from which the expression was parsedaGenCode
- Generated code for the expressionaGenCode
contains a non-empty list of error
messagesClipboardPage openRule(StringMap aKeyPage, boolean aForceDBOpen) throws BadClassDefinitionException, ConfigurationException, MultipleCircumstancePropertiesException, MultipleRuleVersionException, BadInputException, BadInstanceDataException, DatabaseException
aKeyPage
- keys to instance desiredaForceDBOpen
- true
to bypass EditContext and use database open
even at design-time.BadClassDefinitionException
ConfigurationException
MultipleCircumstancePropertiesException
MultipleRuleVersionException
BadInputException
BadInstanceDataException
DatabaseException
void addKnownPageDescriptor(java.lang.String aPageName, java.lang.String aClassName)
aPageName
- name of page, simple names onlyaClassName
- name of classCodeGenerator getStringCodeGenerator()
CodeGenerator getStringWithVariableCodeGenerator()
CodeGenerator getBooleanCodeGenerator()
CodeGenerator getBooleanWithVariableCodeGenerator()
boolean isDeclarativeRule()
boolean isDeclarativeInvoked()
void setDeclarativeRule(boolean aIsDeclarativeRule)
CodeGenerator
objects, which can be retrieved by the caller.aIsDeclarativeRule
- Is this a declarative rule?void setDeclarativeInvoked(boolean aIsDeclarativeInvoked)
CodeGenerator
objects, which can be retrieved by the caller.aIsDeclarativeInvoked
- Is this invoked by declarative rules?boolean isMyStepPageChecked()
true
if code to check for null myStepPage
has been emitted to the code buffervoid setMyStepPageChecked(boolean aMyStepPageChecked)
aMyStepPageChecked
- java.lang.String generateJavaForPropertySet(ClipboardProperty aLHS, ClipboardProperty aRHS)
aLHS
- left hand side of property-setaRHS
- right hand side of property-setjava.lang.String[] generateStepPageReference(ClipboardProperty theProp, java.lang.String aVarName, boolean aIfPresent)
createPage
) and as the reference expected by
setStepPage
, since these are distinctly different.theProp
- ClipboardProperty containing reference to step pageaVarName
- name of a previously declared variable to which
the ClipboardPage represent step page should be assigned (e.g. "myStepPage").aIfPresent
- true
if page should be obtained only if
it is already present.null
.
[2] convenience flag: a zero-length String if [0] contains the
default value, non-zero length String if a non-blank name
is present in [0].java.util.List getWhenChangeDeclarativeReferences()
generateJavaForPropertySet
. AFTER calling generateJavaForPropertySet
use this method to fetch RHS properties found in the property-sets.List
RHS property referencesjava.util.List getWillChangeDeclarativeReferences()
generateJavaForPropertySet
. AFTER calling generateJavaForPropertySet
use this method to fetch LHS properties found in the property-sets.List
LHS property referencesvoid setWhenChangeDeclarativeReferences(java.util.List aWhenChangeRefs)
aWhenChangeRefs
- RHS property referencesvoid setWillChangeDeclarativeReferences(java.util.List aWillChangeRefs)
aWillChangeRefs
- LHS property referencesvoid focusOnSupport()
void restoreFocus()
boolean checkWhenInstance(java.lang.String aStepPPageClass, java.lang.String aPPageClass, java.lang.String aWhenName, ClipboardProperty aWhenRef)
aStepPPageClass
- - Step page class name.aPPageClass
- - primary page class name.aWhenName
- - when rule name.aWhenRef
- - when rule reference.true
if the when instance exists
and is accessible to the user's edit context.boolean checkModelInstance(java.lang.String aStepPPageClass, java.lang.String aPPageClass, java.lang.String aModelName, ClipboardProperty aModelRef)
aStepPPageClass
- - Step page class name.aPPageClass
- - primary page class name.aModelName
- - model name.aModelRef
- - model reference.true
if the model instance exists
and is accessible to the user's edit context.CodeGenerator getCodeGeneratorInstance()
CodeGenerator
CodeGenerator
a freshly created instance of CodeGeneratorvoid setCurrentRepeatType(java.lang.String currentRepeatType)
currentRepeatType
- The mCurrentRepeatType to set.java.lang.String getClassForPage(java.lang.String aPage, boolean aIsPrimaryReference)
aPage
- the PageaIsPrimaryReference
- IMethod addMethod(java.lang.String aProposedName)
aProposedName
- Name that the caller suggests be used as the base
for the method name. Use IGeneratedMethod.insertMethodName(IGeneratedMethod.put(""))
to insert the real method name into method at the appropriate location.IGeneratedMethod createMethod(java.lang.String aProposedName, boolean aCaptureAddCode)
aProposedName
- Name that the caller suggests be used as the base
for the method name. Use IGeneratedMethod.insertMethodName(IGeneratedMethod.put(""))
to insert the real method name into method at the appropriate location.aCaptureAddCode
- if true
then calls to FirstUseAssembler.addCode(String)
will be captured and the text added to this generated method until the method is closed.IGeneratedMethod createMethod(java.lang.String aProposedName, boolean aCaptureAddCode, java.lang.String aInsKey)
aProposedName
- Name that the caller suggests be used as the base
for the method name. Use IGeneratedMethod.insertMethodName(IGeneratedMethod.put(""))
to insert the real method name into method at the appropriate location.aCaptureAddCode
- if true
then calls to FirstUseAssembler.addCode(String)
will be captured and the text added to this generated method until the method is closed.aInsKey
- pzInsKey of rule for which this method is being generated (JSP include tag handling)java.lang.String getMethodNameForKey(java.lang.String aInsKey)
null
if no such method has been generated yet.aInsKey
- pzInsKey to look upvoid summarizeGeneratedMethods(java.lang.String aIdentifier)
aIdentifier
- identifies the rule being assembledICodeBuffer setIndentLevel(int aLevel)
aLevel
- desired level; if less than 0, then 0 will be usedICodeBuffer setIndentContent(java.lang.String aIndentContent)
aIndentContent
- content for each indentation level.ICodeBuffer increaseIndent()
ICodeBuffer increaseIndent(int aLevels)
aLevels
- number of levels to increaseICodeBuffer decreaseIndent()
ICodeBuffer decreaseIndent(int aLevels)
aLevels
- number of levels to decreaseICodeBuffer emit(java.lang.String aContent)
aContent
- content to be addedICodeBuffer emitln(java.lang.String aContent)
aContent
- content to be addedICodeBuffer emitEscaped(java.lang.String aContent)
aContent
- content to be addedICodeBuffer emitEscapedln(java.lang.String aContent)
aDepth
- number of additional times the content should
be escaped (specify 0 to escape once, the most typical use)aContent
- content to be addedICodeBuffer emitCSF(java.lang.String aContent)
aContent
- content to be addedICodeBuffer emitCSFln(java.lang.String aContent)
aContent
- content to be addedICodeBuffer setIndentLevelAS(int aLevel)
aLevel
- desired level; if less than 0, then 0 will be usedICodeBuffer setIndentContentAS(java.lang.String aIndentContent)
aIndentContent
- content for each indentation level.ICodeBuffer increaseIndentAS()
ICodeBuffer increaseIndentAS(int aLevels)
aLevels
- number of levels to increaseICodeBuffer decreaseIndentAS()
ICodeBuffer decreaseIndentAS(int aLevels)
aLevels
- number of levels to decreaseICodeBuffer emitAS(java.lang.String aContent)
The content will be processed through StringUtils.escapeIntoJavaString.
aContent
- content to be addedICodeBuffer emitASln(java.lang.String aContent)
The content will be processed through StringUtils.escapeIntoJavaString.
aContent
- content to be addedICodeBuffer emitASconst(java.lang.String aContent)
The content will be processed through StringUtils.escapeIntoJavaString and then surrounded by quotation marks so that the content is treated as a constant String. Consecutive calls to "emitASconst" will have their content merged to a single constant String.
aContent
- content to be addedICodeBuffer emitASconstln(java.lang.String aContent)
The content will be processed through StringUtils.escapeIntoJavaString and then surrounded by quotation marks so that the content is treated as a constant String. Consecutive calls to "emitASconst" will have their content merged to a single constant String.
aContent
- content to be addedICodeBuffer emitASraw(java.lang.String aContent)
aContent
- content to be addedICodeBuffer emitAScsf(java.lang.String aContent)
aContent
- content to be addedPageDescriptor createPageDescriptor(java.lang.String aPageName, java.lang.String aClassName, boolean aIsExact, boolean aIsParameter)
PageDescriptor
.aPageName
- The name of this page, if known. May be null.aClassName
- The class of this page, if known. May be null.aIsExact
- True if the class of this page cannot vary between assembly time and run time.aIsParameter
- True if this is a parameter page.PageDescriptor
described by the above arguments, with the value for PageDescriptor.isPrimaryPageForAssembly()
calculated based on the assembly
environment.PageDescriptor createPageDescriptor(java.lang.String aPageName, java.lang.String aClassName, boolean aIsExact, boolean aIsParameter, boolean aIsPrimaryPageForAssembly)
PageDescriptor
.aPageName
- The name of this page, if known. May be null.aClassName
- The class of this page, if known. May be null.aIsExact
- True if the class of this page cannot vary between assembly time and run time.aIsParameter
- True if this is a parameter page.aIsPrimaryPageForAssembly
- True if this page descriptor's type was drawn from the primary page at assembly time--most often true when this page represents the primary page.PageDescriptor
described by the above arguments.boolean noInlining()
java.lang.Object translateExpression(java.lang.String aExpression, ClipboardProperty aProp, CodeGenerator aExpectedType) throws java.lang.Exception
java.lang.Exception
Copyright © 2018 Pegasystems Inc. All Rights Reserved.