Business Object Document Get processing pattern

The Business Object Document Get processing pattern describes the design pattern used to perform searching for and retrieving of data.

Processing the Get request involves a Get controller which will delegate to task commands:
  1. A Fetch command that pulls the data for the requested business objects from the data service layer and transforms it into the OAGIS logical structure
  2. An optional InsertMoreData task command that is used to augment the objects retrieved by the fetch, for example to add computed values or aggregate with content from an alternate data source
Note: More than one InsertMoreData task command is supported per Get request.

The GetNoun command is a controller command that will parse the expression from the Get request, perform common validation such as access control, and then delegate to the fetch command to retrieve the list of nouns that match the expression. The fetch command returns the list of nouns that match the search expression and the Show verb that represents the returned list of nouns. The GetNoun command will use an XPath selector to choose the appropriate registered fetch command implementation to retrieve the data. Although the default implementation of the GetNoun command is used in most cases, the extension allows for additional business logic to be added for particular search expressions.

When you register a command in the CMDREG table, you can append an additional string, appended to the interface name, to help WebSphere Commerce choose the appropriate implementation Fetch or InsertMoreData command. This additional string is set to be the XPath selector, when registering a Fetch command, and set to be the name of an access profile, when registering the InsertMoreData implementation.

An example of a Get request is seen below. The access profile is IBM_Admin_Details. The XPath selector is /CatalogEntry[CatalogEntryIdentifier[]]. So the registered fetch implementation for this XPath would be registered with "+/CatalogEntry[CatalogEntryIdentifier[]]" appended to the INTERFACENAME column value in the CMDREG table. The registered InsertMoreData command would be registered with "+IBM_Admin_Details" appended to the INTERFACENAME.
<_cat:GetCatalogEntry xmlns:_cat="" xmlns:_wcf="" xmlns:oa="" xmlns:xsi="">
  <oa:ApplicationArea xsi:type="_wcf:ApplicationAreaType">
      <_wcf:ContextData name="storeId">511</_wcf:ContextData>
      <oa:Expression expressionLanguage="_wcf:XPath">{wcf.ap=IBM_Admin_Details}/CatalogEntry[CatalogEntryIdentifier[UniqueID='51100000117']]</oa:Expression>

For access profiles that you want to have additional information based on business logic or from an external system, the GetNoun controller can instantiate an instance of an InsertMoreData task command for a particular access profile to populate more data. The InsertMoreData command is optional and should be used when the information cannot be retrieved from the data service layer.

Because multiple InsertMore commands can be registered for the same access profile, the .index notation permits more than one InsertMore command to run and the order is based on the registered index. In the example below, an InsertMore command is registered with an index of 0, appended to the access profile as IBM_Admin_Details.0:
insert into cmdreg (storeent_id, interfacename, classname, target)  values (0, '',  '', 'Local');

The AbstractFetchNounFromBusinessObjectMediatorCmdImpl will use the Business Object Mediator (BOM) to process the request. To simplify the implementation of a Get service, it is recommended that Fetch command implementations would extend this class. Supported XPath expressions can be configured using the data service configuration instead of code. The Fetch implementation passes the search expression extracted from the Get verb to the BOM. This search expression includes the XPath, access profile and paging information. The BOM in turn will use the business object mediator and data service layer to retrieve the data and convert it to its logical representation. The result of the BOM is paging information and logical SDOs matching the expression. This information is passed back by the fetch command which the GetNoun command will wrap in the ShowNoun response.

Get processing pattern

The following describes the detailed flow of the Get processing pattern as demonstrated in the preceding diagram:

  1. The get noun controller command executes and parses the get verb into a search expression.
  2. An access control check is performed to ensure the current user is allowed to use the access profile specified.
  3. The fetch command runs the search expression.
    1. The fetch command delegates to the business object mediator to run the search expression and returns a list of nouns matching the expression.
  4. There is an optional step of access control filtering of the data. The list of nouns returned by the fetch command is filtered to ensure the current user only views those nouns that they are allowed to see. To override this, you can override the filterNouns() method with an empty implementation.
    Note: The Get controller can override this default behavior if it is not required, for example, for performance reasons. The disadvantage of doing so is that access control filtering will not be performed, but the advantage is that the service will perform better. If the Fetch noun task that obtains the data already includes this type of filter, then the filterNouns() read filtering is not required.
  5. The InsertMoreData command runs to retrieve additional data (which could be from alternate data sources) pertaining to the noun.
    1. The InsertMoreData command delegates to the business object mediator to execute the search expression and returns a list of nouns matching the expression.
    Note: There can be one or more InsertMoreData commands defined per access profile.
  6. The nouns and the show verb is packaged in the ShowNoun response and returned.