com.vaadin.data.util.sqlcontainer.
Class SQLContainer
java.lang.Object
com.vaadin.data.util.sqlcontainer.SQLContainer
All Implemented Interfaces:
Container, Container.Filterable, Container.Indexed, Container.ItemSetChangeNotifier, Container.Ordered, Container.Sortable, Serializable
- extends Object
- implements Container, Container.Filterable, Container.Indexed, Container.Sortable, Container.ItemSetChangeNotifier
public class SQLContainer
See Also:
Nested Class Summary | |
---|---|
class |
SQLContainer.ItemSetChangeEvent
Simple ItemSetChangeEvent implementation. |
Nested classes/interfaces inherited from interface com.vaadin.data.Container |
---|
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeEvent, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer |
Nested classes/interfaces inherited from interface com.vaadin.data.Container |
---|
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeEvent, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer |
Nested classes/interfaces inherited from interface com.vaadin.data.Container |
---|
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeEvent, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer |
Nested classes/interfaces inherited from interface com.vaadin.data.Container |
---|
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeEvent, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer |
Field Summary | |
---|---|
static int |
CACHE_RATIO
Number of items to cache = CACHE_RATIO x pageLength |
static int |
DEFAULT_PAGE_LENGTH
|
Constructor Summary | |
---|---|
SQLContainer(QueryDelegate delegate)
Creates and initializes SQLContainer using the given QueryDelegate |
Method Summary | |
---|---|
void |
addContainerFilter(Container.Filter filter)
Adds a filter for the container. |
void |
addContainerFilter(Object propertyId,
String filterString,
boolean ignoreCase,
boolean onlyMatchPrefix)
|
boolean |
addContainerProperty(Object propertyId,
Class<?> type,
Object defaultValue)
Adds a new Property to all Items in the Container. |
Object |
addItem()
Note! If auto commit mode is enabled, this method will still return the temporary row ID assigned for the item. |
Item |
addItem(Object itemId)
Creates a new Item with the given ID in the Container. |
Object |
addItemAfter(Object previousItemId)
Adds a new item after the given item. |
Item |
addItemAfter(Object previousItemId,
Object newItemId)
Adds a new item after the given item. |
Object |
addItemAt(int index)
Adds a new item at given index (in the filtered view). |
Item |
addItemAt(int index,
Object newItemId)
Adds a new item at given index (in the filtered view). |
void |
addListener(Container.ItemSetChangeListener listener)
Adds an Item set change listener for the object. |
void |
addListener(QueryDelegate.RowIdChangeListener listener)
Adds a RowIdChangeListener to the QueryDelegate |
void |
addOrderBy(OrderBy orderBy)
Adds the given OrderBy to this container and refreshes the container contents with the new sorting rules. |
void |
addReference(SQLContainer refdCont,
String refingCol,
String refdCol)
Adds a new reference to the given SQLContainer. |
void |
commit()
Commits all the changes, additions and removals made to the items of this container. |
boolean |
containsId(Object itemId)
Tests if the Container contains the specified Item. |
void |
enableCacheFlushNotifications()
Calling this will enable this SQLContainer to send and receive cache flush notifications for its lifetime. |
protected void |
fireContentsChange()
|
Object |
firstItemId()
Gets the ID of the first Item in the Container. |
Property |
getContainerProperty(Object itemId,
Object propertyId)
Gets the Property identified by the given itemId and propertyId from the Container. |
Collection<?> |
getContainerPropertyIds()
Gets the ID's of all Properties stored in the Container. |
Object |
getIdByIndex(int index)
Gets the ID of an Item by an index number. |
Item |
getItem(Object itemId)
Gets the Item with the given Item ID from the Container. |
Collection<?> |
getItemIds()
NOTE! Do not use this method if in any way avoidable. |
Item |
getItemUnfiltered(Object itemId)
Bypasses in-memory filtering to return items that are cached in memory. |
int |
getPageLength()
Returns the currently set page length. |
protected QueryDelegate |
getQueryDelegate()
Returns the QueryDelegate set for this SQLContainer. |
Item |
getReferencedItem(Object itemId,
SQLContainer refdCont)
Fetches the referenced item from the target SQLContainer. |
Object |
getReferencedItemId(Object itemId,
SQLContainer refdCont)
Fetches the Item Id of the referenced item from the target SQLContainer. |
Collection<?> |
getSortableContainerPropertyIds()
Gets the container property IDs which can be used to sort the items. |
Class<?> |
getType(Object propertyId)
Gets the data type of all Properties identified by the given Property ID. |
int |
indexOfId(Object itemId)
Gets the index of the Item corresponding to the itemId. |
boolean |
isAutoCommit()
Returns status of the auto commit mode. |
boolean |
isFirstId(Object itemId)
Tests if the Item corresponding to the given Item ID is the first Item in the Container. |
boolean |
isLastId(Object itemId)
Tests if the Item corresponding to the given Item ID is the last Item in the Container. |
boolean |
isModified()
Returns modify state of the container. |
Object |
lastItemId()
Gets the ID of the last Item in the Container.. |
Object |
nextItemId(Object itemId)
Gets the ID of the Item following the Item that corresponds to itemId . |
Object |
prevItemId(Object itemId)
Gets the ID of the Item preceding the Item that corresponds to itemId . |
void |
refresh()
Refreshes the container - clears all caches and resets size and offset. |
void |
removeAllContainerFilters()
Remove all active filters from the container. |
boolean |
removeAllItems()
Removes all Items from the Container. |
void |
removeContainerFilter(Container.Filter filter)
Removes a filter from the container. |
void |
removeContainerFilters(Object propertyId)
|
boolean |
removeContainerProperty(Object propertyId)
Removes a Property specified by the given Property ID from the Container. |
boolean |
removeItem(Object itemId)
Removes the Item identified by ItemId from the Container. |
void |
removeListener(Container.ItemSetChangeListener listener)
Removes the Item set change listener from the object. |
void |
removeListener(QueryDelegate.RowIdChangeListener listener)
Removes a RowIdChangeListener from the QueryDelegate |
boolean |
removeReference(SQLContainer refdCont)
Removes the reference pointing to the given SQLContainer. |
void |
rollback()
Rolls back all the changes, additions and removals made to the items of this container. |
void |
setAutoCommit(boolean autoCommitEnabled)
Set auto commit mode enabled or disabled. |
void |
setPageLength(int pageLength)
Sets the page length used in lazy fetching of items from the data source. |
boolean |
setReferencedItem(Object itemId,
Object refdItemId,
SQLContainer refdCont)
Sets the referenced item. |
int |
size()
Gets the number of visible Items in the Container. |
void |
sort(Object[] propertyId,
boolean[] ascending)
Sort method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
DEFAULT_PAGE_LENGTH
public static final int DEFAULT_PAGE_LENGTH
See Also:
CACHE_RATIO
public static final int CACHE_RATIO
- See Also:
- Constant Field Values
Number of items to cache = CACHE_RATIO x pageLength
Constructor Detail |
---|
SQLContainer
public SQLContainer(QueryDelegate delegate)
throws SQLException
- Parameters:
delegate
- QueryDelegate implementation- Throws:
SQLException
Creates and initializes SQLContainer using the given QueryDelegate
Method Detail |
---|
addItem
public Object addItem()
throws UnsupportedOperationException
- Returns:
- ID of the newly created Item, or
null
in case of a failure - Throws:
UnsupportedOperationException
- if adding an item without an explicit item ID is not supported by the container
Note! If auto commit mode is enabled, this method will still return the temporary row ID assigned for the item. Implement QueryDelegate.RowIdChangeListener to receive the actual Row ID value after the addition has been committed. Creates a new Item into the Container, and assign it an automatic ID.
The new ID is returned, or null
if the operation fails.
After a successful call you can use the
method to fetch the Item.
getItem
This functionality is optional.
containsId
public boolean containsId(Object itemId)
- Specified by:
containsId
in interfaceContainer
- Parameters:
itemId
- ID the of Item to be tested- Returns:
- boolean indicating if the Container holds the specified Item
Description copied from interface: Container
Tests if the Container contains the specified Item. Filtering can hide items so that they will not be visible through the container API, and this method should respect visibility of items (i.e. only indicate visible items as being in the container) if feasible for the container.
getContainerProperty
public Property getContainerProperty(Object itemId,
Object propertyId)
- Specified by:
getContainerProperty
in interfaceContainer
- Parameters:
itemId
- ID of the visible Item which contains the PropertypropertyId
- ID of the Property to retrieve- Returns:
- Property with the given ID or
null
Description copied from interface: Container
Gets the Property identified by the given itemId and propertyId from the
Container. If the Container does not contain the item or it is filtered
out, or the Container does not have the Property, null
is
returned.
getContainerPropertyIds
public Collection<?> getContainerPropertyIds()
- Specified by:
getContainerPropertyIds
in interfaceContainer
- Returns:
- unmodifiable collection of Property IDs
Description copied from interface: Container
Gets the ID's of all Properties stored in the Container. The ID's cannot be modified through the returned collection.
getItem
public Item getItem(Object itemId)
Description copied from interface: Container
Gets the Item
with the given Item ID from the Container. If the
Container does not contain the requested Item, null
is
returned.
Containers should not return Items that are filtered out.
getItemUnfiltered
public Item getItemUnfiltered(Object itemId)
- Parameters:
itemId
- the id of the item to retrieve.- Returns:
- the item represented by itemId.
Bypasses in-memory filtering to return items that are cached in memory. NOTE: This does not bypass database-level filtering.
getItemIds
public Collection<?> getItemIds()
- Specified by:
getItemIds
in interfaceContainer
- Returns:
- unmodifiable collection of Item IDs
NOTE! Do not use this method if in any way avoidable. This method doesn't
(and cannot) use lazy loading, which means that all rows in the database
will be loaded into memory.
Gets the ID's of all visible (after filtering and sorting) Items stored
in the Container. The ID's cannot be modified through the returned
collection.
If the container is Container.Ordered
, the collection returned by this
method should follow that order. If the container is Container.Sortable
,
the items should be in the sorted order.
Calling this method for large lazy containers can be an expensive
operation and should be avoided when practical.
getType
public Class<?> getType(Object propertyId)
- Parameters:
propertyId
- ID identifying the Properties- Returns:
- data type of the Properties
Description copied from interface: Container
Gets the data type of all Properties identified by the given Property ID.
size
public int size()
- Returns:
- number of Items in the Container
Description copied from interface: Container
Gets the number of visible Items in the Container. Filtering can hide items so that they will not be visible through the container API.
removeItem
public boolean removeItem(Object itemId)
throws UnsupportedOperationException
- Specified by:
removeItem
in interfaceContainer
- Parameters:
itemId
- ID of the Item to remove- Returns:
true
if the operation succeeded,false
if not- Throws:
UnsupportedOperationException
- if the container does not support removing individual items
Description copied from interface: Container
Removes the Item identified by ItemId
from the Container.
Containers that support filtering should also allow removing an item that is currently filtered out.
This functionality is optional.
removeAllItems
public boolean removeAllItems()
throws UnsupportedOperationException
- Specified by:
removeAllItems
in interfaceContainer
- Returns:
true
if the operation succeeded,false
if not- Throws:
UnsupportedOperationException
- if the container does not support removing all items
Description copied from interface: Container
Removes all Items from the Container.
Note that Property ID and type information is preserved. This functionality is optional.
addContainerFilter
public void addContainerFilter(Container.Filter filter)
throws UnsupportedFilterException
- Specified by:
addContainerFilter
in interfaceContainer.Filterable
- Throws:
UnsupportedFilterException
- if the filter is not supported by the container
Adds a filter for the container. If a container has multiple filters, only items accepted by all filters are visible.
removeContainerFilter
public void removeContainerFilter(Container.Filter filter)
- Specified by:
removeContainerFilter
in interfaceContainer.Filterable
Removes a filter from the container. This requires that the equals() method considers the filters as equivalent (same instance or properly implemented equals() method).
addContainerFilter
public void addContainerFilter(Object propertyId,
String filterString,
boolean ignoreCase,
boolean onlyMatchPrefix)
removeContainerFilters
public void removeContainerFilters(Object propertyId)
removeAllContainerFilters
public void removeAllContainerFilters()
- Specified by:
removeAllContainerFilters
in interfaceContainer.Filterable
Remove all active filters from the container.
indexOfId
public int indexOfId(Object itemId)
- Specified by:
indexOfId
in interfaceContainer.Indexed
- Parameters:
itemId
- ID of an Item in the Container- Returns:
- index of the Item, or -1 if (the filtered and sorted view of) the Container does not include the Item
Description copied from interface: Container.Indexed
Gets the index of the Item corresponding to the itemId. The following
is true
for the returned index: 0 <= index < size(), or
index = -1 if there is no visible item with that id in the container.
getIdByIndex
public Object getIdByIndex(int index)
- Specified by:
getIdByIndex
in interfaceContainer.Indexed
- Parameters:
index
- Index of the requested id in (the filtered and sorted view of) the Container- Returns:
- ID of the Item in the given index
Description copied from interface: Container.Indexed
Gets the ID of an Item by an index number.
nextItemId
public Object nextItemId(Object itemId)
- Specified by:
nextItemId
in interfaceContainer.Ordered
- Parameters:
itemId
- ID of a visible Item in the Container- Returns:
- ID of the next visible Item or
null
Description copied from interface: Container.Ordered
Gets the ID of the Item following the Item that corresponds to
itemId
. If the given Item is the last or not found in
the Container, null
is returned.
prevItemId
public Object prevItemId(Object itemId)
- Specified by:
prevItemId
in interfaceContainer.Ordered
- Parameters:
itemId
- ID of a visible Item in the Container- Returns:
- ID of the previous visible Item or
null
Description copied from interface: Container.Ordered
Gets the ID of the Item preceding the Item that corresponds to
itemId
. If the given Item is the first or not found in
the Container, null
is returned.
firstItemId
public Object firstItemId()
- Specified by:
firstItemId
in interfaceContainer.Ordered
- Returns:
- ID of the first visible Item in the Container
Description copied from interface: Container.Ordered
Gets the ID of the first Item in the Container.
lastItemId
public Object lastItemId()
- Specified by:
lastItemId
in interfaceContainer.Ordered
- Returns:
- ID of the last visible Item in the Container
Description copied from interface: Container.Ordered
Gets the ID of the last Item in the Container..
isFirstId
public boolean isFirstId(Object itemId)
- Specified by:
isFirstId
in interfaceContainer.Ordered
- Parameters:
itemId
- ID of an Item in the Container- Returns:
true
if the Item is first visible item in the Container,false
if not
Description copied from interface: Container.Ordered
Tests if the Item corresponding to the given Item ID is the first Item in the Container.
isLastId
public boolean isLastId(Object itemId)
- Specified by:
isLastId
in interfaceContainer.Ordered
- Returns:
true
if the Item is last visible item in the Container,false
if not
Description copied from interface: Container.Ordered
Tests if the Item corresponding to the given Item ID is the last Item in the Container.
sort
public void sort(Object[] propertyId,
boolean[] ascending)
- Specified by:
sort
in interfaceContainer.Sortable
- Parameters:
propertyId
- Array of container property IDs, whose values are used to sort the items in container as primary, secondary, ... sorting criterion. All of the item IDs must be in the collection returned byContainer.Sortable.getSortableContainerPropertyIds()
ascending
- Array of sorting order flags corresponding to each property ID used in sorting. If this array is shorter than propertyId array, ascending order is assumed for items where the order is not specified. Usetrue
to sort in ascending order,false
to use descending order.
Description copied from interface: Container.Sortable
Sort method. Sorts the container items. Sorting a container can irreversibly change the order of its items or only change the order temporarily, depending on the container.
getSortableContainerPropertyIds
public Collection<?> getSortableContainerPropertyIds()
- Specified by:
getSortableContainerPropertyIds
in interfaceContainer.Sortable
- Returns:
- the IDs of the properties that can be used for sorting the container
Description copied from interface: Container.Sortable
Gets the container property IDs which can be used to sort the items.
refresh
public void refresh()
Refreshes the container - clears all caches and resets size and offset. Does NOT remove sorting or filtering rules!
isModified
public boolean isModified()
- Returns:
- true if contents of this container have been modified
Returns modify state of the container.
setAutoCommit
public void setAutoCommit(boolean autoCommitEnabled)
- Parameters:
autoCommitEnabled
- true to enable auto commit mode
Set auto commit mode enabled or disabled. Auto commit mode means that all changes made to items of this container will be immediately written to the underlying data source.
isAutoCommit
public boolean isAutoCommit()
- Returns:
- true if auto commit mode is enabled
Returns status of the auto commit mode.
getPageLength
public int getPageLength()
- Returns:
- current page length
Returns the currently set page length.
setPageLength
public void setPageLength(int pageLength)
- Parameters:
pageLength
- new page length
Sets the page length used in lazy fetching of items from the data source. Also resets the cache size to match the new page length. As a side effect the container will be refreshed.
addOrderBy
public void addOrderBy(OrderBy orderBy)
- Parameters:
orderBy
- OrderBy to be added to the container sorting rules
Adds the given OrderBy to this container and refreshes the container contents with the new sorting rules. Note that orderBy.getColumn() must return a column name that exists in this container.
commit
public void commit()
throws UnsupportedOperationException,
SQLException
Commits all the changes, additions and removals made to the items of this container.
rollback
public void rollback()
throws UnsupportedOperationException,
SQLException
Rolls back all the changes, additions and removals made to the items of this container.
getQueryDelegate
protected QueryDelegate getQueryDelegate()
- Returns:
- current querydelegate
Returns the QueryDelegate set for this SQLContainer.
addContainerProperty
public boolean addContainerProperty(Object propertyId,
Class<?> type,
Object defaultValue)
throws UnsupportedOperationException
- Specified by:
addContainerProperty
in interfaceContainer
- Parameters:
propertyId
- ID of the Propertytype
- Data type of the new PropertydefaultValue
- The value all created Properties are initialized to- Returns:
true
if the operation succeeded,false
if not- Throws:
UnsupportedOperationException
- if the container does not support explicitly adding container properties
Description copied from interface: Container
Adds a new Property to all Items in the Container. The Property ID, data type and default value of the new Property are given as parameters. This functionality is optional.
removeContainerProperty
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException
- Specified by:
removeContainerProperty
in interfaceContainer
- Parameters:
propertyId
- ID of the Property to remove- Returns:
true
if the operation succeeded,false
if not- Throws:
UnsupportedOperationException
- if the container does not support removing container properties
Description copied from interface: Container
Removes a Property specified by the given Property ID from the Container. Note that the Property will be removed from all Items in the Container. This functionality is optional.
addItem
public Item addItem(Object itemId)
throws UnsupportedOperationException
- Parameters:
itemId
- ID of the Item to be created- Returns:
- Created new Item, or
null
in case of a failure - Throws:
UnsupportedOperationException
- if adding an item with an explicit item ID is not supported by the container
Description copied from interface: Container
Creates a new Item with the given ID in the Container.
The new Item is returned, and it is ready to have its Properties
modified. Returns null
if the operation fails or the
Container already contains a Item with the given ID.
This functionality is optional.
addItemAfter
public Item addItemAfter(Object previousItemId,
Object newItemId)
throws UnsupportedOperationException
- Specified by:
addItemAfter
in interfaceContainer.Ordered
- Parameters:
previousItemId
- Id of the visible item in ordered container after which to insert the new item.newItemId
- Id of the new item to be added.- Returns:
- new item or null if the operation fails.
- Throws:
UnsupportedOperationException
- if the operation is not supported by the container- See Also:
Ordered: adding items in filtered or sorted containers
Description copied from interface: Container.Ordered
Adds a new item after the given item.
Adding an item after null item adds the item as first item of the ordered container.
addItemAt
public Item addItemAt(int index,
Object newItemId)
throws UnsupportedOperationException
- Specified by:
addItemAt
in interfaceContainer.Indexed
- Parameters:
index
- Index (in the filtered and sorted view) at which to add the new item.newItemId
- Id of the new item to be added.- Returns:
- new
Item
or null if the operation fails. - Throws:
UnsupportedOperationException
- if the operation is not supported by the container
Description copied from interface: Container.Indexed
Adds a new item at given index (in the filtered view).
The indexes of the item currently in the given position and all the following items are incremented.
This method should apply filters to the added item after inserting
it, possibly hiding it immediately. If the container is being sorted,
the item may be added at the correct sorted position instead of the
given position. See Container.Indexed
, Container.SimpleFilterable
and
Container.Sortable
for more information.
addItemAt
public Object addItemAt(int index)
throws UnsupportedOperationException
- Specified by:
addItemAt
in interfaceContainer.Indexed
- Parameters:
index
- Index (in the filtered and sorted view) to add the new item.- Returns:
- item id of the created item or null if the operation fails.
- Throws:
UnsupportedOperationException
- if the operation is not supported by the container
Description copied from interface: Container.Indexed
Adds a new item at given index (in the filtered view).
The indices of the item currently in the given position and all the following items are incremented.
This method should apply filters to the added item after inserting
it, possibly hiding it immediately. If the container is being sorted,
the item may be added at the correct sorted position instead of the
given position. See Container.Indexed
, Container.Ordered
,
Container.SimpleFilterable
and Container.Sortable
for more information.
addItemAfter
public Object addItemAfter(Object previousItemId)
throws UnsupportedOperationException
- Specified by:
addItemAfter
in interfaceContainer.Ordered
- Parameters:
previousItemId
- Id of the visible item in ordered container after which to insert the new item.- Returns:
- item id the the created new item or null if the operation fails.
- Throws:
UnsupportedOperationException
- if the operation is not supported by the container- See Also:
Ordered: adding items in filtered or sorted containers
Description copied from interface: Container.Ordered
Adds a new item after the given item.
Adding an item after null item adds the item as first item of the ordered container.
addListener
public void addListener(Container.ItemSetChangeListener listener)
- Specified by:
addListener
in interfaceContainer.ItemSetChangeNotifier
- Parameters:
listener
- listener to be added
Description copied from interface: Container.ItemSetChangeNotifier
Adds an Item set change listener for the object.
removeListener
public void removeListener(Container.ItemSetChangeListener listener)
- Specified by:
removeListener
in interfaceContainer.ItemSetChangeNotifier
- Parameters:
listener
- listener to be removed
Description copied from interface: Container.ItemSetChangeNotifier
Removes the Item set change listener from the object.
fireContentsChange
protected void fireContentsChange()
addListener
public void addListener(QueryDelegate.RowIdChangeListener listener)
- Parameters:
listener
-
Adds a RowIdChangeListener to the QueryDelegate
removeListener
public void removeListener(QueryDelegate.RowIdChangeListener listener)
- Parameters:
listener
-
Removes a RowIdChangeListener from the QueryDelegate
enableCacheFlushNotifications
public void enableCacheFlushNotifications()
Calling this will enable this SQLContainer to send and receive cache flush notifications for its lifetime.
addReference
public void addReference(SQLContainer refdCont,
String refingCol,
String refdCol)
- Parameters:
refdCont
- Target SQLContainer of the new referencerefingCol
- Column (property) name in this container storing the (foreign key) referencerefdCol
- Column (property) name in the referenced container storing the referenced key
Adds a new reference to the given SQLContainer. In addition to the container you must provide the column (property) names used for the reference in both this and the referenced SQLContainer. Note that multiple references pointing to the same SQLContainer are not supported.
removeReference
public boolean removeReference(SQLContainer refdCont)
- Parameters:
refdCont
- Target SQLContainer of the reference- Returns:
- true if successful, false if the reference did not exist
Removes the reference pointing to the given SQLContainer.
setReferencedItem
public boolean setReferencedItem(Object itemId,
Object refdItemId,
SQLContainer refdCont)
- Parameters:
itemId
- Item Id of the reference source (from this container)refdItemId
- Item Id of the reference target (from referenced container)refdCont
- Target SQLContainer of the reference- Returns:
- true if the referenced item was successfully set, false on failure
Sets the referenced item. The referencing column of the item in this container is updated accordingly.
getReferencedItemId
public Object getReferencedItemId(Object itemId,
SQLContainer refdCont)
- Parameters:
itemId
- Item Id of the reference source (from this container)refdCont
- Target SQLContainer of the reference- Returns:
- Item Id of the referenced item, or null if not found
Fetches the Item Id of the referenced item from the target SQLContainer.
getReferencedItem
public Item getReferencedItem(Object itemId,
SQLContainer refdCont)
- Parameters:
itemId
- Item Id of the reference source (from this container)refdCont
- Target SQLContainer of the reference- Returns:
- The referenced item, or null if not found
Fetches the referenced item from the target SQLContainer.