Management 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.
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:
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.