public class DbModelWurblet extends ModelWurblet
The following wurblet options are supported:
ModelWurblet.| Constructor and Description |
|---|
DbModelWurblet() |
| Modifier and Type | Method and Description |
|---|---|
String |
aas(String str)
Utility method to generate argument list.
|
String |
acs(String str,
String appendStr)
Adds a string to a comma separated list.
|
String |
as(String str)
Utility method to always get a non-null string.
|
void |
assertEntityIsPersistable()
Asserts that SQL statements can be executed for that entity.
|
String |
buildInvocationParameters()
Builds the string of invocation parameters.
|
String |
buildInvocationParameters(boolean limit,
boolean offset)
Builds the string of invocation parameters.
|
String |
buildMethodParameters()
Builds the string of method parameters.
|
String |
buildMethodParameters(boolean limit,
boolean offset)
Builds the string of method parameters.
|
ComponentInfo |
createComponentInfo(org.tentackle.model.Entity component)
Creates the component info for a given component.
|
String |
createJdbcGetterName(org.tentackle.model.Attribute attribute)
Creates the "getXXXX" method name for ResultSetWrapper.
|
String |
createJdbcSetterName(org.tentackle.model.Attribute attribute)
Creates the "setXXXX" method name for PreparedStatementWrapper.
|
String |
createJoins()
Creates the java code for
JoinedSelects. |
String |
createJoinSetPars()
Creates optional JDBC-set paramaters code for joins with extra arguments.
|
String |
createOrderBy()
Creates the order by clause.
|
String |
createOrderBy(List<WurbletArgument> sortKeys)
Creates the order by clause.
|
String |
createRelationArgString(org.tentackle.model.Relation relation)
Creates the argument string for select- or delete statement of a relation.
|
String |
createRelationDeleteCode(org.tentackle.model.Relation relation)
Creates the java code to delete a relation.
|
String |
createRelationLinkCode(org.tentackle.model.Relation relation)
Creates the java code to set the link of a relation.
|
String |
createRelationSelectCode(org.tentackle.model.Relation relation)
Creates the java code to select a relation.
|
String |
createRelationSetFirstArgMethodName(org.tentackle.model.Relation relation)
Creates the set-first-arg method name (useful only in object relations).
|
String |
createRelationUpdateReferenceCode(org.tentackle.model.Relation relation)
Creates the java code to update the reference of a relation.
The pdo name is fixed "me()". |
String |
createRelationUpdateReferenceCode(org.tentackle.model.Relation relation,
String pdo,
boolean blunt)
Creates the java code to update the reference of a relation.
|
String |
createRelationWurbletArgString(org.tentackle.model.Relation relation)
Creates the wurblet argument string for select- or delete statement of a relation.
|
String |
createStatementId()
Creates the name of a statement id.
Because statement ids are final, the name is in uppercase. |
org.tentackle.model.Attribute |
getContextAttribute()
Gets the context attribute.
|
List<org.tentackle.model.AttributeSorting> |
getDefaultSorting()
Goes up the inheritance tree until a default sorting is found.
|
List<WurbletArgument> |
getDefaultSortKeys()
Gets the default sorting keys.
|
List<org.tentackle.model.Relation> |
getEagerRelations()
The TT persistence layer provides an optimized select for a single eager relations via a LeftJoin.
|
WurbletArgumentExpression |
getExpression()
Gets the select/where expression.
|
List<WurbletArgument> |
getExpressionArguments()
Gets the expression arguments.
|
List<WurbletArgument> |
getExtraArguments()
Gets the extra arguments.
Those are not part of the expression and not sorting arguments. |
String |
getJdbcCode(org.tentackle.model.Attribute attribute,
String modelCode)
Creates java code applicable to the JDBC layer from model variable access code.
Applies .toExternal() if attribute is an application specific type. |
org.tentackle.model.DataType |
getJdbcDataType(org.tentackle.model.Attribute attribute)
Gets the effective DataType used agains Tentackle's JDBC wrapper layer.
|
List<JoinPath> |
getJoinPaths()
Gets the consolidated relation paths for the join arguments.
|
List<WurbletArgument> |
getMethodArguments()
Gets the method arguments.
|
String |
getModelCode(org.tentackle.model.Attribute attribute,
String jdbcCode)
Creates java code applicable to the application model from JDBC variable access code.
Applies .toInternal() if attribute is an application specific type. |
List<WurbletArgument> |
getSortingArguments()
Gets the sorting arguments.
|
boolean |
isArgumentGroupingEnabled()
Returns whether argument grouping is enabled.
By default, the grouping separator '|' just improves readability. Some wurblet, however, need extra arguments separated from the main expression. |
boolean |
isAttracked()
Returns whether the entity is attracked or fulltracked.
|
boolean |
isClassIdRequiredInWhereClause()
Returns whether the classid needs to be inluded in the WHERE-clause.
|
boolean |
isClassIdRequiredInWhereClause(org.tentackle.model.Entity entity)
Returns whether the classid needs to be inluded in the WHERE-clause.
|
boolean |
isEntityPersistable()
Returns whether SQL statements can be executed for that entity.
|
boolean |
isFullTracked()
Returns whether the entity is fulltracked.
|
boolean |
isPathAllowed()
Returns whether expression arguments may contain paths to other entities.
|
boolean |
isPdoProvidingArguments()
Determines whether one the wurblet arguments refer to a value returned by a PDO's method.
|
boolean |
isRelationTransient(org.tentackle.model.Relation relation)
Returns whether the relation is transient.
|
boolean |
isTracked()
Returns whether the entity is tracked.
|
boolean |
isWithDefaultSorting()
Returns whether default sorting is configured for the entity.
|
boolean |
isWithJoins()
Returns whether there are load joins.
|
boolean |
isWithSorting()
Returns whether sorting is configured for this wurblet.
|
String |
pcs(String str,
String prependStr)
Prepends a string to a comma separated list.
|
void |
run() |
appendCommaSeparated, createDeclaredArgsForSelectOrDeleteMethod, createListRelationDeleteMethodName, createRelationSelectMethodName, deriveClassNameForEntity, getArgs, getEntity, getMethodName, getModelDirName, getModelName, getOption, getOptionArgs, getPdoClassName, getWurbletArgs, isAttributeDerived, isGenerified, isIdAttribute, isIdOrSerialAttribute, isInterface, isPartOfInheritanceHierarchy, isPdo, isRemote, isSerialAttribute, isSetGetRequired, orderByInheritanceLevelAndClassId, prependCommaSeparated, setRemotegetClassName, getPackageName, getSuperClassName, isAbstract, isFinal, isPrivate, isProtected, isPublic, toStringpublic boolean isArgumentGroupingEnabled()
public boolean isPathAllowed()
public void run()
throws org.wurbelizer.wurbel.WurbelException
run in interface org.wurbelizer.wurblet.Wurbletrun in class ModelWurbletorg.wurbelizer.wurbel.WurbelExceptionpublic boolean isTracked()
public boolean isAttracked()
public boolean isFullTracked()
public org.tentackle.model.Attribute getContextAttribute()
public boolean isClassIdRequiredInWhereClause(org.tentackle.model.Entity entity)
entity - the entitypublic boolean isClassIdRequiredInWhereClause()
public boolean isEntityPersistable()
public void assertEntityIsPersistable()
throws org.wurbelizer.wurbel.WurbelException
org.wurbelizer.wurbel.WurbelException - if notpublic List<WurbletArgument> getMethodArguments()
public List<WurbletArgument> getExpressionArguments()
public List<WurbletArgument> getExtraArguments()
public WurbletArgumentExpression getExpression()
public List<WurbletArgument> getSortingArguments()
public boolean isWithSorting()
public List<org.tentackle.model.AttributeSorting> getDefaultSorting()
public List<WurbletArgument> getDefaultSortKeys() throws org.wurbelizer.wurbel.WurbelException
org.wurbelizer.wurbel.WurbelException - if failedpublic boolean isWithDefaultSorting()
public List<JoinPath> getJoinPaths()
public boolean isWithJoins()
public String createOrderBy(List<WurbletArgument> sortKeys) throws org.wurbelizer.wurbel.WurbelException
sortKeys - the sorting keysorg.wurbelizer.wurbel.WurbelException - if failedpublic String createOrderBy() throws org.wurbelizer.wurbel.WurbelException
org.wurbelizer.wurbel.WurbelException - if failedpublic String createJoins() throws org.wurbelizer.wurbel.WurbelException
JoinedSelects.org.wurbelizer.wurbel.WurbelException - if failedpublic String createJoinSetPars() throws org.wurbelizer.wurbel.WurbelException
org.wurbelizer.wurbel.WurbelException - if failedpublic String createStatementId() throws org.wurbelizer.wurbel.WurbelException
org.wurbelizer.wurbel.WurbelException - if guardname could not be determinedpublic String buildMethodParameters(boolean limit, boolean offset) throws org.wurbelizer.wurbel.WurbelException
limit - optional limit rowsoffset - optional skip rowsorg.wurbelizer.wurbel.WurbelException - if failedpublic String buildMethodParameters() throws org.wurbelizer.wurbel.WurbelException
org.wurbelizer.wurbel.WurbelException - if failefpublic String buildInvocationParameters(boolean limit, boolean offset) throws org.wurbelizer.wurbel.WurbelException
limit - optional limit rowsoffset - optional skip rowsorg.wurbelizer.wurbel.WurbelException - if failedpublic boolean isPdoProvidingArguments()
public String buildInvocationParameters() throws org.wurbelizer.wurbel.WurbelException
org.wurbelizer.wurbel.WurbelException - if failedpublic String acs(String str, String appendStr)
str - the stringappendStr - the string to appendpublic String pcs(String str, String prependStr)
str - the string builderprependStr - the string to prependpublic String aas(String str)
str - the argument stringpublic String as(String str)
str - the source stringpublic org.tentackle.model.DataType getJdbcDataType(org.tentackle.model.Attribute attribute)
throws org.wurbelizer.wurbel.WurbelException
attribute - the model attributeorg.wurbelizer.wurbel.WurbelException - if type is misconfiguredpublic String createJdbcSetterName(org.tentackle.model.Attribute attribute) throws org.wurbelizer.wurbel.WurbelException
attribute - the model attributeorg.wurbelizer.wurbel.WurbelException - if type is misconfiguredpublic String createJdbcGetterName(org.tentackle.model.Attribute attribute) throws org.wurbelizer.wurbel.WurbelException
attribute - the model attributeorg.wurbelizer.wurbel.WurbelException - if type is misconfiguredpublic String getModelCode(org.tentackle.model.Attribute attribute, String jdbcCode) throws org.wurbelizer.wurbel.WurbelException
attribute - the attributejdbcCode - the jdbc codeorg.wurbelizer.wurbel.WurbelException - if some model errorpublic String getJdbcCode(org.tentackle.model.Attribute attribute, String modelCode) throws org.wurbelizer.wurbel.WurbelException
attribute - the attributemodelCode - the jdbc codeorg.wurbelizer.wurbel.WurbelException - if some model errorpublic boolean isRelationTransient(org.tentackle.model.Relation relation)
relation - the relationpublic String createRelationArgString(org.tentackle.model.Relation relation)
relation - the relation.public String createRelationWurbletArgString(org.tentackle.model.Relation relation)
relation - the relation.public String createRelationSelectCode(org.tentackle.model.Relation relation)
relation - the relationpublic String createRelationUpdateReferenceCode(org.tentackle.model.Relation relation, String pdo, boolean blunt)
relation - the relationpdo - the PDO nameblunt - use the blunt setter method, if providedpublic String createRelationUpdateReferenceCode(org.tentackle.model.Relation relation)
"me()".relation - the relationpublic String createRelationSetFirstArgMethodName(org.tentackle.model.Relation relation) throws org.wurbelizer.wurbel.WurbelException
relation - the relationorg.wurbelizer.wurbel.WurbelException - if unexpected method argspublic String createRelationDeleteCode(org.tentackle.model.Relation relation)
relation - the relationpublic String createRelationLinkCode(org.tentackle.model.Relation relation)
relation - the relationpublic List<org.tentackle.model.Relation> getEagerRelations()
public ComponentInfo createComponentInfo(org.tentackle.model.Entity component) throws org.wurbelizer.wurbel.WurbelException
component - the component of the wurblet's entityorg.wurbelizer.wurbel.WurbelException - if failedTentackle - distributed, domain- and model-driven