Class AbstractModifyStatementStateObject
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyStatementStateObject
-
- All Implemented Interfaces:
StateObject
- Direct Known Subclasses:
DeleteStatementStateObject,UpdateStatementStateObject
public abstract class AbstractModifyStatementStateObject extends AbstractStateObject
The abstract definition of a modify statement. TODO- Version:
- 2.4
- See Also:
DeleteStatementStateObject,UpdateStatementStateObject- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringWHERE_CLAUSE_PROPERTYNotify the state object representing theWHEREclause has changed.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractModifyStatementStateObject(JPQLQueryStateObject parent)Creates a newAbstractModifyStatementStateObject.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddChildren(java.util.List<StateObject> children)Adds the children of thisStateObjectto the given list.WhereClauseStateObjectaddWhereClause()Adds theWHEREclause.protected abstract AbstractModifyClauseStateObjectbuildModifyClause()Creates the actualAbstractModifyClauseStateObjectthat represents the modify clause.java.lang.StringgetAbstractSchemaName()Returns the abstract schema name.AbstractSchemaNameStateObjectgetAbstractSchemaNameStateObject()Returns theAbstractSchemaNameStateObjectholding onto the abstract schema name.DeclarationStateObjectgetDeclaration()Returns the declaration clause which defines the domain of the query by declaring identification variables.IEntitygetEntity()Returns the actualIEntitythat has the abstract schema name.java.lang.StringgetIdentificationVariable()Returns the identification variable name that is ranging over the abstract schema type.IdentificationVariableStateObjectgetIdentificationVariableStateObject()Returns theIdentificationVariableStateObjectholding onto the identification variable.AbstractModifyClauseStateObjectgetModifyClause()Returns the state object representing the modify clause part of the modify statement.JPQLQueryStateObjectgetParent()Returns the parent of thisStateObject.RangeVariableDeclarationStateObjectgetRangeVariableDeclaration()Returns theStateObjectthat defines the range variable declaration.WhereClauseStateObjectgetWhereClause()Returns the state object representing theWHEREclause.booleanhasWhereClause()Returns the state object representing theWHEREclause.protected voidinitialize()Initializes this state object.booleanisEquivalent(StateObject stateObject)Determines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.voidremoveWhereClause()Removes theWHEREclause.voidsetConditionalStateObject(StateObject conditionalStateObject)Sets the givenStateObjectto be the conditional expression of theWHEREclause.voidsetDeclaration(java.lang.String abstractSchemaName)Sets the abstract schema name to the given value and removes the identification variable.voidsetDeclaration(java.lang.String abstractSchemaName, java.lang.String identificationVariable)Sets the abstract schema name to the given value and the identification variable that will range over it.voidsetDeclaration(IEntity entity)Sets the abstract schema name to the given value.voidsetDeclaration(IEntity entity, java.lang.String identificationVariable)Sets the abstract schema name to the given value and the identification variable that will range over it.voidsetEntity(IEntity entity)Sets the actualIEntityand updates the abstract schema name.voidsetEntityName(java.lang.String entityName)Sets the name of the abstract schema, which is the name of the entity.voidsetIdentificationVariable(java.lang.String identificationVariable)Sets the new identification variable that will range over the abstract schema name.voidtoggleWhereClause()Either adds or removes the state object representing theWHEREclause.protected voidtoTextInternal(java.lang.Appendable writer)Prints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
acceptUnknownVisitor, acceptUnknownVisitor, addProblems, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDecorator, getExpression, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
accept
-
-
-
-
Field Detail
-
WHERE_CLAUSE_PROPERTY
public static final java.lang.String WHERE_CLAUSE_PROPERTY
Notify the state object representing theWHEREclause has changed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractModifyStatementStateObject
protected AbstractModifyStatementStateObject(JPQLQueryStateObject parent)
Creates a newAbstractModifyStatementStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
java.lang.NullPointerException- The given parent cannot benull
-
-
Method Detail
-
addChildren
protected void addChildren(java.util.List<StateObject> children)
Adds the children of thisStateObjectto the given list.- Overrides:
addChildrenin classAbstractStateObject- Parameters:
children- The list used to store the children
-
addWhereClause
public WhereClauseStateObject addWhereClause()
Adds theWHEREclause. The clause is not added if it's already present.- Returns:
- The
GroupByClauseStateObject
-
buildModifyClause
protected abstract AbstractModifyClauseStateObject buildModifyClause()
Creates the actualAbstractModifyClauseStateObjectthat represents the modify clause.- Returns:
- The modify clause part of this modify statement
-
getAbstractSchemaName
public java.lang.String getAbstractSchemaName()
Returns the abstract schema name.- Returns:
- The name of the abstract schema type for which the identification variable is ranging over
-
getAbstractSchemaNameStateObject
public AbstractSchemaNameStateObject getAbstractSchemaNameStateObject()
Returns theAbstractSchemaNameStateObjectholding onto the abstract schema name.- Returns:
- The
AbstractSchemaNameStateObject, which is nevernull
-
getDeclaration
public DeclarationStateObject getDeclaration()
Returns the declaration clause which defines the domain of the query by declaring identification variables.- Specified by:
getDeclarationin interfaceStateObject- Overrides:
getDeclarationin classAbstractStateObject- Returns:
- The declaration clause of which this
StateObjectis a child; i.e. either the top-level declaration if this is part of the top query or the sub-level declaration if this is part of a subquery
-
getEntity
public IEntity getEntity()
Returns the actualIEntitythat has the abstract schema name.- Returns:
- The actual
IEntityornullif no entity exists
-
getIdentificationVariable
public java.lang.String getIdentificationVariable()
Returns the identification variable name that is ranging over the abstract schema type.- Returns:
- The identification variable name
-
getIdentificationVariableStateObject
public IdentificationVariableStateObject getIdentificationVariableStateObject()
Returns theIdentificationVariableStateObjectholding onto the identification variable.- Returns:
- The
IdentificationVariableStateObject, which is nevernull
-
getModifyClause
public AbstractModifyClauseStateObject getModifyClause()
Returns the state object representing the modify clause part of the modify statement.- Returns:
- The state object representing the modify clause part of the modify statement, which is
never
null
-
getParent
public JPQLQueryStateObject getParent()
Returns the parent of thisStateObject.- Specified by:
getParentin interfaceStateObject- Overrides:
getParentin classAbstractStateObject- Returns:
- Returns the parent of this
StateObject, which isnullonly when this is the root of the hierarchy
-
getRangeVariableDeclaration
public RangeVariableDeclarationStateObject getRangeVariableDeclaration()
Returns theStateObjectthat defines the range variable declaration.- Returns:
- The
StateObjectthat defines the range variable declaration, which is nevernull
-
getWhereClause
public WhereClauseStateObject getWhereClause()
Returns the state object representing theWHEREclause.- Returns:
- Either the actual state object representing the
WHEREclause or thenullstate object sincenullis never returned
-
hasWhereClause
public boolean hasWhereClause()
Returns the state object representing theWHEREclause.- Returns:
- Either the actual state object representing the
WHEREclause ornullif it's not present
-
initialize
protected void initialize()
Initializes this state object.- Overrides:
initializein classAbstractStateObject
-
isEquivalent
public boolean isEquivalent(StateObject stateObject)
Determines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.- Specified by:
isEquivalentin interfaceStateObject- Overrides:
isEquivalentin classAbstractStateObject- Parameters:
stateObject- TheStateObjectto compare its content to this one- Returns:
trueif both object are equivalent;falseotherwise
-
removeWhereClause
public void removeWhereClause()
Removes theWHEREclause.
-
setConditionalStateObject
public void setConditionalStateObject(StateObject conditionalStateObject)
Sets the givenStateObjectto be the conditional expression of theWHEREclause.- Parameters:
conditionalStateObject- The new conditional expression
-
setDeclaration
public void setDeclaration(IEntity entity)
Sets the abstract schema name to the given value.- Parameters:
entity- TheIEntitythat this clause will range over
-
setDeclaration
public void setDeclaration(IEntity entity, java.lang.String identificationVariable)
Sets the abstract schema name to the given value and the identification variable that will range over it.- Parameters:
entity- TheIEntitythat this clause will range overidentificationVariable- The new identification variable
-
setDeclaration
public void setDeclaration(java.lang.String abstractSchemaName)
Sets the abstract schema name to the given value and removes the identification variable.- Parameters:
abstractSchemaName- The name of the abstract schema, which is the name of the entity
-
setDeclaration
public void setDeclaration(java.lang.String abstractSchemaName, java.lang.String identificationVariable)Sets the abstract schema name to the given value and the identification variable that will range over it.- Parameters:
abstractSchemaName- The name of the abstract schema, which is the name of the entityidentificationVariable- The new identification variable
-
setEntity
public void setEntity(IEntity entity)
Sets the actualIEntityand updates the abstract schema name.- Parameters:
entity- TheIEntitythat this clause will range over
-
setEntityName
public void setEntityName(java.lang.String entityName)
Sets the name of the abstract schema, which is the name of the entity.- Parameters:
entityName- The name of the entity
-
setIdentificationVariable
public void setIdentificationVariable(java.lang.String identificationVariable)
Sets the new identification variable that will range over the abstract schema name.- Parameters:
identificationVariable- The new identification variable
-
toggleWhereClause
public void toggleWhereClause()
Either adds or removes the state object representing theWHEREclause.
-
toTextInternal
protected void toTextInternal(java.lang.Appendable writer) throws java.io.IOExceptionPrints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.- Specified by:
toTextInternalin classAbstractStateObject- Parameters:
writer- The writer used to print out the string representation- Throws:
java.io.IOException- This should never happens, it is only required becauseAppendableis used instead of any concrete class
-
-