Enabling viewing userData versions on the UI
To enable viewing different versions of userData
in the UI, you update the query template file to make the SQL queries
versionable to retrieve the different version information.
Before you begin
- Ensure that the custom tables have already been added to the version schema.
- Review the following topic to understand more about SQL version queries: Viewing version details.
Procedure
- Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
- Update your custom query template file.To view the version information, you must update the query template file. The query template file defines SQL queries that retrieve data from the server
When versions are displayed, some of the data must be retrieved from the version schema and other data must be retrieved from the base schema. You must determine whether you need to write version-specific queries. For more information about version SQL query templates, see Viewing version details.
Here's an example of a custom query template file that retrieves different versions for the WARRANTY data using the version SQL generation.
To improve performance when retrieving catalog entry versions, the new access profileBEGIN_ASSOCIATION_SQL_STATEMENT name=MyCompanyWarrantygetCatalogEntryDetailsByParentCatalogGroupId base_table=CATENTRY additional_entity_objects=true param=versionable sql= SELECT CATENTRY.$COLS:CATENTRY$, CATENTDESC.$COLS:CATENTDESC$, XWARRANTY.$COLS:XWARRANTY$, XCAREINSTRUCTION.$COLS:XCAREINSTRUCTION$ FROM CATENTRY LEFT OUTER JOIN XWARRANTY ON (CATENTRY.CATENTRY_ID = XWARRANTY.CATENTRY_ID) LEFT OUTER JOIN CATENTDESC ON (CATENTDESC.CATENTRY_ID = CATENTRY.CATENTRY_ID AND CATENTDESC.LANGUAGE_ID in ($CONTROL:LANGUAGES$)) LEFT OUTER JOIN XCAREINSTRUCTION ON (CATENTRY.CATENTRY_ID = XCAREINSTRUCTION.CATENTRY_ID AND XCAREINSTRUCTION.LANGUAGE_ID in ($CONTROL:LANGUAGES$)) WHERE CATENTRY.CATENTRY_ID IN ($ENTITY_PKS$) AND CATENTRY.MARKFORDELETE = 0 END_ASSOCIATION_SQL_STATEMENT BEGIN_PROFILE name=MyCompany_All extends = IBM_Admin_Details BEGIN_ENTITY associated_sql_statement=MyCompanyWarrantygetCatalogEntryDetailsByParentCatalogGroupId END_ENTITY END_PROFILE BEGIN_PROFILE name=MyCompany_Admin_Minimal extends = IBM_Admin_Minimal BEGIN_ENTITY associated_sql_statement=MyCompanyWarrantygetCatalogEntryDetailsByParentCatalogGroupId END_ENTITY END_PROFILE
IBM_Admin_Minimal
is defined for retrieving a subset of SQL queries returned by theIBM_Admin_Details
access profile. - Update the get-data-config.xml file
located under the directory to register the version service for the new
access profiles.Here's an example code snippet of the expression builder
getCatalogEntryDetailsByIDs
(Warranty data) added in thewcf:get-data-config
tag:<expression-builder> <name>getCatalogEntryDetailsByIDs</name> <data-type-name>CatalogEntry</data-type-name> <param> <name>accessProfile</name> <value>MyCompany_All</value> </param> </expression-builder> <expression-builder> <name>getVersionedCatalogEntryDetailsByIDs</name> <data-type-name>CatalogEntry</data-type-name> <param> <name>accessProfile</name> <value>MyCompany_Admin_Minimal</value> </param> </expression-builder>
- Update the command registry for the custom access profile
to register the insert more version command implementation.When viewing versioned objects, the Management Center needs to know information about the version such as the version ID. To retrieve and include this information in the noun, you must register an "InsertMore" command.Here's the example SQL statement to register
MyCompany_All
custom access profile for the preceding Warranty example:insert into cmdreg (storeent_id, interfacename, classname, target) values (0, 'com.ibm.commerce.catalog.facade.server.commands.InsertMoreCatalogEntryDataCmd+MyCompany_All.10', 'com.ibm.commerce.foundation.server.version.command.InsertMoreNounVersionMetaDataCmdImpl', 'Local');
The
InsertMoreNounVersionMetaDataCmdImpl
looks up the version information for the CatalogEntry noun and adds the version information to the response.