
Descriptions of sample BOM entries, sample rules, and ruleset parameters
The sample WebSphere ILOG JRules rule projects for pricing (WC_SDO_App, WC-SDO-rules, and WC-SDO-xom) include sample BOM entries, sample business rules, and ruleset parameters. You can use these samples as starting points for your own ILOG JRules pricing rulesets.
Sample BOM entries
These predefined BOM entries represent WebSphere Commerce data that is included in the BOM provided in the sample projects.- catalog
- This represents a WebSphere Commerce catalog entry. This BOM entry maps to the CatalogEntryType logical service data object (SDO) in WebSphere Commerce. This BOM entry
includes information about the catalog entry, for example, the part number. For example, you can use this BOM entry like this:
- Define the following vocabulary:
"partNumber" as "{part number} of {this}"
- In the ILOG JRules rule code, use language like
this:
CatalogEntryType means the object of the com.ibm.commerce.catalog.facade.datatypes.CatalogEntryType interface. In the sample rule, CatalogEntryType can be replaced as 'catalog entry', which is the verbalization of the input parameter "catalogEntry".the part number of CatalogEntryType.
The following methods are also provided in this BOM entry:belongsToCatalogGroup(String)
– Used to check whether a catalog entry belongs to a specific category.getPriceInPriceList(String)
– Gets a price from a specified price list.isInCatalogFilter(String)
– Used to check whether a catalog entry is in a specific catalog filter.
- Define the following vocabulary:
- catalogGroup
- A catalogGroup is a category in a store catalog. This BOM entry maps to the CatalogGroupType logical service data object (SDO) in WebSphere Commerce. This entry includes catalog group information, for example, the category name.
- onlineStore
- An onlineStore is a WebSphere Commerce store. This BOM entry maps to the OnlineStoreType logical service data object (SDO) in WebSphere Commerce. This entry includes information about the store, for example, the store type.
- person
- A person can be a guest, a registered user, or an administrator. This BOM entry maps to the
PersonType logical service data object (SDO) in WebSphere Commerce. This entry contains
information about the person, such as their ID, contact information, gender, and registration date.
This entry includes two methods:
belongsToMemberGroup(String)
– Used to group users who belong to a specific member group.belongsToOrganization(String)
– Used to group users who belong to a specific organization.
- organization
- An organization is a WebSphere Commerce organization, for example, a buyer organization that belongs to a B2B site. This BOM entry maps to the OrganizationType logical service data object (SDO) in WebSphere Commerce. This entry contains information about the organization, such as the organization name, description, and parent ID.
- businessContext
- The businessContext includes common context information, such as the storeId, userId, currency, and language.
- xomHelper
- This BOM entry provides some methods to retrieve data from WebSphere Commerce. For example, use it to fetch the PersonType data by the PersonIdentifier, or fetch the CatalogGroupType data by the catalog entry ID.
Ruleset parameters
Ruleset parameters provide a mechanism for exchanging data between a ruleset and an application. For the WC-SDO-rules project, WebSphere Commerce has defined a series of ruleset parameters.- IN parameters – The parameter value is provided as input to the ruleset on execution:
- catalogEntry
- The
catalogEntryType
data object. Use this parameter to get specific information about the catalog entry, for example, its part number. - inputPrice
- Used only if an external price rule (a WebSphere Commerce price rule that references an ILOG
JRules ruleset):
- Is nested in another price rule using the Apply Nested Price Rule action.
- Is passed a price by a previous action in the price rule flow.
This parameter represents the value of the price that is passed into the external price rule, but it might not be the initial price of the catalog entry.
- xomHelper
- The helper object to perform the specified action, for example, get a price from a price list.
The default value is the
ILogJRulesPriceXOMHelper
. This parameter can be customized to use other helpers. - businessContext
- The data object that contains the context information, such as the store ID, the user ID, and so on.
- unitOfMeasure
- The unit of measure for this catalog entry.
- currency
- The currency for this catalog entry.
- quantity
- The quantity of this catalog entry.
- customData
- Used for customization. You can pass the parameters through the Map object.
- OUT parameters – The parameter value is set by the execution of the ruleset and provided as
output from the ruleset at execution completion:
- finalPrice
- The final calculated price for this catalog entry.
- finalPriceListId
- Used only for range pricing. This parameter should be set to the price list ID that the final calculated price is based on. If your store does not use range prices for catalog entries, you do not need to set this parameter.
Sample rules
The following is a list of some basic sample rules provided in the sample projects. For information about the full set of sample rules, view the code of each rule in Rule Studio.- SetPriceBy_PriceList
- Sets the price of catalog entries using a specified price list.
- FEP2PR_02_CatentrybyManufacturer
- Calculates the price of catalog entries for a specific manufacturer.
- FEP2PR_03_CatentryBelongstoCatagroup:
- Calculates the price of catalog entries in a specific category.
- FEP2PR_12_UserBelongstoMemberGroup
- Calculates the price of catalog entries for customers in a specific member group.
- FEP2PR_13_UserBelongstoOrganization
- Calculates the price of a catalog entry for customers in a specific organization.
- FEP2PR_18_Rounding
- Rounds adjusted prices according to a rounding pattern so the price is more attractive to customers.