public class UncachedPreparedSelectorCollection extends Object implements Collection
By not caching its items, an UncachedPreparedSelectorCollection maintains a small memory footprint. However, each use of the collection causes a database roundtrip, making UncachedPreparedSelectorCollection less performant than CachedSelectorCollection.
A PreparedSelector is used so that the same preparedStatement can be used
internally. The getItemCount
method is not supported
by this type of Collection.
The order of items returned by getItems()
and
getItemsVector()
is determined by the sort specification of the
PreparedSelector or S_PreparedSelector. The method
getItems(int)
is implemented
in terms of getItems()
. For best performance in
iterating over
the items of the collection, call getItems()
once
instead of getItems(int)
repeatedly.
Use getItems(String)
to look up an item by name (or
equivalent, as specified by the nameExpresion during construction).
This lookup is case-insentive. If more than one item has the same
case-insensitive name, getItems(String)
returns an arbitrary
item with that name.
The performance of getItems(String)
can be improved by enabling
a mini-cache of the "n" items most-recently returned by this method. The
size of this mini-cache is specified by a constructor argument.
Modifier and Type | Field and Description |
---|---|
protected Class |
m_Class
The class of the objects in this Collection.
|
protected String |
m_GetItemsSearchCondition
The search condition to use to get all items in the collection.
|
protected int |
m_ItemCount
The number of items in this collection, or -1 if unknown.
|
protected int |
m_MaximumRecentItems
The maximum length of m_RecentItems.
|
protected oracle.ifs.common.UncachedPreparedSelectorCollection.ItemLink |
m_RecentItems
A linked list of the "n" items most recently returned
by getItems(String), with the most recent at the head
and the least recent at the tail of the list.
|
protected PreparedSelector |
m_Selector
The PreparedSelector used to obtain the items in this Collection
(if this is a collection of LibraryObjects).
|
protected S_PreparedSelector |
m_SSelector
The S_PreparedSelector used to obtain the items in this Collection
(if this is a collection of S_LibraryObjects).
|
Constructor and Description |
---|
UncachedPreparedSelectorCollection(PreparedSelector sel,
String className,
String getItemsClause,
int maxRecentItems)
Constructs a collection of LibraryObjects.
|
UncachedPreparedSelectorCollection(S_PreparedSelector sel,
String className,
String getItemsClause,
int maxRecentItems)
Constructs a collection of S_LibraryObjects.
|
Modifier and Type | Method and Description |
---|---|
Object |
checkItemByUpperCaseName(String upperCaseName)
Gets the specified item in this Collection by uppercase name,
and returns null if not found.
|
Object |
getItemByUpperCaseName(String upperCaseName)
Gets the specified item in this Collection by uppercase name.
|
int |
getItemCount()
Gets the number of items in this Collection.
|
Object[] |
getItems()
Gets an array containing the items in this Collection.
|
Object |
getItems(int index)
Gets the specified item in this Collection.
|
Object |
getItems(String name)
Gets the specified item in this Collection.
|
Vector |
getItemsVector()
Gets a vector containing the items in this Collection.
|
void |
handleEvent(IfsEvent event)
Handles the specified event.
|
void |
reset()
Resets this Collection.
|
protected void |
resolve()
Ensures the items in this Collection are resolved.
|
protected Class m_Class
The value returned by getItems() can be cast to an array of this type.
protected S_PreparedSelector m_SSelector
protected PreparedSelector m_Selector
protected String m_GetItemsSearchCondition
can be null, indicating no clause is needed.
protected int m_ItemCount
protected oracle.ifs.common.UncachedPreparedSelectorCollection.ItemLink m_RecentItems
protected int m_MaximumRecentItems
public UncachedPreparedSelectorCollection(S_PreparedSelector sel, String className, String getItemsClause, int maxRecentItems) throws IfsException
sel
- the S_PreparedSelector used to obtain the items
in the CollectionclassName
- the full classname of the objects in
this Collection; must be S_LibraryObject
or a subclass of S_LibraryObject; if null,
S_LibraryObject is usedgetItemsClause
- the search condition to use when selection all itemsmaxRecentItems
- the maximum number of items recently returned
by getItems(String)
to cache;
typical values are 1 to 50, or 0 to disable
cachingIfsException
- 12210: if the operation failspublic UncachedPreparedSelectorCollection(PreparedSelector sel, String className, String getItemsClause, int maxRecentItems) throws IfsException
sel
- the PreparedSelector used to obtain the items
in the CollectionclassName
- the full classname of the objects in
this Collection; must be LibraryObject
or a subclass of LibraryObject; if null,
LibraryObject is usedgetItemsClause
- the search condition to use when selection all itemsmaxRecentItems
- the maximum number of items recently returned
by getItems(String)
to cache;
typical values are 1 to 50, or 0 to disable
cachingIfsException
- 12210: if the operation failspublic int getItemCount() throws IfsException
This collection type does not support this operation.
getItemCount
in interface Collection
IfsException
- 19008: in all casespublic Object[] getItems() throws IfsException
getItems
in interface Collection
IfsException
- 12212: if the operation failspublic Object getItems(int index) throws IfsException
This collection type does not support this operation.
getItems
in interface Collection
index
- the zero-based index of the itemIfsException
- 19008: in all casespublic Object getItems(String name) throws IfsException
getItems
in interface Collection
name
- the name of the itemIfsException
- (IFS-12214) if the operation failspublic Object getItemByUpperCaseName(String upperCaseName) throws IfsException
getItemByUpperCaseName
in interface Collection
upperCaseName
- the name of the itemIfsException
- 12214: if the operation failspublic Object checkItemByUpperCaseName(String upperCaseName) throws IfsException
checkItemByUpperCaseName
in interface Collection
upperCaseName
- the name of the itemIfsException
- 12214: if the operation failspublic Vector getItemsVector() throws IfsException
The order of the items in the vector is identical to the order of the
items in the array returned by getItems()
.
getItemsVector
in interface Collection
IfsException
- 12215: if the operation failspublic void reset() throws IfsException
Resetting a Collection causes the items in it to be redetermined.
reset
in interface Collection
IfsException
- 12216: if the operation failsprotected final void resolve() throws IfsException
IfsException
- 12201: if the operation failspublic void handleEvent(IfsEvent event) throws IfsException
handleEvent
in interface IfsEventHandler
event
- the eventIfsException
- if the operation failsCopyright © 2023. All rights reserved.