Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools.model.query

public abstract Class AbstractFromClauseStateObject

extends AbstractListHolderStateObject<VariableDeclarationStateObject>
implements DeclarationStateObject
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.jpql.tools.model.query.DeclarationStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.model.query.FromClauseStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleFromClauseStateObject
Annotations
@SuppressWarnings:nls, unused
Imports
java.io.IOException, java.util.ArrayList, .List, org.eclipse.persistence.jpa.jpql.parser.AbstractFromClause, org.eclipse.persistence.jpa.jpql.tools.model.Problem, org.eclipse.persistence.jpa.jpql.tools.spi.IEntity, .IManagedType, org.eclipse.persistence.jpa.jpql.tools.utility.iterable.SnapshotCloneIterable, org.eclipse.persistence.jpa.jpql.utility.CollectionTools, org.eclipse.persistence.jpa.jpql.utility.iterable.ListIterable

This state object represents the abstract definition of a FROM clause, which is either the FROM clause of the query or of a sub-query expression.
Author
Pascal Filion
Since
2.4
Version
2.5
See Also
AbstractSelectStatementStateObject, FromClauseStateObject, AbstractFromClause

Field Summary

Modifier and TypeField and Description
public static final String
VARIABLE_DECLARATIONS_LIST

Notifies the content of the list of VariableDeclarationStateObject has changed.

Constructor Summary

AccessConstructor and Description
protected
AbstractFromClauseStateObject(AbstractSelectStatementStateObject
The parent of this state object, which cannot be null
parent
)

Creates a new AbstractFromClauseStateObject.

Method Summary

Modifier and TypeMethod and Description
public CollectionMemberDeclarationStateObject

Returns:

The CollectionMemberDeclarationStateObject representing the collection declaration
addCollectionDeclaration
()

Adds a new collection declaration to the FROM clause.

public CollectionMemberDeclarationStateObject

Returns:

The CollectionMemberDeclarationStateObject representing the collection declaration
addCollectionDeclaration
(String
The collection-valued path expression
collectionValuedPath
,
String
The variable defining the collection-valued path expression
identificationVariable
)

Adds a new collection declaration to the FROM clause.

