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

public Class UpdateClauseStateObject

extends AbstractModifyClauseStateObject
implements ListHolderStateObject<UpdateItemStateObject>
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
Annotations
@SuppressWarnings:nls, unused
Imports
java.io.IOException, java.util.ArrayList, .Collection, .List, .ListIterator, org.eclipse.persistence.jpa.jpql.parser.InternalUpdateClauseBNF, .UpdateClause, org.eclipse.persistence.jpa.jpql.tools.model.IListChangeListener, org.eclipse.persistence.jpa.jpql.utility.iterable.ListIterable, .SnapshotCloneListIterable

This is the UPDATE clause of the UPDATE statement.

An UPDATE statement provides bulk operations over sets of entities of a single entity class (together with its subclasses, if any). Only one entity abstract schema type may be specified in the UPDATE clause.

BNF: update_clause ::= UPDATE abstract_schema_name [[AS] identification_variable] SET update_item {, update_item}*

Author
Pascal Filion
Since
2.4
Version
2.5
See Also
UpdateClause

Field Summary

Modifier and TypeField and Description
private List<UpdateItemStateObject>
items

The list of UpdateItemStateObject that represent the update items.

public static final String
UPDATE_ITEMS_LIST

Notify the list of StateObjects representing the update items.

Constructor Summary

AccessConstructor and Description
public
UpdateClauseStateObject(UpdateStatementStateObject
The parent of this state object, which cannot be null
parent
)

