public abstract class CSItemMultiple<E> extends CSDatabaseItem
CSItem
.
This class is used as a base-class for classes which represent multiple instances of iCM items. For example,
CSMediaMultiple
is used to load and manipulate a number of media items, and is derived from this class.
The exists()
, get()
, update()
,and delete()
methods
which form the bulk of the API are provided by this class, but their implementations are overridden by derived
classes.
LEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSItemMultiple()
Constructs a new
CSItemMultiple but does not specify which database it should use. |
CSItemMultiple(java.lang.String strPropertyFile)
Creates a new
CSItemMultiple , specifying a property file that contains all of the required
database connection details, such as the datasource name, user and password. |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Deletes multiple items from the database.
|
boolean |
equals(java.lang.Object obj)
Check whether or not this
CSItemMultiple is equal to another CSItemMultiple . |
boolean |
exist()
Checks to for the existence of several items on the database.
|
void |
get()
Gets items (
CSItem derived objects) from the database which match the specifications set with the
setXXX(...) |
java.util.ArrayList<E> |
getItems()
Gets the items (each a
CSItem derived object such as CSMedia in the case of
CSMediaMultiple ) stored within this CSItemMultiple object as an
Arraylist . |
int |
getMaxRows()
Gets the maximum number of rows of the query result set that will be retrieved when the
get method
is executed. |
java.lang.String |
getSortOrder()
Returns the sort order(s) that will be used by the
get method to order the retrieved items. |
int |
getStartRow()
Gets the number of the first row of the query results which will be used by the
get method. |
java.util.Iterator<E> |
iterator()
Gets an iterator for the items (
CSItem derived objects) that this CSItemMultiple object
holds. |
void |
setItems(java.util.ArrayList<E> arrItems)
Sets the items (each a
CSItem derived object such as CSMedia in the case of
CSMediaMultiple ) which this CSItemMultiple is to store. |
void |
setMaxRows(int nMaxRows)
Set the maximum number of rows of the query result set that should be retrieved when the
get
method is executed. |
void |
setSortOrder(java.lang.String strSortOrderList)
Sets the order in which items will be retrieved from the database via the
get method. |
void |
setStartRow(int nStartRow)
Sets the first row of the query result set that should be accessed when the
get method is
executed. |
java.lang.String |
toString()
Returns the contents of this
CSItemMultiple object as a string. |
void |
update()
Updates several items on the database.
|
clearRecordedGatewayMessages, clone, count, getCache, getCachingEnabled, getDatabaseVersion, getDatabaseVersion, getDebugOutput, getDetailLevel, getPreview, getPropertyFile, getPropertyFileExtension, getPropertyFilePathname, getRecordedGatewayMessages, getRecordGatewayMessages, getSendGatewayMessages, getUseCache, setDebugOutput, setDetailLevel, setPreview, setPropertyFile, setRecordGatewayMessages, setSendGatewayMessages, setUseCache
public CSItemMultiple()
CSItemMultiple
but does not specify which database it should use.public CSItemMultiple(java.lang.String strPropertyFile)
CSItemMultiple
, specifying a property file that contains all of the required
database connection details, such as the datasource name, user and password.
strPropertyFile
- the property file that contains the connection details.public final java.util.ArrayList<E> getItems()
CSItem
derived object such as CSMedia
in the case of
CSMediaMultiple
) stored within this CSItemMultiple
object as an
Arraylist
.
This may be useful if you wish to navigate or manipulate the items via the ArrayList
methods e.g.
to count the items or retrieve items at a specific index.
Arraylist
of the items (CSItem
derived objects).public final void setItems(java.util.ArrayList<E> arrItems)
CSItem
derived object such as CSMedia
in the case of
CSMediaMultiple
) which this CSItemMultiple
is to store.
arrItems
- An ArrayList
of CSItem
derived objects (e.g. CSMedia
objects).public void setStartRow(int nStartRow) throws CSParameterException
get
method is
executed. This can be used in conjunction with setMaxRows
to define a batch of results
to get during the get()
method. The default is 1.
nStartRow
- a positive integer index of the first row which is to be retrieved by get()
. The first
row is numbered 1 the second 2 and so on.CSParameterException
- if an invalid start row was specifiedpublic final int getStartRow()
get
method.
get()
. The first
row is numbered 1 the second 2 and so on.public void setMaxRows(int nMaxRows) throws CSParameterException
get
method is executed. This can be used in conjunction with setStartRow
to define a batch
of results to get during the get()
method.
nMaxRows
- a positive integer equal to the maximum number of rows to be retrieved by get()
.CSParameterException
- if an invalid maximum number of rows was specifiedpublic final int getMaxRows()
get
method
is executed.
get()
.public void setSortOrder(java.lang.String strSortOrderList) throws CSParameterException
get
method.
strSortOrderList
- a String
object containing a comma-delimited list of valid sort orders.CSParameterException
- if an invalid sort order is specified.public final java.lang.String getSortOrder()
get
method to order the retrieved items.
String
object containing a comma-delimited list of sort orders.public final java.util.Iterator<E> iterator()
CSItem
derived objects) that this CSItemMultiple
object
holds.
Iterator
which will loop over all of the items which this CSItemMulitiple object is
storing.public java.lang.String toString()
CSItemMultiple
object as a string.
toString
in class CSDatabaseItem
CSItemMultiple
object, and
all the items which it contains.public boolean exist() throws CSException
set
methods with that on the database.
exist
in class CSDatabaseItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSException
- the base class for exceptions thrown by this method.public void get() throws CSException
CSItem
derived objects) from the database which match the specifications set with the
setXXX(...)
methods. The database is queried for all items whose key information matches that
supplied. Each retrieved item is stored as a CSItem
derived object within this
CSItemMultiple
instance.
get
in class CSDatabaseItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if one of the specified items cannot be found on the database.CSSecurityException
- if security has been breached.CSException
- the base class for exceptions thrown by this method.public void update() throws CSException
CSItem
derived objects and use it to update the
appropriate objects on the database - the key information within each CSItem
object will be used
to locate the matching item on the database.
update
in class CSDatabaseItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if one of the specified items cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
set
methods.
delete
in class CSDatabaseItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if one of the specified users cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public boolean equals(java.lang.Object obj)
CSItemMultiple
is equal to another CSItemMultiple
. The
item data (CSItemContent
derived component) of each CSItem
derived object stored within this
CSItemMultiple instance must be equal in order to be deemed equal. Key information and anything that falls
outside of the CSItemContent
data is not compared. Note that the key data used for searching is
not tested for equality.
equals
in class CSDatabaseItem
obj
- the object with which to compare this CSItemMultiple
.obj
.Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.