001: /*
002: * Copyright (c) 2002-2003 by OpenSymphony
003: * All rights reserved.
004: */
005: package com.opensymphony.workflow.ejb;
006:
007: import com.opensymphony.workflow.*;
008: import com.opensymphony.workflow.loader.ClassLoaderUtil;
009:
010: import java.util.Map;
011:
012: import javax.ejb.*;
013:
014: /**
015: * @ejb.bean
016: * type="Stateless"
017: * name="Workflow"
018: * view-type="remote"
019: * transaction-type="Container"
020: *
021: * @ejb.ejb-ref
022: * ejb-name="HistoryStepPrev"
023: * view-type="local"
024: *
025: * @ejb.ejb-ref
026: * ejb-name="CurrentStepPrev"
027: * view-type="local"
028: *
029: * @ejb.ejb-ref
030: * ejb-name="CurrentStep"
031: * view-type="local"
032: *
033: * @ejb.ejb-ref
034: * ejb-name="HistoryStep"
035: * view-type="local"
036: *
037: * @ejb.permission unchecked="true"
038: * @ejb.transaction type="Supports"
039: *
040: * @author <a href="mailto:plightbo@hotmail.com">Pat Lightbody</a>
041: * @author <a href="mailto:hani@formicary.net">Hani Suleiman</a>
042: * @version $Revision: 1.7 $
043: */
044: public abstract class WorkflowEJB extends AbstractWorkflow implements
045: SessionBean {
046: //~ Methods ////////////////////////////////////////////////////////////////
047:
048: public void setSessionContext(SessionContext context) {
049: WorkflowContext workflowContext = null;
050:
051: try {
052: workflowContext = (WorkflowContext) ClassLoaderUtil
053: .loadClass(
054: getPersistenceProperties()
055: .getProperty("workflowContext",
056: "com.opensymphony.workflow.ejb.EJBWorkflowContext"),
057: getClass()).newInstance();
058: } catch (Exception e) {
059: e.printStackTrace();
060: }
061:
062: if (workflowContext instanceof EJBWorkflowContext) {
063: ((EJBWorkflowContext) workflowContext)
064: .setSessionContext(context);
065: }
066:
067: super .context = workflowContext;
068: }
069:
070: /**
071: * @ejb.interface-method
072: * @ejb.transaction type="Required"
073: */
074: public void changeEntryState(long id, int newState)
075: throws WorkflowException {
076: super .changeEntryState(id, newState);
077: }
078:
079: /**
080: * @ejb.interface-method
081: * @ejb.transaction type="Required"
082: */
083: public void doAction(long id, int actionId, Map inputs)
084: throws WorkflowException {
085: super .doAction(id, actionId, inputs);
086: }
087:
088: public void ejbCreate() {
089: }
090:
091: public void ejbPostCreate() throws CreateException {
092: }
093:
094: /**
095: * @ejb.interface-method
096: * @ejb.transaction type="Required"
097: */
098: public void executeTriggerFunction(long id, int triggerId)
099: throws WorkflowException {
100: super .executeTriggerFunction(id, triggerId);
101: }
102:
103: /**
104: * @ejb.interface-method
105: * @ejb.transaction type="Required"
106: */
107: public long initialize(String workflowName, int initialAction,
108: Map inputs) throws InvalidRoleException,
109: InvalidInputException, StoreException, WorkflowException {
110: return super.initialize(workflowName, initialAction, inputs);
111: }
112: }
|