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
The abstract definition of a modify statement. TODO
- Since:
- 2.4
- Version:
- 2.4
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Notify the state object representing theWHERE
clause has changed. -
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a newAbstractModifyStatementStateObject
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addChildren
(List<StateObject> children) Adds the children of thisStateObject
to the given list.Adds theWHERE
clause.protected abstract AbstractModifyClauseStateObject
Creates the actualAbstractModifyClauseStateObject
that represents the modify clause.Returns the abstract schema name.Returns theAbstractSchemaNameStateObject
holding onto the abstract schema name.Returns the declaration clause which defines the domain of the query by declaring identification variables.Returns the actualIEntity
that has the abstract schema name.Returns the identification variable name that is ranging over the abstract schema type.Returns theIdentificationVariableStateObject
holding onto the identification variable.Returns the state object representing the modify clause part of the modify statement.Returns the parent of thisStateObject
.Returns theStateObject
that defines the range variable declaration.Returns the state object representing theWHERE
clause.boolean
Returns the state object representing theWHERE
clause.protected void
Initializes this state object.boolean
isEquivalent
(StateObject stateObject) Determines whether the givenStateObject
is equivalent to this one, i.e.void
Removes theWHERE
clause.void
setConditionalStateObject
(StateObject conditionalStateObject) Sets the givenStateObject
to be the conditional expression of theWHERE
clause.void
setDeclaration
(String abstractSchemaName) Sets the abstract schema name to the given value and removes the identification variable.void
setDeclaration
(String abstractSchemaName, String identificationVariable) Sets the abstract schema name to the given value and the identification variable that will range over it.void
setDeclaration
(IEntity entity) Sets the abstract schema name to the given value.void
setDeclaration
(IEntity entity, String identificationVariable) Sets the abstract schema name to the given value and the identification variable that will range over it.void
Sets the actualIEntity
and updates the abstract schema name.void
setEntityName
(String entityName) Sets the name of the abstract schema, which is the name of the entity.void
setIdentificationVariable
(String identificationVariable) Sets the new identification variable that will range over the abstract schema name.void
Either adds or removes the state object representing theWHERE
clause.protected void
toTextInternal
(Appendable writer) Prints out a string representation of thisStateObject
, which should not be used to define atrue
string 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 Details
-
WHERE_CLAUSE_PROPERTY
Notify the state object representing theWHERE
clause has changed.- See Also:
-
-
Constructor Details
-
AbstractModifyStatementStateObject
Creates a newAbstractModifyStatementStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
- Throws:
NullPointerException
- The given parent cannot benull
-
-
Method Details
-
addChildren
Description copied from class:AbstractStateObject
Adds the children of thisStateObject
to the given list.- Overrides:
addChildren
in classAbstractStateObject
- Parameters:
children
- The list used to store the children
-
addWhereClause
Adds theWHERE
clause. The clause is not added if it's already present.- Returns:
- The
GroupByClauseStateObject
-
buildModifyClause
Creates the actualAbstractModifyClauseStateObject
that represents the modify clause.- Returns:
- The modify clause part of this modify statement
-
getAbstractSchemaName
Returns the abstract schema name.- Returns:
- The name of the abstract schema type for which the identification variable is ranging over
-
getAbstractSchemaNameStateObject
Returns theAbstractSchemaNameStateObject
holding onto the abstract schema name.- Returns:
- The
AbstractSchemaNameStateObject
, which is nevernull
-
getDeclaration
Description copied from interface:StateObject
Returns the declaration clause which defines the domain of the query by declaring identification variables.- Specified by:
getDeclaration
in interfaceStateObject
- Overrides:
getDeclaration
in classAbstractStateObject
- Returns:
- The declaration clause of which this
StateObject
is 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
Returns the actualIEntity
that has the abstract schema name.- Returns:
- The actual
IEntity
ornull
if no entity exists
-
getIdentificationVariable
Returns the identification variable name that is ranging over the abstract schema type.- Returns:
- The identification variable name
-
getIdentificationVariableStateObject
Returns theIdentificationVariableStateObject
holding onto the identification variable.- Returns:
- The
IdentificationVariableStateObject
, which is nevernull
-
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
Description copied from interface:StateObject
Returns the parent of thisStateObject
.- Specified by:
getParent
in interfaceStateObject
- Overrides:
getParent
in classAbstractStateObject
- Returns:
- Returns the parent of this
StateObject
, which isnull
only when this is the root of the hierarchy
-
getRangeVariableDeclaration
Returns theStateObject
that defines the range variable declaration.- Returns:
- The
StateObject
that defines the range variable declaration, which is nevernull
-
getWhereClause
Returns the state object representing theWHERE
clause.- Returns:
- Either the actual state object representing the
WHERE
clause or thenull
state object sincenull
is never returned
-
hasWhereClause
public boolean hasWhereClause()Returns the state object representing theWHERE
clause.- Returns:
- Either the actual state object representing the
WHERE
clause ornull
if it's not present
-
initialize
protected void initialize()Description copied from class:AbstractStateObject
Initializes this state object.- Overrides:
initialize
in classAbstractStateObject
-
isEquivalent
Description copied from interface:StateObject
Determines whether the givenStateObject
is equivalent to this one, i.e. the information of bothStateObject
is the same.- Specified by:
isEquivalent
in interfaceStateObject
- Overrides:
isEquivalent
in classAbstractStateObject
- Parameters:
stateObject
- TheStateObject
to compare its content to this one- Returns:
true
if both object are equivalent;false
otherwise
-
removeWhereClause
public void removeWhereClause()Removes theWHERE
clause. -
setConditionalStateObject
Sets the givenStateObject
to be the conditional expression of theWHERE
clause.- Parameters:
conditionalStateObject
- The new conditional expression
-
setDeclaration
Sets the abstract schema name to the given value.- Parameters:
entity
- TheIEntity
that this clause will range over
-
setDeclaration
Sets the abstract schema name to the given value and the identification variable that will range over it.- Parameters:
entity
- TheIEntity
that this clause will range overidentificationVariable
- The new identification variable
-
setDeclaration
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
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
Sets the actualIEntity
and updates the abstract schema name.- Parameters:
entity
- TheIEntity
that this clause will range over
-
setEntityName
Sets the name of the abstract schema, which is the name of the entity.- Parameters:
entityName
- The name of the entity
-
setIdentificationVariable
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 theWHERE
clause. -
toTextInternal
Description copied from class:AbstractStateObject
Prints out a string representation of thisStateObject
, which should not be used to define atrue
string representation of a JPQL query but should be used for debugging purposes.- Specified by:
toTextInternal
in classAbstractStateObject
- Parameters:
writer
- The writer used to print out the string representation- Throws:
IOException
- This should never happens, it is only required becauseAppendable
is used instead of any concrete class
-