/**
*
*/
package net.fp.rp.workflow.flow.action;
import net.fp.rp.workflow.db.MessageDao;
import net.fp.rp.workflow.flow.state.FlowStateBean;
import net.fp.rp.common.exception.RpException;
import org.apache.log4j.Logger;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
import org.springframework.beans.factory.BeanFactory;
/**
* A decision Handler to check if this client is registered and act accordingly
*
* This project uses Apache, Spring, JBoss and other GPL Licenced Code
*
* @author paul browne
*/
public class DecisionHandler2 extends AbstractActionHandler implements ActionHandler {
//Serial ID
static final long serialVersionUID = 1;
/** Logger for this class and subclasses */
protected final Logger log = Logger.getLogger(getClass());
//These values will be set by JBPM
// Name of the SpringDecisionTableLoaderBean bean
public static String DAO_NAME = "MessageDao";
/**
* Pass in the Execution Context, decide on which transition to leave the node by.
* jBPM expects the transition provided (
* @return String - name of the Transition to follow
*/
public void execute(ExecutionContext executionContext)
{
log.debug("Enter DecisionHandler2");
try{
//Carry out the processing
FlowStateBean flowBean=super.getFlowBeanFromContext(executionContext);
// Get the Spring bean responsible for loading the decision table
BeanFactory appContext = super.getSpringContext();
MessageDao mDao = (MessageDao) appContext.getBean(DAO_NAME);
executionContext.leaveNode();
//Default for the moment
} catch (Throwable t){
//Log the exception , end the workflow
log.warn("Exception occured , ending workflow",t);
executionContext.leaveNode(AbstractActionHandler.ERROR_TRANSITION_NAME);
}
log.debug("Exit DecisionHandler2");
}
}