public class UncachedSelectorCollection extends Object implements Collection
By not caching its items, an UncachedSelectorCollection maintains a small memory footprint. However, each use of the collection causes a database roundtrip, making UncachedSelectorCollection less performant than CachedSelectorCollection.
The order of items returned by getItems()
and
getItemsVector()
is determined by the sort specification of the
Selector or S_Selector. 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.
The LIBRARYOBJECTs returned by the Selector or S_Selector must have a Name
attribute. Use getItems(String)
to look up an item by name.
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 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 String |
m_NameExpression
The SQL expression for the specified Selector or S_Selector
that evaluates to the uppercase name of the item.
|
protected oracle.ifs.common.UncachedSelectorCollection.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 Selector |
m_Selector
The Selector used to obtain the items in this Collection
(if this is a collection of LibraryObjects).
|
protected S_Selector |
m_SSelector
The S_Selector used to obtain the items in this Collection
(if this is a collection of S_LibraryObjects).
|
Constructor and Description |
---|
UncachedSelectorCollection(S_Selector selector,
String nameExpression,
String className,
int maximumRecentItems)
Constructs a collection of S_LibraryObjects.
|
UncachedSelectorCollection(Selector selector,
String nameExpression,
String className,
int maximumRecentItems)
Constructs a collection of 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_Selector m_SSelector
protected Selector m_Selector
protected String m_NameExpression
protected int m_ItemCount
protected oracle.ifs.common.UncachedSelectorCollection.ItemLink m_RecentItems
protected int m_MaximumRecentItems
public UncachedSelectorCollection(S_Selector selector, String nameExpression, String className, int maximumRecentItems) throws IfsException
selector
- the S_Selector used to obtain the items
in the CollectionnameExpression
- the SQL expression for the S_Selector that
evaluates to the uppercased name of an itemclassName
- the full classname of the objects in
this Collection; must be S_LibraryObject
or a subclass of S_LibraryObject; if null,
S_LibraryObject is usedmaximumRecentItems
- the maximum number of items recently returned
by getItems(String)
to cache;
typical values are 1 to 50, or 0 to disable
cachingIfsException
- (IFS-12210) if the operation failspublic UncachedSelectorCollection(Selector selector, String nameExpression, String className, int maximumRecentItems) throws IfsException
selector
- the Selector used to obtain the items
in the CollectionnameExpression
- the SQL expression for the Selector that
evaluates to the uppercased name of an itemclassName
- the full classname of the objects in
this Collection; must be LibraryObject
or a subclass of LibraryObject; if null,
LibraryObject is usedmaximumRecentItems
- the maximum number of items recently returned
by getItems(String)
to cache;
typical values are 1 to 50, or 0 to disable
cachingIfsException
- (IFS-12210) if the operation failspublic int getItemCount() throws IfsException
getItemCount
in interface Collection
IfsException
- (IFS-12211) if the operation failspublic Object[] getItems() throws IfsException
getItems
in interface Collection
IfsException
- (IFS-12212) if the operation failspublic Object getItems(int index) throws IfsException
getItems
in interface Collection
index
- the zero-based index of the itemIfsException
- (IFS-12213) if the operation failspublic 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
- (IFS-12214) if the operation failspublic Object checkItemByUpperCaseName(String upperCaseName) throws IfsException
checkItemByUpperCaseName
in interface Collection
upperCaseName
- the name of the itemIfsException
- (IFS-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
- (IFS-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
- (IFS-12216) if the operation failsprotected final void resolve() throws IfsException
IfsException
- (IFS-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.