The MediaBanner cartridge displays a banner image to the site customer and can be configured to link to a static page or specified navigation state within the Commerce Reference Store application. The Style by Zhanna Brand Landing Page uses this cartridge to display a brand-specific banner image.

Note that Oracle Endeca Commerce also includes a MediaBanner cartridge out of the box. The Commerce Reference Store version of the MediaBanner cartridge uses the same response model and configuration classes as the Oracle Endeca Commerce cartridge but it uses a different template and handler, as described in the sections below.

Template

The XML template for the MediaBananer cartridge, located in <ATG10dir>/CommerceReferenceStore/Store/Storefront/deploy/cartridge_templates/MainContent-MediaBanner.xml, sets the cartridge’s content type to MainContent and its ID to MediaBanner. The XML template defines two editable properties:

Content Item and Handler

While it has a similar purpose, the MediaBanner cartridge that is implemented for Commerce Reference Store behaves differently from the MediaBanner cartridge that is included out of the box with Oracle Endeca Commerce. The Oracle Endeca Commerce MediaBanner cartridge retrieves media items that have been uploaded to the MDEX Engine or the Endeca Configuration Repository. The Commerce Reference Store version of the cartridge requires that you manually specify a URL for the image in Experience Manager. Both cartridges use the same classes for the associated content item and configuration, com.endeca.infront.cartridge.MediaBanner and com.endeca.infront.cartridge.MediaBannerConfig, respectively. However, they have different cartridge handler classes. The Commerce Reference Store version of the handler class is described below.

The /atg/endeca/assembler/cartridge/handler/MediaBannerHandler component, which is of class atg.projects.store.assembler.cartridge.handler.MediaBannerHandler, is responsible for creating and populating the MediaBanner object. The MediaBannerHandler class is an extension of the com.endeca.infront.cartridge.NavigationCartridgeHandler class with overridden wrapConfig() and process() methods.

The wrapConfig() method wraps the content item created from the XML template into a MediaBannerConfig object. The MediaBannerConfig object has a link property that contains the com.endeca.infront.cartridge.model.LinkBuilder object (this is the same LinkBuilder object that is referenced in the template). The LinkBuilder object represents the settings specified for the link in Experience Manager. Commerce Reference Store uses Oracle Endeca Commerce’s LinkBuilderEditor to render the appropriate link-related settings in Experience Manager and then those settings are stored in the LinkBuilder object.

This illustration is described in the surrounding text.

Note: The Config classes for the Oracle Endeca Commerce navigation cartridges, such as MediaBannerConfig, are an implementation-specific convention. They exist to simplify the initialize() method of the associated cartridge handler by externalizing the steps for aggregating all of the necessary cartridge configuration from various sources. This includes default configuration, business user configuration in Experience Manager, and URL configuration specified by the application end user. Because the Commerce Reference Store version of the MediaBanner cartridge is based on the Oracle Endeca Commerce version, it also uses the MediaBannerConfig class (though all of the configuration comes solely from Experience Manager). The resulting MediaBannerConfig object contains the full set of properties required by the MediaBannerHandler. Note that the other Oracle ATG Web Commerce-specific cartridges do not use Config classes as part of their implementation.

The process() method creates a new MediaBanner object and populates its link property (the imageURL property comes directly from the configuration in Experience Manager). To populate the link property, the MediaBannerHandler calls the createAction() method on the LinkBuilder object contained in the MediaBannerConfig object. This method constructs a link to a navigation state or a static page and then returns it in an object of one of the following types, each of which is a sub-class of the com.endeca.infront.cartridge.model.Action class:

The MediaBannerHandler component has several configurable properties. These properties reference components that the LinkBuilder object requires in order to construct the link associated with the media banner image.

Note: See the ATG Endeca Integration Guide for more details on the WorkbenchContentSource and DefaultActionPathProvider components.

Finally, the MediaBanner cartridge name does not match the name of its handler exactly, so it must be added to the NucleusAssemblerFactory.handlerMapping property so that the Assembler can identify the proper handler for it. See Registering Cartridges with the NucleusAssemblerFactory for details.

JSP Renderer

The store.war/cartridges/MediaBanner/MediaBanner.jsp page retrieves the imageURL and link properties from the response MediaBanner content item and then renders the image. If the link property has a value, the image is rendered as a link.

Because the link property can contain any one of three types of Action objects, the MediaBanner.jsp page invokes a helper component called /atg/endeca/store/droplet/ActionURLDroplet, which is of class atg.projects.store.droplet.ActionURLDroplet. This component takes the Action object returned in the MediaBanner.link property as an action input parameter and returns an actionURL string that represents the complete URL for the media banner image link. The form of the complete URL depends on the type of Action object:

The following code example shows the use of the ActionURLDroplet in the renderer code:

  <dsp:droplet name="ActionURLDroplet">
      <dsp:param name="action" value="${contentItem.link}"/>
      <dsp:oparam name="output">
        <dsp:getvalueof var="actionURL" param="actionURL"/>
      </dsp:oparam>
    </dsp:droplet>

Copyright © 1997, 2014 Oracle and/or its affiliates. All rights reserved. Legal Notices