Thursday, May 17, 2012

Catalog assets and Store assets- Part-3

A catalog may be used by multiple stores, but a store is not required to sell every item or display every group in the catalog. Neither are stores required to display each item identically. These relationships allow store developers to customize how a catalog is used by a store without changing the catalog assets and, therefore, without affecting other stores that use the same catalog.

The following tables includes on catalog assets and store assets:

  • Store catalog (STORECAT)
  • Store catalog group (STORECGRP)
  • Store catalog entry (STOREENT)
  • Display catalog group relation (DISPCGPREL)
  • Display catalog entry relation (DISPENTREL)


Store catalog (STORECAT)

A store catalog object is used to link catalog objects to a store. Collectively, the set of all objects that contain the same storeent_id value are used to find the catalogs supported by the store.

Remember, a single store may use more than one catalog. For example, in addition to a master catalog, there
may be sales catalogs that organize the products differently, each optimized for a different type of shopper. The storeent_id is used to find the appropriate set of catalogs to display. For each object found, the catalog_id is used to find the appropriate catalog object. sales catalog proceeds as shoppers choose the catalog they would like to view.

Store catalog group (STORECGRP)

A store catalog group object is used to link catalog group objects to a store. Collectively, the set of all objects that contain the same storeent_id value are used to find the catalog groups supported by the store.
 
Store catalog entry (STOREENT)

A store catalog entry object is used to link catalog entry objects to a store. Collectively, the set of all objects that contain the same storeent_id value are used to find the catalog entries supported by the store.

The storeent_id is used to find the set of supported catalog entries. Given a list of catalog entries in the
catalog, the catalog entry is displayed only if it is also in the set of supported catalog entries.

Display catalog group relation (DISPCGPREL)

The display catalog group relation object is used to link a JSP name to a catalog group. Usually, a default page is provided for an entire site and, when necessary, an override is provided when the default page is inadequate. Overrides can be selected based on store, member group, device type, catalog group, language or any combination of these properties. A weighted best-fit technique is used when more than one relation satisfies the selection criteria.

Display catalog entry relation (DISPENTREL)

The display catalog entry relation object is used to link a JSP name to a catalog entry. Usually, a default page is provided for an entire site and, when necessary, an override is provided when the default page is inadequate. Overrides can be selected based on store, member group, device type, catalog entry type, catalog entry, language or any combination of these properties. A weighted best-fit technique is used when more than one relation satisfies the selection criteria.









Wednesday, May 16, 2012

Catalog assets (tables) and Description (usefull info)-Part-1


  • Catalog (CATALOG)
  • Catalog description (CATALOGDSC)
  • Catalog group (CATGROUP)
  • Catalog group attribute (CATGRPATTR)
  • Catalog group description (CATGRPDESC)
  • Catalog catalog group relation (CATTOGRP)
  • Catalog group relation (CATGRPREL)
  • Catalog entry (CATENTRY)
  • Catalog entry attribute (CATENTATTR)
  • Catalog entry description (CATENTDESC)
  • Attribute (ATTRIBUTE)
  • Attribute value (ATTRVALUE)
  • Catalog entry relation (CATENTREL)
  • Catalog group catalog entry relation (CATGPENREL)
Catalog (CATALOG)

A catalog object is the root of each catalog, whether it is a master catalog or a sales catalog. The catalog contains all of the hierarchical and navigational information for the catalog. The primary key catalog_id is used in all the business objects that define the relationship of catalog groups or catalog entries.The description in this object is only for administrative purposes.


Catalog description (CATALOGDSC)

A catalog description object contains language-dependent information and an image suitable for viewing by a shopper. if store support more than one catalog, the information from the CATALOGDSC object is used to describe the shopper's choices.

Catalog group (CATGROUP)

The catalog group object is used to organize a catalog and help the shopper navigate to the products they wish to view. A category group may contain other category groups. Alternatively, a category group may contain catalog entries.

 The relationships are not kept in this object.

  • The catalog catalog group relation object, which links the foremost catalog groups to a catalog.
  • The catalog group relation object, which links child category groups with their parent group.
  • The catalog group catalog entry relation object, which links catalog entries with their parent catalog group.
When creating catalog groups, you must first arrange your catalog in a hierarchy. The root category branches out into increasingly specific subcategories. For example, Accessories is a grouping of the Men’s Fashions category, while the catalog groups wallets and hats are found nested within the Men’s Fashions
Accessories group.


