Class AbstractModifyClauseStateObject

java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject
All Implemented Interfaces:
DeclarationStateObject, StateObject
Direct Known Subclasses:
DeleteClauseStateObject, UpdateClauseStateObject

public abstract class AbstractModifyClauseStateObject extends AbstractStateObject implements DeclarationStateObject
Since:
2.4
Version:
2.5
  • Constructor Details

    • AbstractModifyClauseStateObject

      protected AbstractModifyClauseStateObject(AbstractModifyStatementStateObject parent)
      Creates a new UpdateClauseStateObject.
      Parameters:
      parent - The parent of this state object
  • Method Details

    • addChildren

      protected void addChildren(List<StateObject> children)
      Description copied from class: AbstractStateObject
      Adds the children of this StateObject to the given list.
      Overrides:
      addChildren in class AbstractStateObject
      Parameters:
      children - The list used to store the children
    • declarations

      Description copied from interface: DeclarationStateObject
      Returns the list of declarations declared in the declaration clause of the current query.
      Specified by:
      declarations in interface DeclarationStateObject
      Returns:
      The list of VariableDeclarationStateObject that define the domain of the query
    • findManagedType

      public IManagedType findManagedType(StateObject stateObject)
      Description copied from interface: DeclarationStateObject
      Returns the IManagedType for the given identification variable. If the declaration is for a subquery and there is no managed type associated with the identification then the search will traverse up the query hierarchy.
      SELECT e FROM Department d JOIN KEY(d.employees).addresses a
      In the above query, the managed type associated with the identification variable:
      • d is "Department"
      • a is "Address"
      Specified by:
      findManagedType in interface DeclarationStateObject
      Parameters:
      stateObject - The StateObject that should be an simple identification variable or an encapsulated identification variable with the identifier KEY or VALUE
      Returns:
      The IManagedType representing the domain object declared by the given identification variable
      See Also:
    • getAbstractSchemaName

      public 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()
      Description copied from interface: StateObject
      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 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
    • getIdentifier

      public abstract String getIdentifier()
      Returns the JPQL identifier of this clause.
      Returns:
      The JPQL identifier
    • getManagedType

      public IManagedType getManagedType(StateObject stateObject)
      Description copied from interface: DeclarationStateObject
      Returns the IManagedType for the given identification variable. The search does not traverse up the query hierarchy if this declaration is for a subquery.
      SELECT e FROM Department d JOIN KEY(d.employees).addresses a
      In the above query, the managed type associated with the identification variable:
      • d is "Department"
      • a is "Address"
      Specified by:
      getManagedType in interface DeclarationStateObject
      Parameters:
      stateObject - The StateObject that should be an simple identification variable or an encapsulated identification variable with the identifier KEY or VALUE
      Returns:
      The IManagedType representing the domain object declared by the given identification variable
      See Also:
    • getParent

      Description copied from interface: StateObject
      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
    • hasIdentificationVariable

      public boolean hasIdentificationVariable()
      Determines whether an identification variable was defined.
      Returns:
      true if an identification variable is defined; false otherwise
    • initialize

      protected void initialize()
      Description copied from class: AbstractStateObject
      Initializes this state object.
      Overrides:
      initialize in class AbstractStateObject
    • isEquivalent

      public boolean isEquivalent(StateObject stateObject)
      Description copied from interface: 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
    • 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, 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(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(String abstractSchemaName, 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(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(String identificationVariable)
      Sets the new identification variable that will range over the abstract schema name.
      Parameters:
      identificationVariable - The new identification variable
    • toTextInternal

      protected void toTextInternal(Appendable writer) throws IOException
      Description copied from class: AbstractStateObject
      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:
      IOException - This should never happens, it is only required because Appendable is used instead of any concrete class