protected void
addProblems(List<Problem>
The list to which the problems are added
currentProblems
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addProblems.

Adds to the given list the problems that were found with the current state of this StateObject, which means there are validation issues.
public IdentificationVariableDeclarationStateObject

Returns:

The StateObject representing the range variable declaration
addRangeDeclaration
()

Adds a new range variable declaration to the FROM clause.

public IdentificationVariableDeclarationStateObject

Returns:

The state object of the new declaration
addRangeDeclaration
(IEntity
The external form of the entity to add to the declaration list
entity
,
String
The unique identifier identifying the abstract schema name
identificationVariable
)

Adds to this select statement a new range variable declaration.

public IdentificationVariableDeclarationStateObject

Returns:

The state object of the new declaration
addRangeDeclaration
(String
The name of the entity name
entityName
,
String
The new identification variable
identificationVariable
)

Adds a new range variable declaration.

protected abstract String

Returns:

The BNF of the declaration part of this clause
declarationBNF
()

Returns the BNF of the declaration part of this clause.

public ListIterable<? extends VariableDeclarationStateObject>
declarations()

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.DeclarationStateObject.declarations.

Returns the list of declarations declared in the declaration clause of the current query.
public IdentificationVariableStateObject
public DeclarationStateObject
getDeclaration()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getDeclaration.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getDeclaration.

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

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.
public IManagedType
getManagedType(StateObject
The StateObject that should be an simple identification variable or an encapsulated identification variable with the identifier KEY or VALUE
stateObject
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.DeclarationStateObject.getManagedType.

Returns the IManagedType for the given identification variable.
public AbstractSelectStatementStateObject
public Iterable<IdentificationVariableStateObject>
identificationVariables()

Returns the IdentificationVariableStateObjects holding onto the identification variables, which are the variables defined in the FROM clause.

public boolean
isEquivalent(StateObject
The StateObject to compare its content to this one
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.
protected String
listName()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject.listName.

Returns the name that is uniquely identifying the list.
public void
parse(String
The portion of the query representing one or several select items
jpqlFragment
)

Parses the given JPQL fragment and create the select item.

protected void
toTextInternal(Appendable
The writer used to print out the string representation
writer
)

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

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.
Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject:
addChildrenaddItemaddItemsaddListChangeListenerareChildrenEquivalentcanMoveDowncanMoveUpgetItemhasItemsinitializeitemsitemsSizemoveDownmoveUpremoveItemremoveItemsremoveListChangeListenertoStringItems

Field Detail

VARIABLE_DECLARATIONS_LISTback to summary
public static final String VARIABLE_DECLARATIONS_LIST

Notifies the content of the list of VariableDeclarationStateObject has changed.

Constructor Detail

AbstractFromClauseStateObjectback to summary
protected AbstractFromClauseStateObject(AbstractSelectStatementStateObject parent)

Creates a new AbstractFromClauseStateObject.

Parameters
parent:AbstractSelectStatementStateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

addCollectionDeclarationback to summary
public CollectionMemberDeclarationStateObject addCollectionDeclaration()

Adds a new collection declaration to the FROM clause.

Returns:CollectionMemberDeclarationStateObject

The CollectionMemberDeclarationStateObject representing the collection declaration

addCollectionDeclarationback to summary
public CollectionMemberDeclarationStateObject addCollectionDeclaration(String collectionValuedPath, String identificationVariable)

Adds a new collection declaration to the FROM clause.

Parameters
collectionValuedPath:String

The collection-valued path expression

identificationVariable:String

The variable defining the collection-valued path expression

Returns:CollectionMemberDeclarationStateObject

The CollectionMemberDeclarationStateObject representing the collection declaration

addProblemsback to summary
protected void addProblems(List<Problem> currentProblems)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addProblems.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addProblems.

Adds to the given list the problems that were found with the current state of this StateObject, which means there are validation issues.

Parameters
currentProblems:List<Problem>

The list to which the problems are added

Annotations
@Override
addRangeDeclarationback to summary
public IdentificationVariableDeclarationStateObject addRangeDeclaration()

Adds a new range variable declaration to the FROM clause.

Returns:IdentificationVariableDeclarationStateObject

The StateObject representing the range variable declaration

addRangeDeclarationback to summary
public IdentificationVariableDeclarationStateObject addRangeDeclaration(IEntity entity, String identificationVariable)

Adds to this select statement a new range variable declaration.

Parameters
entity:IEntity

The external form of the entity to add to the declaration list

identificationVariable:String

The unique identifier identifying the abstract schema name

Returns:IdentificationVariableDeclarationStateObject

The state object of the new declaration

addRangeDeclarationback to summary
public IdentificationVariableDeclarationStateObject addRangeDeclaration(String entityName, String identificationVariable)

Adds a new range variable declaration.

Parameters
entityName:String

The name of the entity name

identificationVariable:String

The new identification variable

Returns:IdentificationVariableDeclarationStateObject

The state object of the new declaration

declarationBNFback to summary
protected abstract String declarationBNF()

Returns the BNF of the declaration part of this clause.

Returns:String

The BNF of the declaration part of this clause

declarationsback to summary
public ListIterable<? extends VariableDeclarationStateObject> declarations()

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.DeclarationStateObject.declarations.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.DeclarationStateObject.declarations.

Returns the list of declarations declared in the declaration clause of the current query.

Returns:ListIterable<? extends VariableDeclarationStateObject>

The list of VariableDeclarationStateObject that define the domain of the query

Annotations
@Override
findIdentificationVariableback to summary
public IdentificationVariableStateObject findIdentificationVariable(String variable)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.findIdentificationVariable.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.findIdentificationVariable.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.findIdentificationVariable.

Returns the IdentificationVariableStateObject representing the given identification variable.

Parameters
variable:String

The name of the identification variable to retrieve its state object

Returns:IdentificationVariableStateObject

The IdentificationVariableStateObject defining the given identification variable

Annotations
@Override
getDeclarationback to summary
public DeclarationStateObject getDeclaration()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getDeclaration.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getDeclaration.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getDeclaration.

Returns the declaration clause which defines the domain of the query by declaring identification variables.

Returns:DeclarationStateObject

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

Annotations
@Override
getExpressionback to summary
public AbstractFromClause getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.

Returns:AbstractFromClause

The parsed object when a JPQL query is parsed and converted into a StateObject or null when the JPQL query is manually created (i.e. not from a string)

Annotations
@Override
getManagedTypeback to summary
public IManagedType getManagedType(StateObject stateObject)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.DeclarationStateObject.getManagedType.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.DeclarationStateObject.getManagedType.

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"
Parameters
stateObject:StateObject

The StateObject that should be an simple identification variable or an encapsulated identification variable with the identifier KEY or VALUE

Returns:IManagedType

The IManagedType representing the domain object declared by the given identification variable

Annotations
@Override
getParentback to summary
public AbstractSelectStatementStateObject getParent()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getParent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getParent.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getParent.

Returns the parent of this StateObject.

Returns:AbstractSelectStatementStateObject

Returns the parent of this StateObject, which is null only when this is the root of the hierarchy

Annotations
@Override
identificationVariablesback to summary
public Iterable<IdentificationVariableStateObject> identificationVariables()

Returns the IdentificationVariableStateObjects holding onto the identification variables, which are the variables defined in the FROM clause.

Example:

  • Employee e; e is returned
  • IN (e.employees) AS emps; emps is returned
  • Manager m JOIN m.employees emps; m and emps are returned
Returns:Iterable<IdentificationVariableStateObject>

The list of IdentificationVariableStateObjects

isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.

Parameters
stateObject:StateObject

The StateObject to compare its content to this one

Returns:boolean

true if both object are equivalent; false otherwise

Annotations
@Override
listNameback to summary
protected String listName()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject.listName.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject.listName.

Returns the name that is uniquely identifying the list.

Returns:String

The unique name identifying the list

Annotations
@Override
parseback to summary
public void parse(String jpqlFragment)

Parses the given JPQL fragment and create the select item. For the top-level query, the fragment can contain several select items but for a subquery, it can represent only one.

Parameters
jpqlFragment:String

The portion of the query representing one or several select items

toTextInternalback to summary
protected void toTextInternal(Appendable writer) throws IOException

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

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.

Parameters
writer:Appendable

The writer used to print out the string representation

Annotations
@Override
Exceptions
IOException:
This should never happens, it is only required because Appendable is used instead of any concrete class