Properly extending Management Center in WebSphere Commerce

mcManagement Center is the easy to use business user tooling and is usually the primary tool you see in my YouTube videos. Extending WebSphere Commerce and its tooling is structured in a way in which upgrades are seamless. If you do not follow some of the basic guidelines outlined in the InfoCenter then you risk upgrading to the next feature pack with little effort. For the topic I am addressing here you can find some really good reference material here in the InfoCenter that directly relates to extending Management Center.

In this article I am going to explain how you add a new action to the business user tooling – Management Center. I started a project earlier, check out this post, where I added a Klout score check into the tooling.  Adding a new trigger, target, or action is really the same as adding a new struts action. So the first step is registering your new struts action and making sure you put the definition into the correct file.

Under the LOBToolsWebContentWEB-INF directory you will see a set of XML files that begin with “struts”. You will also notice some of them start with “struts-ibm” and there is one singled out as “struts-extension” – this is where your custom code goes.

  • struts-extension.xml
  • struts-ibm-attachment.xml
  • struts-ibm-catalog.xml
  • struts-ibm-catalogfilter.xml
  • struts-ibm-contentversion.xml
  • struts-ibm-foundation.xml
  • struts-ibm-installment.xml
  • struts-ibm-layout.xml
  • struts-ibm-marketing.xml
  • struts-ibm-price.xml
  • struts-ibm-promotion.xml
  • struts-ibm-search.xml
  • struts-ibm-store.xml
  • struts-ibm-tools.xml
  • struts-ibm-workspace.xml

Next you need to register your XML template in the database. This is done in the dmeletemplate table. What you want to do is query this table and see what templates have already defined by the core product and make sure your ID’s are very different from the base product ID’s. The best thing to do here is use a negative ID, similar to the way you create a custom language in Java applications:

DMELETEMPLATE_ID DMELEMENTTYPE_ID NAME
-10004 2 ‘checkKloutScore’

Here is a sample SQL insert I used to register the previous command:

insert into dmeletemplate (dmeletemplate_id, dmelementtype_id, name, implxml) 
 values 
 (
 -10004, 
 2, 
 'checkKloutScore', 
 '<FlowElementImplementation type="CheckKloutScore">'
 );

Your actual OpenLazlo code also needs to be properly placed in the folder structure to insure you don’t get clobbered on an upgrade. For instance, in the source folder “LOBToolsWebContentWEB-INFsrclzx” there is a “commerce” directory. You should create a new directory at the same level for your custom code – for instance in my demo machine I have a directory called “demoasset” where my source files go.

For the user interface definitions of your feature you really just need to stay out of the “restricted” directories since user interfaces will be in your own files. You will want to make sure you categories your feature into the correct directory. For instance, if you are creating a new precision marketing trigger, target, or action you may want to isolate your files in the marketing directory. However, you really should create your own top level directory structure, like your company name “acme” and then categorize your files accordingly.

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s