Creates a new UpdateClauseStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
protected void
addChildren(List<StateObject>
The list used to store the children
children
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject.addChildren.

Adds the children of this StateObject to the given list.
public UpdateItemStateObject

Returns:

The newly added UpdateItemStateObject
addItem
()

Adds a new UPDATE item to this clause.

public UpdateItemStateObject

Returns:

The newly added UpdateItemStateObject
addItem
(ListIterator<String>
The paths of the value to update
paths
,
StateObject
The StateObject representing the new value
newValue
)

Adds a new UPDATE item to this clause.

public UpdateItemStateObject

Returns:

The newly added UpdateItemStateObject
addItem
(ListIterator<String>
The paths of the value to update
paths
,
String
The string representation of the new value to parse and to convert into a StateObject representation
newValue
)

Adds a new UPDATE item to this clause.

public UpdateItemStateObject

Returns:

The newly added UpdateItemStateObject
addItem
(String
The path of the value to update
path
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItem.

Adds a new UPDATE item to this clause.
public UpdateItemStateObject

Returns:

The newly added UpdateItemStateObject
addItem
(String
The path of the value to update
path
,
StateObject
The StateObject representing the new value
newValue
)

Adds a new UPDATE item to this clause.

public UpdateItemStateObject

Returns:

The newly added UpdateItemStateObject
addItem
(String
The path of the value to update
path
,
String
The string representation of the new value to parse and to convert into a StateObject representation
newValue
)

Adds a new UPDATE item to this clause.

public UpdateItemStateObject

Returns:

The newly added UpdateItemStateObject
addItem
(String[]
The paths of the value to update
paths
,
StateObject
The StateObject representing the new value
newValue
)

Adds a new UPDATE item to this clause.

public UpdateItemStateObject

Returns:

The newly added UpdateItemStateObject
addItem
(String[]
The paths of the value to update
paths
,
String
The string representation of the new value to parse and to convert into a StateObject representation
newValue
)

Adds a new UPDATE item to this clause.

public <S extends UpdateItemStateObject> S
addItem(S
The child StateObject to become a child of this one return The given item
item
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItem.

Adds the given StateObject as a child of this one.
public void
addItems(List<? extends UpdateItemStateObject>
The StateObjects to become children of this one
items
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItems.

Adds the given list of StateObjects as children of this one.
public void
addListChangeListener(String
The name of the list for which the listener will be notified when the content of the list has changed
listName
,
IListChangeListener<UpdateItemStateObject>
The listener to be notified upon changes
listener
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addListChangeListener.

Registers the given IListChangeListener for the specified list.
protected boolean

Returns:

true if both have equivalent children; false otherwise
areChildrenEquivalent
(UpdateClauseStateObject
The StateObject to compare its children to this one's children
stateObject
)

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

public boolean
canMoveDown(UpdateItemStateObject
The StateObject that could potentially be moved down
item
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveDown.

Determines whether the given StateObject can be moved down by one position in the list owned by its parent.
public boolean
canMoveUp(UpdateItemStateObject
The StateObject that could potentially be moved up
item
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveUp.

Determines whether the given StateObject can be moved up by one position in the list owned by its parent.
public UpdateClause
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 String
public UpdateItemStateObject
getItem(int
The position of the StateObject to retrieve
index
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.getItem.

Returns the StateObject at the given positions from the list
public UpdateStatementStateObject
public boolean
protected void
public boolean
isEquivalent(StateObject
The StateObject to compare its content to this one
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject.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.
public boolean

Returns:

true if the identification variable has been specified; false otherwise, which means it has been generated based on the abstract schema name
isIdentificationVariableDefined
()

Determines whether the identification variable has been defined.

public ListIterable<UpdateItemStateObject>
public int
itemsSize()

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.itemsSize.

Returns the number of children this list holder has.
public UpdateItemStateObject
moveDown(UpdateItemStateObject
The StateObject to move down in the list
item
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveDown.

Moves the given StateObject down by one position in the list owned by its parent.
public UpdateItemStateObject
moveUp(UpdateItemStateObject
The StateObject to move up in the list
item
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveUp.

Moves the given StateObject up by one position in the list owned by its parent.
public void
parse(String
The portion of the query representing a single update item
jpqlFragment
)

Parses the given fragment, which represents a single update item, and creates the StateObject equivalent.

public void
removeItem(UpdateItemStateObject
The child StateObject to not longer be a child
stateObject
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeItem.

Removes the given StateObject from the list of children.
public void
public void
removeListChangeListener(String
The name of the list for which the listener was registered
listName
,
IListChangeListener<UpdateItemStateObject>
The listener to unregister
listener
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeListChangeListener.

Unregisters the given IListChangeListener that was registered for the specified list.
public void
setExpression(UpdateClause
The parsed object representing an UPDATE clause
expression
)

Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

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

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject.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.AbstractModifyClauseStateObject:
declarationsfindManagedTypegetAbstractSchemaNamegetAbstractSchemaNameStateObjectgetDeclarationgetEntitygetIdentificationVariablegetIdentificationVariableStateObjectgetManagedTypegetRangeVariableDeclarationhasIdentificationVariablesetDeclarationsetDeclarationsetDeclarationsetDeclarationsetEntitysetEntityNamesetIdentificationVariable

Field Detail

itemsback to summary
private List<UpdateItemStateObject> items

The list of UpdateItemStateObject that represent the update items.

UPDATE_ITEMS_LISTback to summary
public static final String UPDATE_ITEMS_LIST

Notify the list of StateObjects representing the update items.

Constructor Detail

UpdateClauseStateObjectback to summary
public UpdateClauseStateObject(UpdateStatementStateObject parent)

Creates a new UpdateClauseStateObject.

Parameters
parent:UpdateStatementStateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

acceptback to summary
public void accept(StateObjectVisitor visitor)

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

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

Visits this StateObject by the given visitor.

Parameters
visitor:StateObjectVisitor

The visitor to visit this object

Annotations
@Override
addChildrenback to summary
protected void addChildren(List<StateObject> children)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject.addChildren.

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

Adds the children of this StateObject to the given list.

Parameters
children:List<StateObject>

The list used to store the children

Annotations
@Override
addItemback to summary
public UpdateItemStateObject addItem()

Adds a new UPDATE item to this clause.

Returns:UpdateItemStateObject

The newly added UpdateItemStateObject

addItemback to summary
public UpdateItemStateObject addItem(ListIterator<String> paths, StateObject newValue)

Adds a new UPDATE item to this clause.

Parameters
paths:ListIterator<String>

The paths of the value to update

newValue:StateObject

The StateObject representing the new value

Returns:UpdateItemStateObject

The newly added UpdateItemStateObject

addItemback to summary
public UpdateItemStateObject addItem(ListIterator<String> paths, String newValue)

Adds a new UPDATE item to this clause.

Parameters
paths:ListIterator<String>

The paths of the value to update

newValue:String

The string representation of the new value to parse and to convert into a StateObject representation

Returns:UpdateItemStateObject

The newly added UpdateItemStateObject

addItemback to summary
public UpdateItemStateObject addItem(String path)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItem.

Adds a new UPDATE item to this clause.

Parameters
path:String

The path of the value to update

Returns:UpdateItemStateObject

The newly added UpdateItemStateObject

addItemback to summary
public UpdateItemStateObject addItem(String path, StateObject newValue)

Adds a new UPDATE item to this clause.

Parameters
path:String

The path of the value to update

newValue:StateObject

The StateObject representing the new value

Returns:UpdateItemStateObject

The newly added UpdateItemStateObject

addItemback to summary
public UpdateItemStateObject addItem(String path, String newValue)

Adds a new UPDATE item to this clause.

Parameters
path:String

The path of the value to update

newValue:String

The string representation of the new value to parse and to convert into a StateObject representation

Returns:UpdateItemStateObject

The newly added UpdateItemStateObject

addItemback to summary
public UpdateItemStateObject addItem(String[] paths, StateObject newValue)

Adds a new UPDATE item to this clause.

Parameters
paths:String[]

The paths of the value to update

newValue:StateObject

The StateObject representing the new value

Returns:UpdateItemStateObject

The newly added UpdateItemStateObject

addItemback to summary
public UpdateItemStateObject addItem(String[] paths, String newValue)

Adds a new UPDATE item to this clause.

Parameters
paths:String[]

The paths of the value to update

newValue:String

The string representation of the new value to parse and to convert into a StateObject representation

Returns:UpdateItemStateObject

The newly added UpdateItemStateObject

addItemback to summary
public <S extends UpdateItemStateObject> S addItem(S item)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItem.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItem.

Adds the given StateObject as a child of this one.

Parameters
item:S

The child StateObject to become a child of this one return The given item

Annotations
@Override
addItemsback to summary
public void addItems(List<? extends UpdateItemStateObject> items)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItems.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItems.

Adds the given list of StateObjects as children of this one.

Parameters
items:List<? extends UpdateItemStateObject>

The StateObjects to become children of this one

Annotations
@Override
addListChangeListenerback to summary
public void addListChangeListener(String listName, IListChangeListener<UpdateItemStateObject> listener)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addListChangeListener.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addListChangeListener.

Registers the given IListChangeListener for the specified list. The listener will be notified only when items are added, removed, moved from the list.

Parameters
listName:String

The name of the list for which the listener will be notified when the content of the list has changed

listener:IListChangeListener<UpdateItemStateObject>

The listener to be notified upon changes

Annotations
@Override
areChildrenEquivalentback to summary
protected boolean areChildrenEquivalent(UpdateClauseStateObject stateObject)

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

Parameters
stateObject:UpdateClauseStateObject

The StateObject to compare its children to this one's children

Returns:boolean

true if both have equivalent children; false otherwise

canMoveDownback to summary
public boolean canMoveDown(UpdateItemStateObject item)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveDown.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveDown.

Determines whether the given StateObject can be moved down by one position in the list owned by its parent.

Parameters
item:UpdateItemStateObject

The StateObject that could potentially be moved down

Returns:boolean

true if the object can be moved down by one unit; false otherwise

Annotations
@Override
canMoveUpback to summary
public boolean canMoveUp(UpdateItemStateObject item)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveUp.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveUp.

Determines whether the given StateObject can be moved up by one position in the list owned by its parent.

Parameters
item:UpdateItemStateObject

The StateObject that could potentially be moved up

Returns:boolean

true if the object can be moved up by one unit; false otherwise

Annotations
@Override
getExpressionback to summary
public UpdateClause 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:UpdateClause

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
getIdentifierback to summary
public String getIdentifier()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject.getIdentifier.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject.getIdentifier.

Returns the JPQL identifier of this clause.

Returns:String

The JPQL identifier

Annotations
@Override
getItemback to summary
public UpdateItemStateObject getItem(int index)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.getItem.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.getItem.

Returns the StateObject at the given positions from the list

Parameters
index:int

The position of the StateObject to retrieve

Returns:UpdateItemStateObject

The StateObject at the given position

Annotations
@Override
getParentback to summary
public UpdateStatementStateObject getParent()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject.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:UpdateStatementStateObject

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

Annotations
@Override
hasItemsback to summary
public boolean hasItems()

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.hasItems.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.hasItems.

Determines whether this StateObject has any children.

Returns:boolean

true if this StateObject has children; false otherwise

Annotations
@Override
initializeback to summary
protected void initialize()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject.initialize.

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

Initializes this state object.

Annotations
@Override
isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject.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
isIdentificationVariableDefinedback to summary
public boolean isIdentificationVariableDefined()

Determines whether the identification variable has been defined.

Returns:boolean

true if the identification variable has been specified; false otherwise, which means it has been generated based on the abstract schema name

itemsback to summary
public ListIterable<UpdateItemStateObject> items()

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.items.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.items.

Returns an ListIterable over the children.

Returns:ListIterable<UpdateItemStateObject>

An ListIterable that is iterating over the children

Annotations
@Override
itemsSizeback to summary
public int itemsSize()

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.itemsSize.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.itemsSize.

Returns the number of children this list holder has.

Returns:int

The count of StateObjects that are children of this one

Annotations
@Override
moveDownback to summary
public UpdateItemStateObject moveDown(UpdateItemStateObject item)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveDown.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveDown.

Moves the given StateObject down by one position in the list owned by its parent.

Parameters
item:UpdateItemStateObject

The StateObject to move down in the list

Returns:UpdateItemStateObject

The given item

Annotations
@Override
moveUpback to summary
public UpdateItemStateObject moveUp(UpdateItemStateObject item)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveUp.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveUp.

Moves the given StateObject up by one position in the list owned by its parent.

Parameters
item:UpdateItemStateObject

The StateObject to move up in the list

Returns:UpdateItemStateObject

The given item

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

Parses the given fragment, which represents a single update item, and creates the StateObject equivalent.

Parameters
jpqlFragment:String

The portion of the query representing a single update item

removeItemback to summary
public void removeItem(UpdateItemStateObject stateObject)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeItem.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeItem.

Removes the given StateObject from the list of children.

Parameters
stateObject:UpdateItemStateObject

The child StateObject to not longer be a child

Annotations
@Override
removeItemsback to summary
public void removeItems(Collection<UpdateItemStateObject> items)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeItems.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeItems.

Removes the given StateObject from the list of children.

Parameters
items:Collection<UpdateItemStateObject>

The StateObjects to remove from this one

Annotations
@Override
removeListChangeListenerback to summary
public void removeListChangeListener(String listName, IListChangeListener<UpdateItemStateObject> listener)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeListChangeListener.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeListChangeListener.

Unregisters the given IListChangeListener that was registered for the specified list. The listener will no longer be notified only when items are added, removed, moved from the list.

Parameters
listName:String

The name of the list for which the listener was registered

listener:IListChangeListener<UpdateItemStateObject>

The listener to unregister

Annotations
@Override
setExpressionback to summary
public void setExpression(UpdateClause expression)

Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

Parameters
expression:UpdateClause

The parsed object representing an UPDATE clause

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

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject.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