LSPS documentation logo
LSPS Documentation
Custom Objects

In your application, you can create implementations of the following custom objects:

  • functions: implemented in the Expression Language or as a Java class methods
  • task types: implemented as Java classes implementing the ExecutableTask interface
  • form components: implemented in the Expression Language or as Java classes implementing the UIComponent interface

Every custom object has its implementation either in the Expression Language or in Java and its definition in a definition file: for example, a custom form component must be implemented as a Java class that extends the UIComponent interface or as an expression that returns a custom component in the Expression Language; and its custom component definition must be in a definition file so you can use it for modeling.

When implementing your custom objects in Java, you can implement them as POJOs or as EJBs: it is recommended to implement them as POJOs unless the object needs to use a server service. In such a case, the EJB must be then registered with the Execution Engine using the ComponentServiceBean.

Registering EJBs of Custom Objects

Once you have created your EJB implementation of a custom object, you need to register it with the Execution Engine:

  1. In your ejb project, create a ComponentServiceBean class that extends com.whitestein.lsps.common.ComponentServiceBase.
  2. Inject the EJB:
    • For custom tasks, use the ExecutableTask interface with the bean name set to the implementing class name.
      @EJB(beanName="SendGoodsTask")
      private ExecutableTask sendGoodsTask;
    • For custom functions, use your local interface that declares all functions used in the model.
      @EJB(beanName="ShippingFeeFunctions")
      private ShippingFeeFunctions shippingFeeFunctions;
  3. Register the custom component implementing the registerCustomComponents() method:
    • If you have your interface for your implementation:
      @Override
      protected void registerCustomComponents() {
          //register(<task_instance>, <task_interface>.class);
          register(sendGoodsTask, SendGoodsTask.class);
          //register(<function_instance>, <function_interface_class>.class);
          register(shippingFeeFunctions, ShippingFeeFunctions.class);
      }
      
    • If you do not have an interface for your implementation:
      @Override
      protected void registerCustomComponents() {
          register(<task_instance>, <task_implementation>.class);
          register(<function_instance>, <function_implementation>.class);
      }