4 Replies Latest reply on May 11, 2011 9:01 AM by stellina_rosa

    new WorkItem for launch an external application

    stellina_rosa

      Hello everyone!

      I would like to know in what way I could launch an external application from a process, and what kind of node should I use? I thought a Service Task... could anyone help me?

        • 1. new WorkItem for launch an external application
          melc

          Hello,

          Yes a service task is the way to go.

          In order to create a custom (domain specific) service task you need to do what is described below,

           

          http://community.jboss.org/people/bpmn2user/blog/2011/03/28/jbpm5--work-itemdomain-specific-process-hello-process-example

           

          If you want to use your work item handler with the gwt-server and the console ( or your own console that uses the server) you can register the work item handler (instead of step 5 of the instruction of the above link)  within the  CustomWorkItemHandlers.conf located inside gwt-console-server's META-INF directory (also mentioned nicely in http://community.jboss.org/people/bpmn2user/blog/2011/03/30/jbpm5-example--human-task-forms-with-variables--workitems).

           

          p.s. i'm not sure about this, that's what i've done, in order not to (possibly) lose the functionality of log and email in step 1 of the first link (jbpm5--work-itemdomain-specific-process-hello-process-example) you  could add to the CustomWorkItem.conf the configuration for log and email as well (as found in drools-core-xxxx.jar -> META-INF/WorkDefinitions.conf), i.e.

          import org.drools.process.core.datatype.impl.type.ObjectDataType;

          import org.drools.process.core.datatype.impl.type.StringDataType;

          [

           

           

            [

              "name" : "Email",

              "parameters" : [

              "From" : new StringDataType(),

              "To" : new StringDataType(),

              "Subject" : new StringDataType(),

              "Body" : new StringDataType()

              ],

              "displayName" : "Email",

              "icon" : "icons/import_statement.gif",

              "customEditor" : "org.drools.eclipse.flow.common.editor.editpart.work.EmailCustomEditor"

            ],

           

           

            [

              "name" : "Log",

              "parameters" : [

                "Message" : new StringDataType()

              ],

              "displayName" : "Log",

              "icon" : "icons/open.gif",

              "customEditor" : "org.drools.eclipse.flow.common.editor.editpart.work.SampleCustomEditor"

            ],

          [

              "name" : "HelloProcessExtension",

               "icon" : "icons/action.gif",

              "displayName" : "HelloProcessExtension"

            ]

          ]

          • 2. new WorkItem for launch an external application
            stellina_rosa

            ok, thank you! I tried the example to your first link and now I have my work item "Notification"

            but.. a in a work item I can declare WHAT to do and not HOW DO... suppose that I must call an external application: in my work item I set the parameter... but where could I write the code to launch the external application? do you know some example?

            thank you very much!

            • 3. Re: new WorkItem for launch an external application
              melc

              in the link below,

              http://community.jboss.org/people/bpmn2user/blog/2011/03/28/jbpm5--work-itemdomain-specific-process-hello-process-example

               

              at step 4 you created a class corresponding to the work item inside the  WorkItemHandler implementation class there is a method you have to implement public void executeWorkItem(..) inside this method you can put custom logic, i.e. custom business logic, call another application via a jar, or call a web service etc.

               

              If for example you call another class or application which is inside a jar then you'll have to include the jar (and any other dependencies of the jar to run) in the libs of your jbpm application (i.e. in your jbpm application classpath) or if you're using the gwt-server implementation with the console then you'll have to place the jar file (and any other dependencies of the jar to run) inside the gwt-console-server.war/lib along with the other jars.

              Also don't forget to include the workitem jar itself inside the lib of gwt-console-server.war or your jbpm application's classpath, depending how you use jbpm5.

              • 4. new WorkItem for launch an external application
                stellina_rosa

                Ok!!! thank you very much for your help! you cleared me a lot of things!