public final class CSProductMultiple extends CSItemMultiple
The CSProductMultiple
class provides a method that retrieves several products (either product type or
product group) from the database. This method requires that certain database and key information (product group ID
for example) be specified via the set
methods provided, prior to its invocation.
All database access/connectivity is handled internally by the CSProductMultiple
class.
CSProductType
,
CSProductGroup
,
Serialized FormLEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSProductMultiple()
Creates an empty
CSProductMultiple object. |
CSProductMultiple(java.lang.String strPropertyFile)
Creates a new
CSProductMultiple , specifying a properties file that contains all of the database
connection details. |
Modifier and Type | Method and Description |
---|---|
void |
get()
Retrieves the details of several products from the database.
|
int |
getArticleId()
Gets the article ID specified as key information.
|
java.lang.Integer |
getDecimalPlaces()
Gets the decimal places setting to be applied to the product's price.
|
java.lang.String |
getGroupList()
Gets the list of IDs of the website User Groups to which the specified user belongs.
|
boolean |
getIgnoreVisibility()
Gets the flag which indicates if the display state and date ranges will be ignored when products are are to be
retrieved.
|
int |
getProductGroupId()
Gets the product group ID specified as key information.
|
boolean |
getRecurse()
Gets the recurse option when retrieving products below an product group.
|
java.lang.String |
getType()
Gets the Type specified.
|
int |
getUserID()
Gets the website User ID specified as key information.
|
boolean |
isIgnoreVisibility()
Deprecated.
Replaced by
getIgnoreVisibility() |
void |
setArticleId(int narticleId)
Specifies the ID of the article that is to be retrieved.
|
void |
setDecimalPlaces(java.lang.Integer nDecimalPlaces)
Sets the decimal places setting to be applied to the product's price.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setGroupList(java.lang.String strGroupList)
Sets a list of the IDs of the User Groups to which the specified user belongs.
|
void |
setIgnoreVisibility(boolean bIgnoreVisibility)
Sets the flag which indicates if the display state and date ranges will be ignored when products are are to be
retrieved.
|
void |
setProductGroupId(int nproductGroupId)
Specifies the ID of the product group that is to be retrieved.
|
void |
setRecurse(boolean bRecurse)
Sets the recurse option when retrieving products below a product group.
|
void |
setSortOrder(java.lang.String strSortOrderList)
Sets the order in which the products are to be retrieved.
|
void |
setType(java.lang.String nType)
Specifies the Type of the Products that are to be retrieved.
|
void |
setUserID(int nUserID)
Sets the website User ID to be used as key information.
|
delete, equals, exist, getItems, getMaxRows, getSortOrder, getStartRow, iterator, setItems, setMaxRows, setStartRow, toString, update
clearRecordedGatewayMessages, clone, count, getCache, getCachingEnabled, getDatabaseVersion, getDatabaseVersion, getDebugOutput, getDetailLevel, getPreview, getPropertyFile, getPropertyFileExtension, getPropertyFilePathname, getRecordedGatewayMessages, getRecordGatewayMessages, getSendGatewayMessages, getUseCache, setDebugOutput, setPreview, setPropertyFile, setRecordGatewayMessages, setSendGatewayMessages, setUseCache
public CSProductMultiple()
CSProductMultiple
object.
Use the various set
methods provided to initialise the CSProductMultiple
object
prior to invoking any of its query methods.
public CSProductMultiple(java.lang.String strPropertyFile)
CSProductMultiple
, specifying a properties file that contains all of the database
connection details.
Use the various set methods provided to initialise the CSProductMultiple
object prior to invoking
any of its query methods.
strPropertyFile
- the property file that contains the connection details.public int getProductGroupId()
public void setProductGroupId(int nproductGroupId)
setProductGroupId
followed by a call to get
returns details of all the specified
products that are members of the supplied product group.
nproductGroupId
- product group IDs.public int getArticleId()
public void setArticleId(int narticleId)
setArticleId
followed by a call to get
returns details of all the specified
products that are members of the supplied article.
narticleId
- article ID.public void setUserID(int nUserID)
Do not set User ID if you are only interested in unsecured articles, as this will result in a faster query.
setUserID
and an appropriate set
method for article ID followed by a call to
get
will return realted items for articles which are either unsecured articles, or secured articles
to which the specified has access.
nUserID
- the ID of the user to be used in article security checks.public int getUserID()
public void setGroupList(java.lang.String strGroupList)
Do not set this list unless User ID is also being specified using the setUserID
method.
Specifying the website User ID is sufficient to enable full article security to be implemented. However, for
performance reasons the list of group IDs should be also specified if it is already known.
strGroupList
- comma-separated list of the IDs of the website user groups to which the specified user belongs.public java.lang.String getGroupList()
This list is built up by the get
method only if a User ID is specified using the
setUserID
method.
public void setType(java.lang.String nType)
setType
followed by a call to get
returns details of all the specified products
that are either members of specified group or related to specified article, and are of the specified type.
nType
- the Type of the Products.public java.lang.String getType()
public void setRecurse(boolean bRecurse)
setProductGroupId
and setRecurse(true)
followed by a call to
get
will return details of the products which belong to the specified product group as well as any
products belonging to any nested groups.
To retrieve only the products belonging directly to the specified group, call setProductGroupId
and setRecurse(false)
followed by a call to get
.
bRecurse
- indicates if products of nested groups are to be retrieved, or not.public boolean getRecurse()
setProductGroupId
and setRecurse(true)
followed by a call to
get
will return details of the products which belong to the specified product group as well as any
products belonging to any nested groups.
To retrieve only the products belonging directly to the specified group, call setProductGroupId
and setRecurse(false)
followed by a call to get
.
public void setIgnoreVisibility(boolean bIgnoreVisibility)
Set true
to return products regardless of their display setting or date range.
Set false
to return only those products which are displayable and in-date.
Default is false
.
bIgnoreVisibility
- the flag indicating if the display state and date ranges will be ignored when products are to be
retrieved.public boolean getIgnoreVisibility()
Set true
to return products regardless of their display setting or date range.
Set false
to return only those products which are displayable and in-date.
Default is false
.
@Deprecated public boolean isIgnoreVisibility()
getIgnoreVisibility()
public java.lang.Integer getDecimalPlaces()
If set to null then the decimal places as defined in the iCM Commerce Settings will be used.
public void setDecimalPlaces(java.lang.Integer nDecimalPlaces)
If set to null then the decimal places as defined in the iCM Commerce Settings will be used.
nDecimalPlaces
- the decimal places setting.public void setDetailLevel(int nDetailLevel) throws CSParameterException
get
method. Default is LEVEL_ALL.
Valid detail levels for a product are :
LEVEL_ID
Retrieves the ProductGroupID.LEVEL_SUMMARY
Retrieves the ItemID (GroupID or TypeID), ItemType (Group or Type), LEVEL_DETAIL
Will only retrieve visible products. Retrieves all product data;LEVEL_ALL
Will only retrieve visible products. Retrieves all product data;setDetailLevel
in class CSDatabaseItem
nDetailLevel
- the detail level to be used.CSParameterException
- if an invalid detail level is specified.public void setSortOrder(java.lang.String strSortOrderList) throws CSParameterException
One or more of the available sort orders may be specified as a comma-delimited list. Use ASC or DESC to indicate the direction of ordering for a sort order. For example, "ProductGroupID DESC" would order in descending order of the product Group ID. The default sort order in this instance is 'DisplayOrder ASC'.
Available sort orders are :
ProductGroupID - order by the parent product group ID
ItemID - order by item ID
ItemType - order by the item type
DisplayOrder - order by the display order
setSortOrder
in class CSItemMultiple
strSortOrderList
- a comma-separated list of one or more of the available sort orders.CSParameterException
- if an invalid sort order was specifiedpublic void get() throws CSException
Use setProductGroupId
followed by get
to populate this
CSProductMultiple
object with the details of the products in the specified group.
Use setArticleId
followed by get
to populate this
CSProductMultiple
object with the details of the products that are related to the specified
article.
Each retrieved product is stored either as a CSProductGroup
object or as a CSProductType
within
the item ArrayList
member of CSProductMultiple
- use getItems
or iterator
to access/navigate through them. These products will be stored in the
ArrayList
in the order specified using the setSortOrder
method, or
the default sort order of 'DisplayOrder ASC'.
get
in class CSItemMultiple
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 product options 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.