Tutorial: Adding a Recipes tool to the Management Center
This tutorial shows you how to add a tool, the Recipes tool, to the Management Center. You will learn to use the Management Center programming framework to create a presentation layer using OpenLaszlo and JSPs files.
The tool that you are creating will use the services provided by the Project service module that you created in Tutorial: Creating the Project BOD service module. Adding the Recipes tool is continuation of that tutorial, and we will use and expand on the assets and configuration changes that you have made.
A recipe is an object that describes how to use several products that the retailer sells. Recipe is only one concrete example, directed to a retailer who sells cooking related items. This approach can be used for other market segments as well. A retailer who sells building supplies may call this object a Project plan. It would describe how you could build something from the things that they sell, such as a dog house. In our case, Recipe is a new primary object that we will create.
The Recipes tool uses the Project service module. This is a design choice. Project is a more general term, and more appropriate for a service module. You will be using Recipe as the name of the objects in the presentation layer, which will be tailored to Recipes.
The Recipe object has the following attributes.
- Name
- Recipe name
- Time
- The time it takes to complete the recipe.
- Difficulty
- Difficult, medium, or easy.
- RecipeDescription
- The short and long descriptions. Only the short description is shown in the Recipe list.
The ingredients and recipe instructions are child objects of Recipe. Ingredients are items that are incorporated into the recipe. An ingredient for the recipe can be a product that the store sells or something that is not in the catalog.
Within the new Recipes tool, business users can create, delete, or change a recipe, tag a recipe to facilitate grouping them together, associate a recipe with one or more products within the Recipes tool and associate a product with one or more recipes within the Catalogs tool. In the storefront, shoppers can navigate recipes by recipe collection, and the recommended products for that recipe are listed. Product pages also provide links to recipes that use that product.
Learning objectives
After completing this tutorial you should be able to:
- Add a custom tool to the Management Center.
- Create Management Center object definitions including: primary objects, child objects, and reference objects.
- Create Management Center view definitions, such as properties views and list views.
- Create Struts actions to process Management Center services.
- Create JSP files to display information using the get-data tag.
Time required
Expect this tutorial to take 4-5 hours to complete.
Skill level
Advanced
Audience
This tutorial is intended for WebSphere Commerce developers responsible for creating and customizing WebSphere Commerce SOA services and customizing the Management Center user interface.
System requirements
- WebSphere Commerce v7
- WebSphere Commerce Developer v7
- Downloaded and extracted the RecipeTool tutorial file to a temporary folder, for example TutorialSource.
Lessons in this tutorial
- Create a new user with the Recipe Manager role to access the Recipes tool
The Recipes tool is accessed only by users with Recipe Manager role. In this lesson, we will create a new user and assign the Recipe Manager role to the user.
- Work with UI text and images for a Management Center object
Hard-coding UI text and image file names in the following types of files is not recommended: OpenLaszlo class files and Management Center definition files.
- Model the Recipe noun to Management Center object definitions
In this lesson, we will model the noun, using Management Center object definitions.
- Define top and organizational objects in the explorer view
In this lesson, we will define the top object definition and the organization object definition in the Management Center explorer view.
- Define primary objects
As part of creating a custom tool for the Management Center, define an OpenLaszlo library class or a definition file for the primary objects.
- Define child objects and reference objects for a primary object
Your custom tool can include child objects and reference objects on which the primary object depends. In this lesson you define an OpenLaszlo library class or a definition file for all child and reference object definitions.
- Define search
As part of creating a custom tool for the Management Center, you define an OpenLaszlo library class for each search definition.
- Define views for a Management Center object
As part of creating a custom tool for the Management Center, define an OpenLaszlo library class or create a definition for each object's properties view and list view.
- Define a library class for all OpenLaszlo classes
As part of creating a custom tool for the Management Center, after you have defined all of the Management Center library classes, define a single library class that includes all the .LZX files that contain OpenLaszlo classes. The Management Center reads this file to understand and recognize all the associated classes for the new tool.
- Define the main Recipes tool definition
In this lesson, define the main definition for the Recipes tool. The tool definition must extend the wcfBusinessObjectEditor class, which is the base class for all Management Center tools. The business object editor includes support for the menu, toolbar, search widget, explorer view and utilities view. It is responsible for managing all user interactions that allow the user to edit the business objects declared with this business object editor.
- Integrate between the Management Center client and service module
The Management Center Web application mediates requests made between the Management Center client and the WebSphere Commerce services by transforming requests and responses.
- Retrive Management Center objects by transforming Nouns into XML
When data is sent from the WebSphere Commerce Server to the Management Center, the Management Center Web application transforms Nouns into the XML representation that is expected by the Management Center. The JSPs file that represents the Struts action forward is used to transform Nouns into XML format.
- Process Management Center services by transforming URL requests into BODs
Processing Management Center services involves transforming URL requests into Process BODs and Change BODs.
- Test the Recipes tool customization
In this lesson, we will test the Recipes tool using a Flash movie to guide you.