Catalog group attribute (CATGRPATTR)

The catalog group attribute object contains descriptive attributes for catalog groups. Although the WebSphere Commerce sample stores do not use these objects, they are useful objects when a catalog group needs structured information to be included in its description. Unlike the catalog group description object, each descriptive attribute has both a name and a sequence property, necessary properties for building structured descriptions or comparison tables.

Typically, developer will use descriptive attributes when they wish to present a view that the shopper uses to compare similar catalog groups. The view would include a table with a row for each attribute name and a column for each catalog group to be compared. The sequence value is used to order the attribute names. The description from each catalog group attribute object would be displayed in the appropriate cell under the column assigned to its catalog group. The result is a side-by-side comparison table that the shopper can use to determine which catalog group they wish to view.

Sizes, styles, and other product features or functions can easily be used to organize the catalog into different groups. The name of the feature or function can then be used as attribute names. The values used to delimit the group can be used as attribute descriptions. Color could be defined to be an attribute; blue might be the assigned attribute value of a specific item.

Catalog group description (CATGRPDESC)

A catalog group description object contains language-dependent information and an image suitable for viewing by a shopper.

Typically, a developer will use the information in this object to produce a view that describes the catalog group for a commerce site. When the shopper navigates to a catalog group that contains other catalog groups, the information from this object is used to describe the shopper's choices for each child. The
shopper's preferred language or the current browser language are converted into the proper identifier together with the catgroup_id, to find the appropriate object.

Catalog catalog group relation (CATTOGRP)

The catalog catalog group relation object is used to link a catalog group to a catalog. Collectively, the set of objects that contain the same catalog_id value are used to find the root categories.

Typically, a developer will use the information in this object to select the catalog groups to be displayed initially. The catalog_id is used to find the appropriate set of objects to display.

Catalog group relation (CATGRPREL)

The catalog group relation object is used to link a child catalog group to its parent catalog group. Note that the relationship is qualified by a catalog_id. This gives the store developer the freedom to build different relationships for different catalogs, usually to optimize the navigation.

Typically, the store developer will use the information in this object to select the next set of catalog groups to display when the shopper selects a parent catalog group. The catalog_id and the parent's catgroup_id are used to find the appropriate set of objects to display. For each object in the set, the catgroup_id_child is used to find the appropriate catalog group object. Catalog navigation proceeds as shoppers choose the next catalog group to view.

Catalog entry (CATENTRY)

 The catalog entry object represents merchandise that can be ordered from the catalog. There are four different types of catalog entries, which can be identified by the value of the catenttype_id found in the CATENTRY element.
  • Item
  • Product
  • Package
  • Bundle
Item

An item represents a tangible unit of merchandise that can be purchased by a shopper. Viewed another way, an item represents anything that can be shipped to a shopper.

Product

A product represents a collection of items that have identical attributes but can be distinguished by their attribute values. For example, a catalog may contain a shirt that comes in different sizes and colors. Each unique combination of size and color values must be defined in an item, but, collectively, they can be displayed as a single product with a single price, description, and image as long as a shopper is given an opportunity to select the size and color values necessary to resolve the selection to a single item.

Package

A package is a collection of items that must be purchased as a single atomic unit. Even if its items can be ordered separately, a package has its own attributes, even its own price and part number, and cannot be  decomposed into individual items during navigation or after its placed in the shopping cart.

Bundle

A bundle is a collection of items that can be added to the shopping cart with a single selection. It is typically just a convenience for the shopper, a way to order a collection of items without navigating to each item individually. Unlike a package, each item in the collection is placed in the shopping cart and the shopper can modify (for example, change the quantity) or remove each item.

Catalog entry attribute (CATENTATTR)

The catalog entry attribute object contains descriptive attributes for catalog entries. Although the WebSphere Commerce sample stores do not use these objects, they are useful objects when a catalog entry needs structured information to be included in its description. Unlike the catalog entry description object, each descriptive attribute has both a name and a sequence property, which are necessary properties for building structured descriptions or comparison tables. The sequence value is used to order the attribute names.

Catalog entry description (CATENTDESC)

A catalog entry description object contains language-dependent information and an image suitable for viewing by a shopper.

Typically, regardless of the type of catalog entry, the developer will use the information in this object to produce a view that describes the catalog entry. When the shopper navigates to a catalog group that contains catalog entries, the information from this object is used to describe the shopper's choices for each child. The shopper's preferred language or the current browser language are converted into the proper identifier together with the catentry_id, to find the appropriate object.

Attribute (ATTRIBUTE)

The attribute object defines the name, qualified by language, of each attribute used to resolve a product catalog entry into an item that can be added to the shopping cart. Notice that its catentry_id is a reference back to a product catalog entry. Compare that to an attribute value object where the catentry_id refers back
to the item catalog entry that is identified with that value.

The product's catentry_id together with the shoppers preferred language (or the browser's current language converted into an identifier) is used to select all the attributes that are used to resolve the product to a particular item. The value of sequence is used to order the attributes on the view. If the selection criteria are not obvious from the attribute name, the values from description and description2 can be used to provide additional information to aid the shopper.

The attrtype_id can be used to dynamically choose the correct structure for the shopper's selection. The choices in each selection structure will be taken from the matching attribute value objects.

Attribute value (ATTRVALUE)

The attribute value object defines the value, qualified by language, of each attribute used to resolve a product catalog entry into an item that can be added to the shopping cart. Notice that its catentry_id is a reference back to an item catalog entry. Compare that to an attribute object where the catentry_id refers back to the product catalog entry that is identified with that value.

Catalog entry relation (CATENTREL)

The catalog entry relation object is used to link a catalog entry to its parent. To date, only three relationships are possible

  • PRODUCT_ITEM: An item can be linked to its product.
  • PACKAGE_COMPONENT: A catalog entry of any type can be linked to a package.
  • BUNDLE_COMPONENT: A catalog entry of any type can be linked to a bundle.

Notice that, unlike catalog groups, these relations are not qualified by catalog_id. These relations are the same no matter which catalog includes the catalog entry.

Typically, the developer will use the information in this object to determine what collection of merchandise is represented by a catalog entry collection, either to provide a more granular display or to determine what merchandise is to be added to the shopping cart. Once a collection is selected, the related objects are found by finding the objects where the catentry_id_parent value matches the collection's catentry_id value. For each catalog entry relation found, the catentry_id_child is used to find the appropriate catalog entry object to display or to include in the shopping cart. The value of sequence can be used to order the children in the view.

Special care must be exercised when a package or bundle contains a product. If this combination exists, the store developer must also include the means to resolve the product to a single item.

Catalog group catalog entry relation (CATGPENREL)

The catalog group catalog entry relation object is used to link a catalog entry to a catalog group. Note that the relationship is qualified by a catalog_id. This gives the store developer the freedom to build different relationships for different catalogs, usually to optimize the navigation.

Typically, the developer will use the information in this object to select the set of catalog entries to display when the shopper selects a parent catalog group. The catalog_id and the selected catgroup_id are used to find the appropriate set of objects to display. For each object in the set, the catentry_id is used to find the
appropriate catalog entry object. Catalog navigation proceeds as the shopper chooses a catalog entry to view, optionally adding the merchandise to the shopping cart in the process.





Catalog and offering assets (price) Part-2

Every catalog entry object must have a base price (commonly called a default price) there may be any number of prices associated with a given item.

Example:
  1. There may be a price for each supported currency.
  2. There may be a special discounted price for senior citizens or for employees.
  3. There may be special business customer contracts with terms and conditions (minimum quantity, maximum quantity, shipping restrictions, and so on) that justify special prices.
This following tables includes catalog and offering assets.

  • Trading position container (TRADEPOSCN)
  • Catalog group trading position relation (CATGRPTPC)
  • Offer (OFFER)
  • Offer description (OFFERDESC)
  • Offer price (OFFERPRICE)

Trading position container (TRADEPOSCN)

A trading position container object organizes, by reference, a group of offers. The reference identifier tradeposcn_id value is used in all the offers in the container.

Typically, a developer begins by creating a single trade position container to contain the base prices for the entire catalog. In this container, the productset_id property is set to NULL and the type property is set to indicate that it represents the standard prices. When special prices need to be offered, the store developer creates additional trading position containers, one for each collection of related prices.

Catalog group trading position relation (CATGRPTPC)

The catalog group trading position relation is used to link a catalog or a catalog group to a trading position. If the catgroup_id property is set to 0, the relation applies to the entire catalog. Otherwise, the relation applies to the specified catalog group.

Offer (OFFER)

The offer object is used as a relation to link a particular catalog entry object and its related prices to a trading position container. It may also contain properties that qualify the applicability of the specified prices. Once a trading position container has been chosen, its reference identifier plus the reference identifier of the catalog entry can be used to find the appropriate offer object.

By convention, every catalog entry, regardless of type, has an offer in the base price list. You could argue that items could inherit their price from the related product, or all the item prices in a bundle could be summed to provide the price for the bundle. However, for convenience and performance while building a view, an invoice, or an order, each catalog entry is given its own offer, even when information appears to be redundant.

Offer description (OFFERDESC)

An offer description object contains language-dependent information about an offer. Although this object is not used in the sample stores, it can be used to add descriptive text about the price for viewing by a shopper. For example, it may say “For a limited time, only”, “While supplies last”, or “Special price because you are
an eligible Senior Citizen”.

Note the granularity of these descriptions, one per offer object. In most cases, all the offers in the same trading position container are there for the same reason. To have this information recorded for each offer can be very redundant. You may be tempted to use the description in the trading position container instead, but
that description is not language dependent and is therefore unsuitable for stores that support more than one language.

Offer price (OFFERPRICE)

The offer price object links a currency-dependent price to an offer. Once an offer has been chosen, its reference identifier and the desired currency identifier can be used to find the price to be displayed. Optionally, this object may contain a comparison price, in the same currency. When special prices need to be added to the site, additional offer price objects are created for each offer in the new trading position container.

Tuesday, April 3, 2012

How to implement access control in customized code?

Enterprise beans and data beans are resources that may need to protect. However, not all Enterprise bean and data beans should be protected.

Typically, the question of what to protect comes into play when you create new Enterprise beans and data beans.

Decide which resource to protect depends on your application.

If a command returns an Enterprise bean in the getResources method, then the Enterprise bean must be protected because the ACP manager will call the getOwner() method on the enterprise ban. The fulfills() method will also be called if a relationship is specified in the corresponding resource-level ACP.

if we implements the protectable interface for all of enterprise bean and data bean ( in number of policy increase) performance may degrade.

Primary resources should be protected, but dependent resources often do not require protection. if user allowed to access a primary resource, it makes sense that, by default, the user should also be allowed to access its dependent resource.

Monday, April 2, 2012

Understanding Access Control Policy

Access control in WCS is composed of the following elements:

1. Users - Users are the people that use the System. so users must be grouped into relevent access group.
2. Actions - Actions are the activities that users can perform on the resource. so action must also be grouped into relevent action groups.
3. Resources - Resources are the entities that are protected. Ex: if the action is a view, the resource to be protected is the command that invoked the view.
4. relationships - are the relationship between the user and the resource.

There are two level/type ACP.

1. Command-level ACP - The first level of ACP is performed by the WAS. In this respect, WC uses WAS to protect Enterprise beans and servlets.
2. Resource-level ACP - The Second level ACP is the fine-grained access control system of WCS.

Note: A command-level ACP alwasy has the ExecuteCommandActionGroup as the action group for Controller command. for views, the resource group is always ViewCommandResourceGroup. (ACPOLICY, MBRGRP, MBRGRPCOND, ACACTGRP, ACRESGRP)

ACP are enforced by the access control policy manager. when a user attempts to access a protected resource, ACP manager determines what ACP are applicable for that protected resource, and based upon the applicable ACP, it determines if the user is allowed to access the requested resources.

An ACP is a 4-element that is stored in the ACPOLICY table. Each access control policy takes the following form:

AccessControlPolicy [UserGroup, ActionGroup, ResourceGroup, Relationship]

The above elements say, a user belonging to a specific user group is permitted to perfrom action in the specified ActionGroup on resource belonging to the specified ResourceGroup, as long as the user satisfies the conditions specified in the Relationship or relationship group, with respect to the resource in question.

Ex: [AllUsers, UpdateDoc, doc, creator] specifies that all users can update a document, if they are the create of the document.

  • The user group is a specific type of member group that is defined in the MBRGRP table.
  • A user group must be associated with member group type of -2. the value of -2 represent an access group and is defined in the MBRGRPTYPE table.
  • Association between the usergroup and membergroup type is stored in the MBRGRPUSG table.
The membership of a user into a particular user group may be stated explicitly or implicitly. An explicit specification occurs if the MBRGRPMBR tables states that user belongs to a particular member group. An implicit specification occurs fi the user satisfies a condition (all users that fulfill the role of Product Manager) that is stated in the MBRGRPCOND table.

Most conditions to include a user in a user group are based upon the user fulfilling a particular role. Ex: there could be ACP that allows all users that fulfill the Product Manager role to perform catalog management operations. in this case, any user that has been assigned the Product Manager role in the MBRROLE table is implicitly included in the user group.

The ActionGroup elements comes from the ACACTGRP table. An action group refers to an explicitly specified group of actions. The list of actions is stored in the ACACTION table and the relationship of each action to its action group(or group) is stored in the ACACTACTGP table.

An example of an action group is the "OrderWriteCommands" action group. this action group includes the following action that are used to update orders

  • OrderDeleteCmd
  • OrderCancelCmd
  • OrderAProfileUpdateCmd
  • OrderUnlockCmd
  • OrderScheduleCmd
  • ScheduledOrderCancelCmd
  • ScheduledOrderProcessCmd
  • OrderItemAddCmd
  • OrderItemDeleteCmd
  • OrderItemUpdateCmd
  • PayResetPMCmd

The resource group is mechanism to group together particular types of resources. membership of a resource in a ResourceGroup can be specified in one of two ways.

using the conditions column in the ACRESGRP table
using the ACRESGPRES table.

in most case, it is sufficient to use the ACRESGPRES table for associating resources to resource group. using this method, resources are defined in the ACRESCGRY table suing their java class name.

These resources are associated with appropriate resource group(ACRESGRP) using the ACRESGPRES association table. in this case where the java class name alone is not sufficient to define the members a resource group.

The ACP can optionally include either a Relationship or RelationshipGroup element as its fourth element.

if ACP uses a Relationship element, this come from the ACRELATION table. if on other hand, it includes a RelationshipGroup Element, that comes from the ACRELGRP table. A ReletionshipGroup specification from the ACRELGRP table takes precedeence over the Relationship information from the ACRELATION table.


Wednesday, February 1, 2012

Enabling JDBCAccessBean for Management Center

Use WebSphere Application Server administrative console to trace queries serviced by the data service layer.

a. Set the log level setting to 'all' for the com.ibm.commerce.foundation.server.services.dataaccess* component in the WebSphere Application Server Administrative console.

Note: To trace the UPDATE and INSERT queries, set the log level setting to 'all' for all classes under component com.ibm.ws.sdo.mediator.jdbc (com.ibm.ws.sdo.mediator.jdbc*=all). You must restart the server after enabling this trace.

Thursday, January 5, 2012

massextract utility example

Mass extract (massextract) is an OOB utility which can be used to extract data from any tables in IBM WCS. Use the massextract utility to extract selective subsets of data from the WebSphere Commerce database in the form of XML files.
You can extract data on products related to an upcoming holiday, for example, or you can extract information from a consolidated database for use with other systems.

Step-1

Pre-Request for before running this utility

i. Assume that environment variable setting done.
ii. JVM Setting (optional)
iii. (Oracle) Optional: By default, the massextract utility uses the Oracle thick JDBC client. To change the massextract utility to use the Oracle thin JDBC client.

Step-2

Create an extraction filter: An extraction filter is an XML file that defines the data want to extract from the WebSphere Commerce database. Must create an extraction filter before run the massextract utility.

Procedure to extraction filter

1. Develop SQL queries for the data you want to extract from the WebSphere
Commerce database
.

Extraction filter format


This tag and its closing tag define the extraction filter. All of the text in the extraction
file must be contained within this tag.

This tag defines the SQL query used to extract data from the database.
Every tag requires one or more tags.

This tag is responsible for the running of the SQL query. In this tag, you can also
specify for any values required for variable parameter defined in the tag.
Multiple tags can be associated with one tag.

Example:

1. Create file called CatentryFilter.xml
2. Add the following content to CatentryFilter.xml




3. Finally execute the below extract utility

./massextract.sh -filter /opt/IBM/WebSphere/CommerceServer60/bin/CatentryFilter.xml -outfile /opt/IBM/WebSphere/CommerceServer60/bin/CatentryFilterExtracted.xml -dbname PPSTGDB -dbuser MIPRODSTA -dbpwd MIPRODSTA -customizer OracleConnectionCustomizer


Note: we can query multiple tables using join conditions.