public final class CSBasket extends CSItem
The CSBasket
class includes methods for the retrieval of a particular basket's details.
All such methods require that certain database and key information (basket ID, for example) be specified via the
set
methods provided, prior to their invocation.
All database access/connectivity is handled internally by the CSBasket
class.
CSBasketContent
,
CSBasketMultiple
,
CSState
,
Serialized FormACCESS_GRANTED, DOES_NOT_EXIST, EMPTY, EXISTS, SECURE_ACCESS_DENIED, SECURE_ACCESS_GRANTED, UPDATE_ACTION_INSERTED, UPDATE_ACTION_UPDATED
LEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSBasket()
Creates an empty
CSBasket object. |
CSBasket(CSBasket objItem)
Creates an empty
CSBasket object, and initialises it from the contents of the supplied CSItem
object. |
CSBasket(java.lang.String strPropertyFile)
Creates a new
CSBasket , specifying a property file that contains all of the database connection
details. |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Removes the basket from the database.
|
boolean |
exist()
Determines whether a basket exists on the database.
|
void |
get()
Retrieves the details of a basket from the database.
|
java.lang.String |
getBasketGroup()
Gets the group of the basket to be used as key information.
|
int |
getBasketID()
Gets the ID of the basket to be used as key information.
|
CSBasketItemMultiple |
getBasketItemMultiple()
Get the
CSBasketItemMultiple object containing the CSBasketItem objects associated with this
basket. |
java.lang.String |
getBasketName()
Gets the name of the basket to be used as key information.
|
java.util.Date |
getCreatedDate()
Gets the created date of the basket.
|
java.util.Date |
getLastUpdatedDate()
Gets the last updated date of the basket.
|
java.lang.String |
getUserData()
Gets the user data associated with the basket.
|
void |
setBasketGroup(java.lang.String strBasketGroup)
Sets the basket group to be used as key information.
|
void |
setBasketID(int nBasketID)
Sets the basket ID to be used as key information.
|
void |
setBasketItemMultiple(CSBasketItemMultiple objBasketItemMultiple)
Set the
CSBasketItemMultiple object containing the CSBasketItem objects associated with this
basket. |
void |
setBasketName(java.lang.String strBasketName)
Sets the basket name to be used as key information.
|
void |
setCreatedDate(java.util.Date objCreatedDate)
Sets the created date of the basket.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setLastUpdatedDate(java.util.Date objLastUpdatedDate)
Sets the last updated date of the basket.
|
void |
setUserData(java.lang.String strUserData)
Sets the user data associated with the basket.
|
void |
update()
Updates the details of a basket from the database, or inserts a new basket if no basket ID has been specified and
a matching basket cannot be found.
|
equals, getID, getStatus, hashCode, jsonString, serialiseWithTypes, setID, setStatus, toString, unset
clearRecordedGatewayMessages, clone, count, getCache, getCachingEnabled, getDatabaseVersion, getDatabaseVersion, getDebugOutput, getDetailLevel, getPreview, getPropertyFile, getPropertyFileExtension, getPropertyFilePathname, getRecordedGatewayMessages, getRecordGatewayMessages, getSendGatewayMessages, getUseCache, setDebugOutput, setPreview, setPropertyFile, setRecordGatewayMessages, setSendGatewayMessages, setUseCache
public CSBasket()
CSBasket
object.
Use the various set methods provided to initialise the CSBasket
object prior to invoking any of
its query methods.
public CSBasket(CSBasket objItem)
CSBasket
object, and initialises it from the contents of the supplied CSItem
object.
objItem
- the CSBasket
object to be used to initialise the new onepublic CSBasket(java.lang.String strPropertyFile)
CSBasket
, specifying a property file that contains all of the database connection
details.
Use the various set methods provided to initialise the CSBasket
object prior to invoking any of
its query methods.
strPropertyFile
- the property file that contains the connection details.public int getBasketID()
public void setBasketID(int nBasketID)
setBasketID
followed by a call to get
will return details of the basket with the
specified ID.
nBasketID
- the basket's ID to be used as key information.public java.lang.String getBasketName()
public void setBasketName(java.lang.String strBasketName)
setBasketName
followed by a call to get
will return details of the basket with the
specified name.
strBasketName
- the name of the basket to be retrieved.public java.lang.String getBasketGroup()
public void setBasketGroup(java.lang.String strBasketGroup)
setBasketGroup
followed by a call to setBasketName
and
get
will return details of the basket with the specified name and group.
strBasketGroup
- the group of the basket to be retrieved.public java.util.Date getCreatedDate()
public void setCreatedDate(java.util.Date objCreatedDate)
objCreatedDate
- the basket's created date.public java.util.Date getLastUpdatedDate()
public void setLastUpdatedDate(java.util.Date objLastUpdatedDate)
objLastUpdatedDate
- the basket's last updated date.public java.lang.String getUserData()
public void setUserData(java.lang.String strUserData)
strUserData
- the basket's user data.public CSBasketItemMultiple getBasketItemMultiple()
CSBasketItemMultiple
object containing the CSBasketItem
objects associated with this
basket.
CSBasketItemMultiple
populated with CSBasketItem
objects which represent basket items
associated with this basket.public void setBasketItemMultiple(CSBasketItemMultiple objBasketItemMultiple)
CSBasketItemMultiple
object containing the CSBasketItem
objects associated with this
basket.
objBasketItemMultiple
- a CSBasketItemMultiple
object populated with CSBasketItem
objects each of which
represents a basket item associated with this basket.public void setDetailLevel(int nDetailLevel) throws CSParameterException
get
method. Default is LEVEL_ALL.
Valid detail levels for a basket are :
LEVEL_ID
Retrieves BasketID only.LEVEL_SUMMARY
Retrieves BasketID, BasketName and BasketGroup.LEVEL_DETAIL
Retrieves all basket data.LEVEL_ALL
Retrieves all basket data and its basket items.setDetailLevel
in class CSDatabaseItem
nDetailLevel
- the detail level to be used.CSParameterException
- if an invalid detail level is specified.public boolean exist() throws CSException
Use setBasketID
followed by exist
to ascertain if there is a basket with
the specified ID on the database.
Use setBasketName
followed by exist
to ascertain if there is a
basket with the specified name on the database.
Use setBasketName
and setBasketGroup
followed by
exist
to ascertain if there is a basket with the specified name and group on the database.
exist
in class CSItem
true
if this basket exists on the database.CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSSecurityException
- if security has been breached.CSException
- the base class for exceptions thrown by this method.public void get() throws CSException
If it is not necessary to retrieve all the details of the basket then specify the amount of detail required using
the setDetailLevel
method before calling this method.
Use setBasketID
followed by get
to populate this CSBasket
object with the details of the basket identified by the specified ID.
Use setBasketName
followed by get
to populate this
CSBasket
object with the details of the basket identified by the specified name.
Use setBasketName
and setBasketGroup
followed by get
to populate this CSBasket
object with the details of the basket identified by the specified name
and group.
get
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified basket 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
Use setBasketID
followed by update
to update the basket identified by
the specified ID with the specified last updated date, basket name, basket group and user data.
Use setBasketName
followed by update
to update the basket
identified by the specified name with the specified last updated date, basket name, basket group and user data.
If the basket does not already exist then a new basket will be inserted with the specified basket name, basket
group and user data, with the created and last updated dates being set to the current date and time.
Use setBasketName
and setBasketGroup
followed by
update
to update the basket identified by the specified name and group with the specified last
updated date, basket name, basket group and user data. If the basket does not already exist then a new basket
will be inserted with the specified basket name, basket group and user data, with the created and last updated
dates being set to the current date and time.
update
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified basket cannot be found on the database.CSSecurityException
- if security has been breached.CSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
Use setBasketID
followed by delete
to remove the basket identified by
the specified ID from the database.
Use setBasketName
followed by delete
to remove the basket
identified by the specified name from the database.
Use setBasketName
and setBasketGroup
followed by
delete
to remove the basket identified by the specified name and group from the database.
delete
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified basket cannot be found on the database.CSSecurityException
- if security has been breached.CSException
- the base class for exceptions thrown by this method.Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.