View Javadoc

1   /*
2    * $Id: StoreIncomingData.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.providers.bpm.jbpm.actions;
12  
13  import org.mule.providers.bpm.ProcessConnector;
14  
15  import org.jbpm.graph.exe.ExecutionContext;
16  
17  /**
18   * Stores the incoming message payload into the specified variable. 
19   *   <action class="org.mule.providers.bpm.jbpm.actions.StoreIncomingData"> 
20   *      <variable>foo</variable>
21   *   </action>
22   */
23  public class StoreIncomingData extends IntegrationActionHandler
24  {
25  
26      private static final long serialVersionUID = 1L;
27  
28      protected String variable = ProcessConnector.PROCESS_VARIABLE_DATA;
29  
30      public void execute(ExecutionContext executionContext) throws Exception
31      {
32          super.execute(executionContext);
33          executionContext.setVariable(variable, transform(getIncomingMessage()));
34      }
35  
36      /**
37       * This method may be overriden in order to store the incoming data as a
38       * different type.
39       * 
40       * @param incomingData - the message that has arrived
41       * @return the object to be stored as a process variable
42       */
43      protected Object transform(Object incomingData) throws Exception
44      {
45          return incomingData;
46      }
47  
48  }