public final class CSBasketItem extends CSItem
The CSBasketItem
class includes methods for the retrieval of a particular basket item's details.
All such methods require that certain database and key information (basket item ID, for example) be specified via the
set
methods provided, prior to their invocation.
All database access/connectivity is handled internally by the CSBasketItem
class.
CSBasketItemContent
,
CSBasketItemMultiple
,
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 |
---|
CSBasketItem()
Creates an empty
CSBasketItem object. |
CSBasketItem(CSBasketItem objItem)
Creates an empty
CSBasketItem object, and initialises it from the contents of the supplied CSItem
object. |
CSBasketItem(java.lang.String strPropertyFile)
Creates a new
CSBasketItem , specifying a property file that contains all of the database
connection details. |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Removes the basket item from the database.
|
boolean |
exist()
Determines whether a basket item exists on the database.
|
void |
get()
Retrieves the details of a basket item from the database.
|
int |
getBasketID()
Gets the ID of the parent basket of the basket item.
|
int |
getBasketItemID()
Gets the ID of the basket item to be used as key information.
|
java.lang.String |
getBasketItemUserData()
Gets the additional information associated with the basket item.
|
java.lang.Integer |
getDiscountSchemeID()
Gets the ID of the discount scheme that is applicable for the basket item.
|
java.lang.Integer |
getProductOptionID()
Gets the ID of the product option that the basket item is associated with.
|
java.lang.String |
getProductOptionUserData()
Gets the additional information associated with the product option.
|
java.lang.String |
getProductTypeUserData()
Gets the additional information associated with the product type.
|
int |
getQuantity()
Gets the quantity of the product option in this basket item.
|
java.lang.Integer |
getRackID()
Gets the ID of the rack that contains the product option associated with this basket item.
|
void |
setBasketID(int nBasketID)
Sets the ID of the parent basket of the basket item.
|
void |
setBasketItemID(int nBasketItemID)
Sets the basket item ID to be used as key information.
|
void |
setBasketItemUserData(java.lang.String strBasketItemUserData)
Sets the additional information associated with the basket item.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setDiscountSchemeID(java.lang.Integer nDiscountSchemeID)
Sets the ID of the discount scheme that is applicable for the basket item.
|
void |
setProductOptionID(java.lang.Integer nProductOptionID)
Sets the ID of the product option that the basket item is associated with.
|
void |
setProductOptionUserData(java.lang.String strProductOptionUserData)
Sets the additional information associated with the product option.
|
void |
setProductTypeUserData(java.lang.String strProductTypeUserData)
Sets the additional information associated with the product type.
|
void |
setQuantity(int nQuantity)
Sets the quantity of the product option in this basket item.
|
void |
setRackID(java.lang.Integer nRackID)
Sets the ID of the rack that contains the product option associated with this basket item.
|
void |
update()
Updates the details of a basket item from the database, or inserts a new basket item if no basket item ID has
been specified and a matching basket item 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 CSBasketItem()
CSBasketItem
object.
Use the various set methods provided to initialise the CSBasketItem
object prior to invoking any
of its query methods.
public CSBasketItem(CSBasketItem objItem)
CSBasketItem
object, and initialises it from the contents of the supplied CSItem
object.
objItem
- the CSBasketItem
object to be used to initialise the new onepublic CSBasketItem(java.lang.String strPropertyFile)
CSBasketItem
, specifying a property file that contains all of the database
connection details.
Use the various set methods provided to initialise the CSBasketItem
object prior to invoking any
of its query methods.
strPropertyFile
- the property file that contains the connection details.public int getBasketItemID()
public void setBasketItemID(int nBasketItemID)
setBasketItemID
followed by a call to get
will return details of the basket item
with the specified ID.
nBasketItemID
- the basket item's ID to be used as key information.public int getBasketID()
public void setBasketID(int nBasketID)
nBasketID
- parent basket's ID of the basket itempublic java.lang.Integer getProductOptionID()
public void setProductOptionID(java.lang.Integer nProductOptionID)
nProductOptionID
- the product option's ID.public int getQuantity()
public void setQuantity(int nQuantity)
nQuantity
- the quantity of the product option in this basket item.public java.lang.Integer getDiscountSchemeID()
public void setDiscountSchemeID(java.lang.Integer nDiscountSchemeID)
nDiscountSchemeID
- the discount scheme's ID.public java.lang.Integer getRackID()
public void setRackID(java.lang.Integer nRackID)
nRackID
- the rack's ID.public java.lang.String getProductOptionUserData()
public void setProductOptionUserData(java.lang.String strProductOptionUserData)
strProductOptionUserData
- the additional information associated with the product option.public java.lang.String getProductTypeUserData()
public void setProductTypeUserData(java.lang.String strProductTypeUserData)
strProductTypeUserData
- the additional information associated with the product type.public java.lang.String getBasketItemUserData()
public void setBasketItemUserData(java.lang.String strBasketItemUserData)
strBasketItemUserData
- the additional information associated with the basket item.public void setDetailLevel(int nDetailLevel) throws CSParameterException
get
method. Default is LEVEL_ALL.
Valid detail levels for a basket item are :
LEVEL_ID
Retrieves BasketItemID only.LEVEL_SUMMARY
Retrieves all basket item data except for the user data.LEVEL_ALL
Retrieves all basket item data.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 setBasketItemID
followed by exist
to ascertain if there is a
basket item with the specified ID on the database.
exist
in class CSItem
true
if this basket item 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 item then specify the amount of detail required
using the setDetailLevel
method before calling this method.
Use setBasketItemID
followed by get
to populate this
CSBasketItem
object with the details of the basket item identified by the specified ID.
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 item 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 setBasketItemID
followed by update
to update the basket item
identified by the specified ID with the specified product option ID, quantity, rack ID, discount scheme ID and
user data.
Use setBasketId
, setProductOptionId
,
setDiscountSchemeId
, setRackId
,
setBasketItemUserData
,
setProductOptionUserData
and
setProductTypeUserData
followed by update
to update the
basket that matches with these details with the specified quantity. If the basket does not already exist then a
new basket item will be inserted.
Whenever a basket item is updated or inserted the parent basket's last updated date and time will be changed 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 item 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 setBasketItemID
followed by delete
to remove the basket item
identified by the specified ID 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 item 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.