Implementing a value editor for Decision Center

You use a value editor to provide a custom graphical interface for your business-specific BOM types. You can implement a value editor for the Decision Center Guided Editor or Intellirule editor.

About this task

When you associate a BOM class with a value editor key (see Associating a value editor with a BOM type) you can implement a value editor for Decision Center. You must then repackage the Decision Center archive to integrate and declare the value editor.

Procedure

To implement a value editor for Decision Center:

  1. Create a value editor implementation for the required type of rule editor:
    • To define a value editor for the Guided Editor, extend the class IlrWValueEditorComponent.

    • To define a value editor for the Intellirule Editor, implement the interface IlrClientScriptFileValueEditorProvider or IlrClientScriptBlockValueEditorProvider. These interfaces define the server side of the value editor and call a script for the client part. This script may be defined in a file or directly in the Java file as a JavaScript block. For example:

      public class OfferValueEditorProvider implements IlrClientScriptFileValueEditorProvider {
      
      public String getClientScriptModulePath() {
      		return "/js/custom/valueeditors";
      	}
      
      public String getClientScriptModuleName() {
      		return "custom.valueeditors";
      	}
      
      public String getClientScriptClassName() {
      		return "custom.valueeditors.OfferValueEditor";
      	}
      
      }

      Create the JavaScript part of the value editor, using Dojo. Define a custom editor from the provided com.ibm.bdsl.web.valueeditors.ValueEditorBase. It may call a servlet to get the data to be shown from the server. Then it builds the html editor that gets the values.

      For example, create the /js/MyValueEditor.js JavaScript file with the following contents:

      dojo.declare('custom.valueeditors.OfferValueEditor', com.ibm.bdsl.web.valueeditors.ValueEditorBase, {
         getDomNode: function() {
            var serviceUrl =  config.contextPath + '/servlet/SampleValueEditorServletName';
            var divEditor = document.createElement('div');
            divEditor.className = "popupWindow folderSelector";
            var self = this;
            dojo.xhrPost({
               url: serviceUrl,
               content: addAccessToken({ offer:'true', editorId: this.editor.editorId}),
               // The success handler
               load: function(result) {
               ...
               return divEditor;
               },
               // The error handler
               error: function() {
                  return divEditor;
               }
            });
            return divEditor;
         },
         startEdit: function() {
         }
      });
  2. Create a preferences.properties file that maps the key for your editor to the fully qualified name of your implementation class, and include that file into the JAR file that contains your implementation:
    • For the Guided Editor, add the following line:

      webui.editor.<key>=mycompany.MyValueEditorClass

    • For the Intellirule Editor, add the following lines:

      "decisioncenter.web.core.intelliruleEditor.<key>" for the Business console.

      "teamserver.web.intelliruleEditor.<key>" for the Enterprise console.

    where <key> is the name of the value editor property of the BOM member.

    You can also set this preference as a Decision Center configuration parameter (see the set-config-param Ant task in ../../com.ibm.odm.dcenter.admin/topics/tpc_rts_ant_changing_params.html):

    • For the Guided Editor, set the configuration parameter as follows:

      ant set-config-param -Dkey=webui.editor.<key> -Dvalue=mycompany.MyValueEditorClass

    • For the Intellirule Editor, set the configuration parameter as follows:

      ant set-config-param -Dkey=decisioncenter.web.core.intelliruleEditor.<key> -Dvalue=mycompany.MyValueEditorClass for the Business console.

      ant set-config-param -Dkey=teamserver.web.intelliruleEditor.<key> -Dvalue=mycompany.MyValueEditorClass for the Enterprise console.

  3. Repackage the Decision Center archive with the repackage-ear command. In the repackage-ear command, use the -DadditionalJars argument to specify the JAR file containing your value editor class.
    Note:

    For information on how to repackage the Decision Center archive, see Repackaging the Decision Center archive.

  4. Deploy the Decision Center archive.

Results

The value editor is now available in Decision Center.