public final class DataModelWorker extends AbstractConversionWorker implements DataModelTokenTypes
Modifier and Type | Class and Description |
---|---|
private static class |
DataModelWorker.ClassComparator
Comparator implementation which sorts ASTs which represent data model
object (DMO) classes.
|
class |
DataModelWorker.Library
Helper to create, edit, move and delete data model ASTs.
|
private static class |
DataModelWorker.PropertyComparator
Comparator implementation which sorts ASTs which have an "order"
annotation into ascending order, according to the numeric value of
that attribute.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
P2O_POSTFIX
File extension appended to schema filenames
|
private DataModelAst |
root
Root of the target tree currently being processed (created).
|
PEER_ID
resolver
BOOL_FALSE, BOOL_TRUE, CLASS, COMPOSITE, CONSTR_COL, DATA_MODEL, DATE_LITERAL, DATETIME_LITERAL, DATETIME_TZ_LITERAL, DEC_LITERAL, FOREIGN, GENERATOR, INDEX, INDEX_COL, INITIAL, MANY_TO_ONE, NULL_LITERAL, NUM_LITERAL, ONE_TO_MANY, ONE_TO_ONE, PRIMARY, PROPERTY, SEQUENCE, STRING, TABLE, UNIQUE, UNKNOWN
Constructor and Description |
---|
DataModelWorker()
Default constructor which initializes libraries.
|
Modifier and Type | Method and Description |
---|---|
static DataModelAst |
createAst(int type,
java.lang.String text,
Aast parent,
AstSymbolResolver resolver)
Worker routine to centralize creation of new data model ASTs.
|
static DataModelAst |
createPeerAst(Aast source,
int type,
java.lang.String text,
Aast parent,
AstSymbolResolver resolver)
Worker routine for peer AST creation.
|
Aast |
createRootAst(Aast peerRoot,
boolean virtualFile)
Worker routine to centralize creation of a new data model AST that is
a root node.
|
Aast |
createRootAst(Aast peerRoot,
java.lang.String filename,
boolean virtualFile)
Worker routine to centralize creation of a new data model AST that is
a root node.
|
void |
finish()
Hook to provide termination processing for a pattern worker.
|
private java.lang.String |
generateFilename(Aast ast)
Generate a unique data model AST persistence filename based on the
current source AST filename.
|
private boolean |
isXDependentUponY(Aast x,
Aast y)
Tests one class AST for dependence upon another.
|
java.lang.Object |
resolveConstant(java.lang.String constant)
Resolve
constant to a literal which can be compiled into
expressions. |
crossReferencePeerAsts, getClosestPeerId, getParentPeer, initializeAst, initializeAst, initializeRootAst, initializeRootAst
getCopy, getLibrary, getSource, initialize, registerTree, setLibrary, visitAst
private static final java.lang.String P2O_POSTFIX
private DataModelAst root
public DataModelWorker()
public static DataModelAst createAst(int type, java.lang.String text, Aast parent, AstSymbolResolver resolver)
type
- The token type for the data model AST.text
- The text for the AST.parent
- The parent AST node or null
.resolver
- The current instance of the AstSymbolResolver
in use
or null
.public static DataModelAst createPeerAst(Aast source, int type, java.lang.String text, Aast parent, AstSymbolResolver resolver)
type
- The token type for the AST.text
- The text for the AST.parent
- The parent AST node.resolver
- The current instance of the AstSymbolResolver
in use.public Aast createRootAst(Aast peerRoot, boolean virtualFile) throws ConfigurationException
AstManager
and set into the AST.peerRoot
- Root node of Progress schema AST currently being processed.virtualFile
- If true
the file is not supposed to be persisted into the file system,
the file name is used to map some ID to the ASTConfigurationException
- if P2J environment is not properly initialized.public Aast createRootAst(Aast peerRoot, java.lang.String filename, boolean virtualFile) throws ConfigurationException
AstManager
and set into the AST.peerRoot
- Root node of Progress schema AST currently being processed.filename
- The file in which to persist the new AST.virtualFile
- If true
the file is not supposed to be persisted into the file system,
the file name is used to map some ID to the ASTConfigurationException
- if P2J environment is not properly initialized.public java.lang.Object resolveConstant(java.lang.String constant)
constant
to a literal which can be compiled into
expressions.resolveConstant
in interface PatternWorker
resolveConstant
in class AbstractPatternWorker
constant
- Constant indicating a data model token name.public void finish()
finish
in interface PatternWorker
finish
in class AbstractPatternWorker
private java.lang.String generateFilename(Aast ast)
ast
- Current source AST.private boolean isXDependentUponY(Aast x, Aast y)
x
, as well as the entire tree
of its dependencies. In other words, test whether x
or
any class upon which it is dependent is dependent upon
y
.x
- Class AST node whose dependencies are being checked.y
- Class AST node against which to test x
for
dependence.true
if x
(or any of its dependent
classes) is dependent upon y
.