EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.jpa.jpql.model.query
Class AbstractModifyStatementStateObject

java.lang.Object
  extended by org.eclipse.persistence.jpa.jpql.model.query.AbstractStateObject
      extended by org.eclipse.persistence.jpa.jpql.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
static java.lang.String WHERE_CLAUSE_PROPERTY
          Notify the state object representing the WHERE clause has changed.
 
Constructor Summary
protected AbstractModifyStatementStateObject(JPQLQueryStateObject parent)
          Creates a new AbstractModifyStatementStateObject.
 
Method Summary
protected  void addChildren(java.util.List<StateObject> children)
          Adds the children of this StateObject to the given list.
 WhereClauseStateObject addWhereClause()
          Adds the WHERE clause.
protected abstract  AbstractModifyClauseStateObject buildModifyClause()
          Creates the actual AbstractModifyClauseStateObject that represents the modify clause.
 java.lang.String getAbstractSchemaName()
          Returns the abstract schema name.
 AbstractSchemaNameStateObject getAbstractSchemaNameStateObject()
          Returns the AbstractSchemaNameStateObject holding onto the abstract schema name.
 DeclarationStateObject getDeclaration()
          Returns the declaration clause which defines the domain of the query by declaring identification variables.
 IEntity getEntity()
          Returns the actual IEntity that has the abstract schema name.
 java.lang.String getIdentificationVariable()
          Returns the identification variable name that is ranging over the abstract schema type.
 IdentificationVariableStateObject getIdentificationVariableStateObject()
          Returns the IdentificationVariableStateObject holding onto the identification variable.
 AbstractModifyClauseStateObject getModifyClause()
          Returns the state object representing the modify clause part of the modify statement.
 JPQLQueryStateObject getParent()
          Returns the parent of this StateObject.
 RangeVariableDeclarationStateObject getRangeVariableDeclaration()
          Returns the StateObject that defines the range variable declaration.
 WhereClauseStateObject getWhereClause()
          Returns the state object representing the WHERE clause.
 boolean hasWhereClause()
          Returns the state object representing the WHERE clause.
protected  void initialize()
          Initializes this state object.
 boolean isEquivalent(StateObject stateObject)
          Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.
 void removeWhereClause()
          Removes the WHERE clause.
 void setConditionalStateObject(StateObject conditionalStateObject)
          Sets the given StateObject to be the conditional expression of the WHERE clause.
 void setDeclaration(IEntity entity)
          Sets the abstract schema name to the given value.
 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.
 void setDeclaration(java.lang.String abstractSchemaName)
          Sets the abstract schema name to the given value and removes the identification variable.
 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.
 void setEntity(IEntity entity)
          Sets the actual IEntity and updates the abstract schema name.
 void setEntityName(java.lang.String entityName)
          Sets the name of the abstract schema, which is the name of the entity.
 void setIdentificationVariable(java.lang.String identificationVariable)
          Sets the new identification variable that will range over the abstract schema name.
 void toggleWhereClause()
          Either adds or removes the state object representing the WHERE clause.
protected  void toTextInternal(java.lang.Appendable writer)
          Prints out a string representation of this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.
 
Methods inherited from class org.eclipse.persistence.jpa.jpql.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.model.query.StateObject
accept
 

Field Detail

WHERE_CLAUSE_PROPERTY

public static final java.lang.String WHERE_CLAUSE_PROPERTY
Notify the state object representing the WHERE clause has changed.

See Also:
Constant Field Values
Constructor Detail

AbstractModifyStatementStateObject

protected AbstractModifyStatementStateObject(JPQLQueryStateObject parent)
Creates a new AbstractModifyStatementStateObject.

Parameters:
parent - The parent of this state object, which cannot be null
Throws:
java.lang.NullPointerException - The given parent cannot be null
Method Detail

addChildren

protected void addChildren(java.util.List<StateObject> children)
Adds the children of this StateObject to the given list.

Overrides:
addChildren in class AbstractStateObject
Parameters:
children - The list used to store the children

addWhereClause

public WhereClauseStateObject addWhereClause()
Adds the WHERE clause. The clause is not added if it's already present.

Returns:
The GroupByClauseStateObject

buildModifyClause

protected abstract AbstractModifyClauseStateObject buildModifyClause()
Creates the actual AbstractModifyClauseStateObject that 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 the AbstractSchemaNameStateObject holding onto the abstract schema name.

Returns:
The AbstractSchemaNameStateObject, which is never null

getDeclaration

public DeclarationStateObject getDeclaration()
Returns the declaration clause which defines the domain of the query by declaring identification variables.

Specified by:
getDeclaration in interface StateObject
Overrides:
getDeclaration in class AbstractStateObject
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

public IEntity getEntity()
Returns the actual IEntity that has the abstract schema name.

Returns:
The actual IEntity or null if 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 the IdentificationVariableStateObject holding onto the identification variable.

Returns:
The IdentificationVariableStateObject, which is never null

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 this StateObject.

Specified by:
getParent in interface StateObject
Overrides:
getParent in class AbstractStateObject
Returns:
Returns the parent of this StateObject, which is null only when this is the root of the hierarchy

getRangeVariableDeclaration

public RangeVariableDeclarationStateObject getRangeVariableDeclaration()
Returns the StateObject that defines the range variable declaration.

Returns:
The StateObject that defines the range variable declaration, which is never null

getWhereClause

public WhereClauseStateObject getWhereClause()
Returns the state object representing the WHERE clause.

Returns:
Either the actual state object representing the WHERE clause or the null state object since null is never returned

hasWhereClause

public boolean hasWhereClause()
Returns the state object representing the WHERE clause.

Returns:
Either the actual state object representing the WHERE clause or null if it's not present

initialize

protected void initialize()
Initializes this state object.

Overrides:
initialize in class AbstractStateObject

isEquivalent

public boolean isEquivalent(StateObject stateObject)
Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.

Specified by:
isEquivalent in interface StateObject
Overrides:
isEquivalent in class AbstractStateObject
Parameters:
stateObject - The StateObject to compare its content to this one
Returns:
true if both object are equivalent; false otherwise

removeWhereClause

public void removeWhereClause()
Removes the WHERE clause.


setConditionalStateObject

public void setConditionalStateObject(StateObject conditionalStateObject)
Sets the given StateObject to be the conditional expression of the WHERE clause.

Parameters:
conditionalStateObject - The new conditional expression

setDeclaration

public void setDeclaration(IEntity entity)
Sets the abstract schema name to the given value.

Parameters:
entity - The IEntity that 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 - The IEntity that this clause will range over
identificationVariable - 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 entity
identificationVariable - The new identification variable

setEntity

public void setEntity(IEntity entity)
Sets the actual IEntity and updates the abstract schema name.

Parameters:
entity - The IEntity that 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 the WHERE clause.


toTextInternal

protected void toTextInternal(java.lang.Appendable writer)
                       throws java.io.IOException
Prints out a string representation of this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.

Specified by:
toTextInternal in class AbstractStateObject
Parameters:
writer - The writer used to print out the string representation
Throws:
java.io.IOException - This should never happens, it is only required because Appendable is used instead of any concrete class

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference