Access profiles
It is very common, especially when building Web applications, to require a different level of detail on various web pages for the same object. For example, on a product list page, only minimal information about each product is needed, while on a product detail page, more information is required. To accommodate the varying needs for different levels of knowledge about an object, clients can use access profiles to convey the intent of their requests.
{_wcf.ap=IBM_Admin_Details}/CatalogGroup[Name='MyCatalogGroupName']
- Define a XPATH_TO_SQL_STATEMENT block in the query template file. The template name is the XPath_key+Access_profile, where XPath_key is the key generated from an XPath query and Access_Profile is the name of the access profile. The access profile together with the XPath key is used to locate the necessary query template in the template file.
- Define the access profile in the PROFILE section of the query template file, and define one or more SQL templates under the ASSOCIATON_SQL_STATEMENT section. When the DSL is called with this access profile, the associated SQL is run. You can use this method to structure a query to retrieve a set of objects, then use the associated SQL, to retrieve information about those objects. For information about configuring access profiles, see Query template file.
Access profile extensions
You can extend an access profile, including HCL Commerce default access profiles.
BEGIN_SYMBOL_DEFINITIONS
COLS:CATENTRY=CATENTRY:*
COLS:XWARRANTY=XWARRANTY:*
END_SYMBOL_DEFINITIONS
BEGIN_ASSOCIATION_SQL_STATEMENT
name=MyAssociatedQuery
base_table=CATENTRY
sql=
SELECT CATENTRY.$COLS:CATENTRY$,
XWARRANTY.$COLS:XWARRANTY$
FROM
CATENTRY
LEFT OUTER JOIN XWARRANTY ON
(CATENTRY.CATENTRY_ID = XWARRANTY.CATENTRY_ID)
WHERE
CATENTRY.CATENTRY_ID IN ($ENTITY_PKS$)
END_ASSOCIATION_SQL_STATEMENT
BEGIN_PROFILE
name=MyProfile
extends = IBM_Admin_Summary
associated_sql_statement=MyAssociatedQuery
BEGIN_ENTITY
In
the example, the access profile MyProfile is extending IBM_Admin_Summary, a default HCL Commerce access profile. A new associated SQL statement block, MyAssociatedQuery, is also
defined. This SQL statement must be in the same query template file as the new access
profile.- Only one level of inheritance is supported in access profile extension.
- If you do not extend an IBM profile, you cannot reuse an existing associated SQL.
- Implementing a new custom Graph composer is needed if you are extending a
default HCL Commerce access profile with more than one associated SQL and one of the
following conditions is true:
- The access profile you are extending is using a non-default Graph composer class.
- The result set of all associated SQL statements (referenced by both the default and custom
access profiles), retrieve identical records from tables other than the base table.
The base table name should not be specified in the new access profile. It is inherited from the original profile. The associated SQL templates referenced by the extension profile should specify the same base table name as the one used in the default profile. In the preceding example, the base table for the MyNewAssociatedSQLName SQL statement is the same as the base table in the parent access profile, CEDescriptionProfileWithAdditionalObject.