jbpmredhat-bpm

Transform Custom Task in JBPM


I am using Business Central (JBPM) and I am trying to use the Custom Task Transform that transforms a Java input Object to an output Object.

As you see, I have installed the work task and the corresponding handler is in place.

enter image description here

enter image description here

enter image description here

In the corresponding data assignments I have set the input and output objects, but when I start the process i get the following.

09:57:05,321 ERROR [org.jbpm.process.workitem.transform.TransformWorkItemHandler] (default task-44) Failed to find a transform

That means that I didn't include the related transformation methods annotated with @Transformer. In the handler class I see that there is the method registerTransformer(Class<?> transformer) that must be called in order to load the transformers.

I don't know how to invoke the previous mentioned method withing Business Central. Is there a specific menu that I should go in order to do the registration?

Thanks in advance!


Solution

  • If you are talking about this handler: https://github.com/jhonfx/jbpm-examples/blob/master/krisv-jbpm/jbpm-workitems/src/main/java/org/jbpm/process/workitem/transform/TransformWorkItemHandler.java It's a very old one - not maintained for 8 years. It's not part of the core jBPM repo anymore. However, if you really need to use it..

    This is how it's used:

            TransformWorkItemHandler transformWorkItemHandler = new TransformWorkItemHandler();
            transformWorkItemHandler.registerTransformer(FileTransformer.class);
            ksession.getWorkItemManager().registerWorkItemHandler("Transform", transformWorkItemHandler);
    

    Unfortunately, this way of calling "registerTransformer" method, can't be easily replicated in RHPAM 7 (jBPM7) where registration of handlers is done in declarative way. Therefore, I would advise to extend this handler, introduce new parameter in constructor (i.e. Class transformer) and register this transformer in the constructor (basically copy paste the code of registerTransformer inside constructor).