hero.session
Class ProjectSessionBean

java.lang.Object
  extended byhero.session.ProjectSessionBean
All Implemented Interfaces:
javax.ejb.EnterpriseBean, hero.util.EventConstants, java.io.Serializable, javax.ejb.SessionBean

public class ProjectSessionBean
extends java.lang.Object
implements javax.ejb.SessionBean, hero.util.EventConstants

Project Session Bean is an stateful session bean that provides the interface for workflow process definition. By means of this API we can create workflow processes, project activities, transitions between activities , users and roles, properties, hooks, external agents...

A Bonita Workflow process is composed by the activities (nodes) and the connections between these activities (edges). For each project, the administrator/s set the list of responsibles to execute these activites (users and roles). In the same way, the Project Session Bean API offers a great number of functionalities for working with activities behaviors (hooks) and workflow relevant data (properties).

This API can be used on different contexts depending on the needs of your application, so you can instantiate an existing project in order to perform set, get, update and remove operations, you can create a new workflow project (by instantiating a project that does not exists), you can clone an existing project or creates a new workflow instante of a project. The following lines shows a sample code to use this API in your application:


First of all you have to import the Project Session files:

import hero.interfaces.ProjectSessionLocalHome;
import hero.interfaces.ProjectSessionLocal;
import hero.interfaces.ProjectSessionHome;
import hero.interfaces.ProjectSession;
import hero.interfaces.ProjectSessionUtil;

Now, it is time to create the Project Session instance:

Like this if you want to use local interfaces:

ProjectSessionLocalHome projecth = (ProjectSessionLocalHome)hero.interfaces.ProjectSessionUtil.getLocalHome();
ProjectSessionLocal projectsession = projecth.create();

or like this if you use remote interfaces:

ProjectSessionHome userh = (ProjectSessionHome)hero.interfaces.ProjectSessionUtil.getHome();
ProjectSession projectsession = projecth.create();


- If you want to use Project Session API for a specific project, you have to init this project by using:

projectsession.initProject("yourProject");

- In order to clone an existing project, you have to call the initProject method:

projectsession.initProject("Project","CloneProject");

- If you want to instantiate a project, you have to do the following:

projectsession.instantiateProject("Project");

Now you can use Project Session methods...

Author:
Miguel Valdes
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface hero.util.EventConstants
ADDEDGE, ADDITERATION, ADDNODE, ADDROLE, ADDUSERPROJECT, ANTICIPATING, CANCELED, CHANGEROLE, DELETEEDGE, DELETENODE, DELETEPROJECT, EDGE, EDGENAME, EVENT, FROM, ITERATION, LOG, NODE, NODEDEADLINE, NODEIN, NODENAME, NODEOUT, NODESTATE, NODETYPE, PROJECT, PROJECTNAME, READYINITIAL, ROLE, ROLENAME, SETEDGESTATE, SETNODEDEADLINE, SETNODEEXECUTOR, SETNODESTATE, SETUSERROLE, START, TERMINATED, TO, UNSETUSERROLE, USER, USERNAME, USERROLE
 
Constructor Summary
ProjectSessionBean()
           
 
Method Summary
 void addAgent(java.lang.String name)
          Add an Agent to the Project
 java.lang.String addAgentEdge(java.lang.String in, java.lang.String out)
          Add an AgentEdge to the Project [in] ---- [out]
 java.lang.String addEdge(java.lang.String in, java.lang.String out)
          Add an edge between two nodes of the project [in] ---- [out].
 void addEdge(java.lang.String name, java.lang.String in, java.lang.String out)
          Add an edge to the project.
 void addHook(java.lang.String hookName, java.lang.String eventName, int hookType)
          Add hook to project.
 void addInterHook(java.lang.String hookName, java.lang.String eventName, int hookType, java.lang.String value)
          Add interhook to the project.
 void addIteration(java.lang.String from, java.lang.String to, java.lang.String condition)
          Add a new iteration between two nodes.
 void addNode(java.lang.String name, int nodeType)
          Add a node to the project.
 void addNodeHook(java.lang.String nodeName, java.lang.String hookName, java.lang.String eventName, int hookType)
          Add hook to a node.
 void addNodeInterHook(java.lang.String nodeName, java.lang.String hookName, java.lang.String eventName, int hookType, java.lang.String value)
          Add interhook to a node.
 void addNodePerformerAssign(java.lang.String nodeName, java.lang.String performerAssignName, int performerAssignType, java.lang.String propertyName)
          Add performerAssign to a node.
 void addNodeSubProcess(java.lang.String name, java.lang.String projectName)
          Add a subProcess node to the project.
 void addRole(java.lang.String roleName, java.lang.String description)
          Add a role to the project.
 void addRoleMapper(java.lang.String roleName, java.lang.String mapperName, int mapperType)
          Add mapper to a role.
 void addUser(java.lang.String userName)
          Add a user to this project (This user must exist at bonita database)
 boolean containsUser(java.lang.String userName)
          Test if the project contains this user
 void deleteEdge(java.lang.String name)
          Delete an edge to the project.
 void deleteHook(java.lang.String hookName)
          Detete a hook.
 void deleteInterHook(java.lang.String interHookName)
          Detete a interHook of this project.
 void deleteNode(java.lang.String name)
          Delete a node from the project.
 void deleteNodeHook(java.lang.String nodeName, java.lang.String hookName)
          Delete a node hook.
 void deleteNodeInterHook(java.lang.String nodeName, java.lang.String interHookName)
          Delete a node interHook.
 void deleteNodeProperty(java.lang.String nodeName, java.lang.String key)
          Delete a property of a node.
 void deleteProperty(java.lang.String key)
          Delete a property of the project.
 void deleteRoleMapper(java.lang.String roleName)
          Delete a role mapper.
 void edgeDeletion(BnEdgeLocal ed)
          Actually deletes an edge and restore the state of the outgoing node Not a business method
 void ejbActivate()
          Internal Enterprise Java Beans method.
 void ejbCreate()
          Creates the Project Session Bean.
 void ejbPassivate()
          Internal Enterprise Java Beans method.
 void ejbPostCreate(java.lang.String oldProject, java.lang.String newProject)
          Internal Enterprise Java Beans method.
 void ejbRemove()
          Internal Enterprise Java Beans method.
 BnAgentEdgeValue getAgentEdgeValue(java.lang.String name)
          Get the AgentEdge Value
 BnAgentValue getAgentValue(java.lang.String name)
          Get the Agent Value.
 java.util.Collection getAllUsers()
          Return all registered users.
 java.lang.String getCreator()
          Get creator of the project.
 BnProjectValue getDetails()
          Get the ProjectValue (historique).
 java.lang.String getEdgeCondition(java.lang.String edge)
          Get the edge Condition.
 java.lang.String getEdgeInNode(java.lang.String edgeName)
          Get edge in node.
 java.lang.String getEdgeOutNode(java.lang.String edgeName)
          Get edge out node.
 java.util.Collection getEdgesNames()
          Get all edges names of the project
 BnEdgeValue getEdgeValue(java.lang.String name)
          Get the edge value.
 java.util.Collection getHooks()
          Get hooks of the project.
 java.util.Collection getInterHooks()
          Get Interactive hooks of the project.
 java.lang.String getInterHookValue(java.lang.String hook)
          Get the inter hook value script.
 java.lang.String getIterationCondition(java.lang.String from)
          Get iteration condition
 boolean getIterationExist(java.lang.String from)
          Verifies if this node starts an iteration
 java.util.Collection getIterations()
          Get Iterations of the project.
 java.lang.String getName()
          Get ProjectName
 boolean getNodeAnticipable(java.lang.String name)
          Returns if the node is set to be executed in anticipated mode.
 java.lang.String getNodeDeadline(java.lang.String nodeName)
          Get node deadline.
 java.lang.String getNodeDescription(java.lang.String name)
          Get the node description.
 java.lang.String getNodeExecutor(java.lang.String name)
          Get the node executor.
 java.util.Collection getNodeHooks(java.lang.String nodeName)
          Get Node hooks of the project.
 java.util.Collection getNodeInEdges(java.lang.String name)
          Get all in edges of the node
 BnNodeInterHookValue getNodeInterHook(java.lang.String nodeName, java.lang.String interHook)
          Get Node inter hook of the project
 java.util.Collection getNodeInterHooks(java.lang.String nodeName)
          Get Interactive Node hooks of the project
 java.lang.String getNodeInterHookValue(java.lang.String node, java.lang.String hook)
          Get the node hook value.
 BnNodeLightValue getNodeLightValue(java.lang.String name)
          Get the node Light Value.
 java.util.Collection getNodeOutEdges(java.lang.String name)
          Get all out edges of the node
 java.util.Collection getNodeProperties(java.lang.String nodeName)
          Get Node properties.
 BnNodePropertyValue getNodeProperty(java.lang.String nodeName, java.lang.String key)
          Get Node property value.
 BnRoleLocal getNodeRole(java.lang.String nodeName)
          Get node role.
 java.lang.String getNodeRoleName(java.lang.String nodeName)
          Get node role name.
 java.lang.Object[] getNodes()
          Get the project nodes.
 java.util.Collection getNodesNames()
          Get all node names of the project
 int getNodeState(java.lang.String name)
          Get the state of the node.
 int getNodeType(java.lang.String name)
          Get the type of the node.
 BnNodeValue getNodeValue(java.lang.String name)
          Get the node Value.
 java.lang.String getParent()
          Get the parent project of this project
 java.lang.String getProjectNameOfInstance(java.lang.String instanceName)
          Get the project name of this instance
 java.util.Collection getProperties()
          Get properties of the project.
 java.util.Collection getPropertiesKey()
          Get properties key of the project.
 BnProjectPropertyValue getProperty(java.lang.String key)
          Get property value of the project.
 java.util.Collection getRoleMappers()
          Get role mappers of the project.
 java.util.Collection getRoles()
          Get all roles of the project
 java.util.Collection getRolesNames()
          Get all roles names of the project
 java.util.Collection getStrutsEdges()
          Get the StrutsEdges.
 hero.util.StrutsNodeValue getStrutsNode(java.lang.String nodeName)
          Get the StrutsNode.
 java.util.Collection getStrutsNodeEdges(java.lang.String nodeName)
          Get the Edges of the Node.
 java.util.Collection getStrutsNodes()
          Get the StrutsNodes.
 java.lang.String getToIteration(java.lang.String from)
          Get node destination of this iteration.
 java.util.Collection getUserRoles(java.lang.String userName)
          Get all user roles.
 java.util.Collection getUserRolesInProject(java.lang.String userName)
          Get user roles in project.
 java.util.Collection getUserRolesInProjectNames(java.lang.String userName)
          Get user roles in project names.
 java.util.Collection getUsers()
          Get all users of the project.
 void hookEvent(java.lang.String nodeName, java.lang.String event)
          Execute a node hook.
 void importInstance(java.lang.String projectName, java.lang.String instance)
          Import Project instance.
 void importProject(java.lang.String projectName)
          Import all the nodes, hooks and edges of a project to the current project
 void importProject(java.lang.String projectName, java.lang.String prefix)
          Import all the nodes, hooks, properties and edges of a project to the current project
 void initProject(java.lang.String projectName)
          Init the Project Session Bean.
 void initProject(java.lang.String oldProject, java.lang.String newProject)
          init the Project Session Bean (clone project).You have to call this method after "create" call.
 java.lang.String instantiateProject(java.lang.String project)
          Project instance.
 void propagateNodeProperties(java.lang.String nodeName)
          Propagate node properties.
 void propagatesParentProperties(java.lang.String node)
          Propagate subProcess activity properties to subProcess
 void propagatesSubProcessProperties(java.lang.String node)
          Propagate subProcess properties to subProcess activity.
 void setAgentEdgeState(BnAgentEdgeLocal agentEdge, int state)
          Set the agentEdge state
 void setAgentState(BnAgentLocal agent, int state)
          Set the agent state
 void setEdgeCondition(java.lang.String edge, java.lang.String condition)
          Set the edge condition.
 void setEdgeState(BnEdgeLocal edge, int state)
          Set the edge state
 void setEditNode(java.lang.String node, java.lang.String role, java.lang.String description, long deadline)
          Set edit node changes.
 void setInterHookValue(java.lang.String hook, java.lang.String value)
          Set the hook value.
 void setNodeAnticipable(java.lang.String name)
          Set the node in anticipable mode.
 void setNodeAutomatic(java.lang.String name)
          Set the node in automatic mode.
 void setNodeDeadline(java.lang.String name, long date)
          Set the node deadline.
 void setNodeDescription(java.lang.String name, java.lang.String description)
          Set the node description.
 void setNodeExecutor(java.lang.String name)
          Set the name of the node executor.
 void setNodeInterHookValue(java.lang.String node, java.lang.String hook, java.lang.String value)
          Set the node hook value.
 void setNodeProperty(java.lang.String nodeName, java.lang.String key, java.lang.String value)
          Set a property of a node.
 void setNodeProperty(java.lang.String nodeName, java.lang.String key, java.lang.String value, boolean propagate)
          Set a property of a node.
 void setNodeRole(java.lang.String name, java.lang.String role)
          Sets the role of an activity.
 void setNodesReady()
          Set all initial roles to ready if node does not has in edges.
 void setNodeState(BnNodeLocal node, int state)
          Set the node state.
 void setNodeTraditional(java.lang.String name)
          Set the node in traditional mode.
 void setNodeType(java.lang.String name, int type)
          Set the node type.
 void setProperty(java.lang.String key, java.lang.String value)
          Set a property of the project.
 void setSessionContext(javax.ejb.SessionContext context)
          Internal Enterprise Java Beans method.
 void setUserRole(java.lang.String userName, java.lang.String roleName)
          Set a role to this user.
 void unsetUserRole(java.lang.String userName, java.lang.String roleName)
          Unset a user role in this project.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectSessionBean

public ProjectSessionBean()
Method Detail

addUser

public void addUser(java.lang.String userName)
             throws hero.util.HeroException
Add a user to this project (This user must exist at bonita database)

Parameters:
userName - The name of the user to associate to the project
Throws:
hero.util.HeroException

addNode

public void addNode(java.lang.String name,
                    int nodeType)
             throws hero.util.HeroException
Add a node to the project. This method creates a node with the corresponding node type and assign to it the hero.interfaces.Constants.InitialRole role.

Possible node types are:

hero.interfaces.Constants.Nd.AND_JOIN_NODE // Manual and join node
hero.interfaces.Constants.Nd.OR_JOIN_NODE // Manual or join node
hero.interfaces.Constants.Nd.AND_JOIN_AUTOMATIC_NODE // Automatic and join node
hero.interfaces.Constants.Nd.OR_JOIN_AUTOMATIC_NODE // Automatic or join node

Parameters:
name - The name of the node to add to the project
nodeType - The type of the node to add to the project
Throws:
hero.util.HeroException

addNodeSubProcess

public void addNodeSubProcess(java.lang.String name,
                              java.lang.String projectName)
                       throws hero.util.HeroException
Add a subProcess node to the project. This method creates the subProject from an existing project and creates the node associated to it. The type of created node is hero.interfaces.Constants.Nd.SUB_PROCESS_NODE

Parameters:
name - The name of the node to add to the project
projectName - the name of the subProcess
Throws:
hero.util.HeroException

addAgent

public void addAgent(java.lang.String name)
              throws hero.util.HeroException
Add an Agent to the Project

Parameters:
name - The name of the Agent to add to the project
Throws:
hero.util.HeroException

addEdge

public void addEdge(java.lang.String name,
                    java.lang.String in,
                    java.lang.String out)
             throws hero.util.HeroException
Add an edge to the project. Creates a transition between two nodes by specifying the name of this edge. No more implemented

Parameters:
name - the name ot the edge
Throws:
hero.util.HeroException

addEdge

public java.lang.String addEdge(java.lang.String in,
                                java.lang.String out)
                         throws hero.util.HeroException
Add an edge between two nodes of the project [in] ---- [out]. This operation refresh the out node state. If new edge forms a cycle an exception is throwed.

Parameters:
in - the name of the in Node
out - the name of the out Node
Throws:
hero.util.HeroException

addAgentEdge

public java.lang.String addAgentEdge(java.lang.String in,
                                     java.lang.String out)
                              throws hero.util.HeroException
Add an AgentEdge to the Project [in] ---- [out]

Parameters:
in - the name of the in Agent
out - the name of the out Node
Throws:
hero.util.HeroException

addRole

public void addRole(java.lang.String roleName,
                    java.lang.String description)
             throws hero.util.HeroException
Add a role to the project. Creates a role within this project. The role is specific of this project

Parameters:
description - the description of the role
Throws:
hero.util.HeroException

addIteration

public void addIteration(java.lang.String from,
                         java.lang.String to,
                         java.lang.String condition)
                  throws hero.util.HeroException
Add a new iteration between two nodes. This methods sets an iteration which is stopped when the lastNode property "iterate" is false.

Parameters:
from - the name of the first node
to - the name of the last node
Throws:
hero.util.HeroException

addHook

public void addHook(java.lang.String hookName,
                    java.lang.String eventName,
                    int hookType)
             throws hero.util.HeroException
Add hook to project. Add an existing hook file to the project. This hook type uses a Java or TCL file loaded at run time. The hookName represents the class java or tcl file to be loaded by the system at run time. These classes must be in the application server classpath to be correctly executed. Put your hooks classes in $BONITA_HOME\src\resources\hooks and then redeploy bonita.ear (ant task).

Parameters:
hookName - the name of the hook
eventName - the event
hookType - the type
Throws:
hero.util.HeroException

addNodeHook

public void addNodeHook(java.lang.String nodeName,
                        java.lang.String hookName,
                        java.lang.String eventName,
                        int hookType)
                 throws hero.util.HeroException
Add hook to a node. Add an existing hook file to the node. This type of hook use a Java or TCL file loaded at run time. The hookName represents the class java or tcl file to be loaded by the system at run time. These classes must be in the application server classpath to be correctly executed. Put your hooks classes in $BONITA_HOME\src\resources\hooks and then redeploy bonita.ear (ant task).

Parameters:
nodeName - the name of the node
hookName - the name of the hook
eventName - the name of the event
hookType - the type of the hook
Throws:
hero.util.HeroException

addRoleMapper

public void addRoleMapper(java.lang.String roleName,
                          java.lang.String mapperName,
                          int mapperType)
                   throws hero.util.HeroException
Add mapper to a role. Add an existing mapper to the role. This type of mapper use a Java file loaded at run time.

Parameters:
roleName - the name of the role
mapperName - the name of the mapper
mapperType - the type of the mapper
Throws:
hero.util.HeroException

addNodePerformerAssign

public void addNodePerformerAssign(java.lang.String nodeName,
                                   java.lang.String performerAssignName,
                                   int performerAssignType,
                                   java.lang.String propertyName)
                            throws hero.util.HeroException
Add performerAssign to a node. Add an existing performerAssign to the node. This type of performerAssign use a Java file loaded at run time.

Parameters:
nodeName - the name of the node
performerAssignName - the name of the performerAssign
performerAssignType - the type of the performerAssign
Throws:
hero.util.HeroException

addNodeInterHook

public void addNodeInterHook(java.lang.String nodeName,
                             java.lang.String hookName,
                             java.lang.String eventName,
                             int hookType,
                             java.lang.String value)
                      throws hero.util.HeroException
Add interhook to a node. Set a new hook to this node by setting the eventName, hookType and script values.

The possible values of the argumets are:

eventName:
hero.interfaces.Constants.Nd.BEFORESTART
hero.interfaces.Constants.Nd.AFTERSTART
hero.interfaces.Constants.Nd.BEFORETERMINATE
hero.interfaces.Constants.Nd.AFTERTERMINATE
hero.interfaces.Constants.Nd.ONCANCEL
hero.interfaces.Constants.Nd.ANTICIPATE

hookType:
hero.hook.Hook.BSINTERACTIVE

script:
The beanshell source code associated to this hook.

The following sample code illustrates how to use this method:

...
String script = "import hero.interfaces.*;\n"
+ "import hero.interfaces.BnNodeLocal;\n"
+ "beforeStart (Object b,Object n) {\n\n\n"
+ "System.out.println(\"Hook Test\");\n"
+ "}";
yourProjectSessionInstance.addNodeInterHook("NodeName","Hook_Name",Constants.Nd.BEFORESTART,hero.hook.Hook.BSINTERACTIVE,script);

Parameters:
nodeName - the name of the node
hookName - the name of the hook
eventName - the name of the event
hookType - the type of the hook
Throws:
hero.util.HeroException

addInterHook

public void addInterHook(java.lang.String hookName,
                         java.lang.String eventName,
                         int hookType,
                         java.lang.String value)
                  throws hero.util.HeroException
Add interhook to the project. Creates new hook associated to all project activites. See the addNodeInterHook method in order to identify arguments values.

Parameters:
hookName - the name of the hook
eventName - the name of the event
hookType - the type of the hook
Throws:
hero.util.HeroException

deleteNode

public void deleteNode(java.lang.String name)
                throws hero.util.HeroException
Delete a node from the project. If this node is in executing, terminated or cancelled state, the method throws an execption

Parameters:
name - the name ot the edge
Throws:
hero.util.HeroException

deleteEdge

public void deleteEdge(java.lang.String name)
                throws hero.util.HeroException
Delete an edge to the project. If out node of this edge is in executing, terminated or cancelled state, the method throws an execption.

Parameters:
name - the name ot the edge
Throws:
hero.util.HeroException

edgeDeletion

public void edgeDeletion(BnEdgeLocal ed)
                  throws hero.util.HeroException
Actually deletes an edge and restore the state of the outgoing node Not a business method

Throws:
hero.util.HeroException

deleteHook

public void deleteHook(java.lang.String hookName)
                throws hero.util.HeroException
Detete a hook. Delete a Java or aTCL hook of this project.

Parameters:
hookName - the name of the hook
Throws:
hero.util.HeroException

deleteNodeHook

public void deleteNodeHook(java.lang.String nodeName,
                           java.lang.String hookName)
                    throws hero.util.HeroException
Delete a node hook. Delete a Java or a TCL hook of this node.

Parameters:
nodeName - the name of the node
hookName - the name
Throws:
hero.util.HeroException

deleteNodeInterHook

public void deleteNodeInterHook(java.lang.String nodeName,
                                java.lang.String interHookName)
                         throws hero.util.HeroException
Delete a node interHook.

Parameters:
nodeName - the name of the node
Throws:
hero.util.HeroException

deleteInterHook

public void deleteInterHook(java.lang.String interHookName)
                     throws hero.util.HeroException
Detete a interHook of this project. This method deletes this hook from all projects nodes.

Throws:
hero.util.HeroException

deleteRoleMapper

public void deleteRoleMapper(java.lang.String roleName)
                      throws hero.util.HeroException
Delete a role mapper.

Parameters:
roleName - the name of the node
Throws:
hero.util.HeroException

deleteProperty

public void deleteProperty(java.lang.String key)
                    throws hero.util.HeroException
Delete a property of the project. Deletes the project property associated to this key.

Parameters:
key - the key of the property
Throws:
hero.util.HeroException

deleteNodeProperty

public void deleteNodeProperty(java.lang.String nodeName,
                               java.lang.String key)
                        throws hero.util.HeroException
Delete a property of a node. Deletes the node property associated to this key

Parameters:
nodeName - the name of the node
key - the key of the property
Throws:
hero.util.HeroException

setUserRole

public void setUserRole(java.lang.String userName,
                        java.lang.String roleName)
                 throws hero.util.HeroException
Set a role to this user. This role is assigned to the user in the context of the actual project.

Parameters:
userName - the name of the user
roleName - the name of the role
Throws:
hero.util.HeroException

propagateNodeProperties

public void propagateNodeProperties(java.lang.String nodeName)
                             throws hero.util.HeroException
Propagate node properties. Propagates all node properties to connected nodes.

Parameters:
nodeName - the name of the Node
Throws:
hero.util.HeroException

setNodeRole

public void setNodeRole(java.lang.String name,
                        java.lang.String role)
                 throws hero.util.HeroException
Sets the role of an activity. Changes the role of this activity

Parameters:
name - the name of the activity
role - the name of the role
Throws:
hero.util.HeroException

setNodeState

public void setNodeState(BnNodeLocal node,
                         int state)
                  throws hero.util.HeroException
Set the node state. Set start date of this node when starts the execution and the end date when node is terminated.

Parameters:
state - new state of the node
Throws:
hero.util.HeroException

setNodesReady

public void setNodesReady()
                   throws hero.util.HeroException
Set all initial roles to ready if node does not has in edges.

Throws:
hero.util.HeroException

propagatesParentProperties

public void propagatesParentProperties(java.lang.String node)
                                throws hero.util.HeroException
Propagate subProcess activity properties to subProcess

Parameters:
node - the name of the node
Throws:
hero.util.HeroException

propagatesSubProcessProperties

public void propagatesSubProcessProperties(java.lang.String node)
                                    throws hero.util.HeroException
Propagate subProcess properties to subProcess activity.

Parameters:
node - the name of the node
Throws:
hero.util.HeroException

setEdgeState

public void setEdgeState(BnEdgeLocal edge,
                         int state)
                  throws hero.util.HeroException
Set the edge state

Throws:
hero.util.HeroException

setAgentState

public void setAgentState(BnAgentLocal agent,
                          int state)
                   throws hero.util.HeroException
Set the agent state

Parameters:
agent - bean of the Agent
Throws:
hero.util.HeroException

setAgentEdgeState

public void setAgentEdgeState(BnAgentEdgeLocal agentEdge,
                              int state)
                       throws hero.util.HeroException
Set the agentEdge state

Parameters:
agentEdge - bean of the BnAgentEdge
Throws:
hero.util.HeroException

setEditNode

public void setEditNode(java.lang.String node,
                        java.lang.String role,
                        java.lang.String description,
                        long deadline)
                 throws hero.util.HeroException
Set edit node changes. Only for GraphEditor client

Parameters:
role - of the node
description - of the node
deadline - of the node
Throws:
hero.util.HeroException

setEdgeCondition

public void setEdgeCondition(java.lang.String edge,
                             java.lang.String condition)
                      throws hero.util.HeroException
Set the edge condition. This condition is evaluated at run-time in order to perform activity transition. To set the condition you have to use beanshell language (Lightweight Scripting for Java).
The next line illustrates the use of setEdgeCondition method:

...
String condition = "partial_status.equals(\"ok\")";
yourProjectSessionInstance.setEdgeCondition("edgeName",condition);

The engine evaluates on the fly the condition by using the If statement. In the previous sample, if the value of the property "partial_status" is equals to "ok" the result of this condition is true.

Parameters:
edge - edge name
condition - condition of the edge
Throws:
hero.util.HeroException

setNodeDeadline

public void setNodeDeadline(java.lang.String name,
                            long date)
                     throws hero.util.HeroException
Set the node deadline. Activity deadline is the lastest date in which the activity must be finished.

Parameters:
name - the name of the node
date - date of the deadline
Throws:
hero.util.HeroException

setNodeDescription

public void setNodeDescription(java.lang.String name,
                               java.lang.String description)
                        throws hero.util.HeroException
Set the node description. Node description represents, explicity, execution related information of this task.

Parameters:
name - the name of the node
Throws:
hero.util.HeroException

setNodeInterHookValue

public void setNodeInterHookValue(java.lang.String node,
                                  java.lang.String hook,
                                  java.lang.String value)
                           throws hero.util.HeroException
Set the node hook value.

Parameters:
hook - hookName of the node
value - new script value of this hook
Throws:
hero.util.HeroException

setInterHookValue

public void setInterHookValue(java.lang.String hook,
                              java.lang.String value)
                       throws hero.util.HeroException
Set the hook value. This value is the new hook script associated to all project nodes

Parameters:
hook - hookName of the node
value - new script value of this hook
Throws:
hero.util.HeroException

unsetUserRole

public void unsetUserRole(java.lang.String userName,
                          java.lang.String roleName)
                   throws hero.util.HeroException
Unset a user role in this project.

Parameters:
userName - name of the user
roleName - name of the role
Throws:
hero.util.HeroException

setNodeTraditional

public void setNodeTraditional(java.lang.String name)
                        throws hero.util.HeroException
Set the node in traditional mode. When a node is traditional the anticipable attribute is false. This method must be used if you want to execute this activity in a traditional model.

Parameters:
name - name of the node
Throws:
hero.util.HeroException

setNodeAnticipable

public void setNodeAnticipable(java.lang.String name)
                        throws hero.util.HeroException
Set the node in anticipable mode.

Parameters:
name - the name of the node
Throws:
hero.util.HeroException

setNodeAutomatic

public void setNodeAutomatic(java.lang.String name)
                      throws hero.util.HeroException
Set the node in automatic mode. The responsible of the activity execution is now the engine.

Parameters:
name - the name of the node
Throws:
hero.util.HeroException

setNodeExecutor

public void setNodeExecutor(java.lang.String name)
                     throws hero.util.HeroException
Set the name of the node executor. Set the name of the user which is executing the activity.

Parameters:
name - the name of the node
Throws:
hero.util.HeroException

setNodeType

public void setNodeType(java.lang.String name,
                        int type)
                 throws hero.util.HeroException
Set the node type. Change the current type of the node (if node is not executing).

Possibles node types are:
hero.interfaces.Constants.Nd.AND_JOIN_NODE
hero.interfaces.Constants.Nd.OR_JOIN_NODE
hero.interfaces.Constants.Nd.AND_JOIN_AUTOMATIC_NODE
hero.interfaces.Constants.Nd.OR_JOIN_AUTOMATIC_NODE

Parameters:
name - the name of the node
Throws:
hero.util.HeroException

setNodeProperty

public void setNodeProperty(java.lang.String nodeName,
                            java.lang.String key,
                            java.lang.String value,
                            boolean propagate)
                     throws hero.util.HeroException
Set a property of a node. A property is a pair key/value representing workflow relevant data. By using propagate argument we can specify if we want to propagate this property.

Parameters:
nodeName - the name of the node
key - the key of the property
value - the name of the property
propagate - if it is a propagation property
Throws:
hero.util.HeroException

setNodeProperty

public void setNodeProperty(java.lang.String nodeName,
                            java.lang.String key,
                            java.lang.String value)
                     throws hero.util.HeroException
Set a property of a node. A property is a pair key/value representing workflow relevant data. With this method the property is propagated within others nodes.

Parameters:
nodeName - the name of the node
key - the key of the property
value - the name of the property
Throws:
hero.util.HeroException

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
                 throws hero.util.HeroException
Set a property of the project. A property is a pair key/value representing workflow relevant data. This methods creates a new property that can be accessed from all activites of the project.

Parameters:
key - the key of the property
value - the name of the property
Throws:
hero.util.HeroException

hookEvent

public void hookEvent(java.lang.String nodeName,
                      java.lang.String event)
               throws hero.util.HeroException
Execute a node hook.

Parameters:
nodeName - the name of the node
event - the event
Throws:
hero.util.HeroException

getNodeDescription

public java.lang.String getNodeDescription(java.lang.String name)
                                    throws hero.util.HeroException
Get the node description. Node description represents, explicity, execution related information of this task.

Parameters:
name - of the node
Returns:
String - description of the node
Throws:
hero.util.HeroException

getNodeInterHookValue

public java.lang.String getNodeInterHookValue(java.lang.String node,
                                              java.lang.String hook)
                                       throws hero.util.HeroException
Get the node hook value. This method returns the hook script associated to this node

Parameters:
hook - hookName of the node
Returns:
String - script associated to this hook
Throws:
hero.util.HeroException

getInterHookValue

public java.lang.String getInterHookValue(java.lang.String hook)
                                   throws hero.util.HeroException
Get the inter hook value script. This method returns the hook script associated to all project nodes.

Parameters:
hook - hook name
Returns:
String - script associated to this hook
Throws:
hero.util.HeroException

getDetails

public BnProjectValue getDetails()
                          throws hero.util.HeroException
Get the ProjectValue (historique). Returns project information: project attributes, nodes, edges, hooks, properties...

Returns:
BnProjectValue object - project data
Throws:
hero.util.HeroException

getName

public java.lang.String getName()
                         throws hero.util.HeroException
Get ProjectName

Returns:
String - project name
Throws:
hero.util.HeroException

getCreator

public java.lang.String getCreator()
                            throws hero.util.HeroException
Get creator of the project. The user that created the project

Returns:
String - project creator
Throws:
hero.util.HeroException

getRoles

public java.util.Collection getRoles()
                              throws hero.util.HeroException
Get all roles of the project

Returns:
Collection of BnRoleLocal objects - roles of the project
Throws:
hero.util.HeroException

getRolesNames

public java.util.Collection getRolesNames()
                                   throws hero.util.HeroException
Get all roles names of the project

Returns:
String Collection - roles names of this projects
Throws:
hero.util.HeroException

getUserRoles

public java.util.Collection getUserRoles(java.lang.String userName)
                                  throws hero.util.HeroException
Get all user roles. This method returns all the roles for this user in differents projects.

Parameters:
userName - The name of the user
Returns:
Collection of BnRoleLOcal objects - roles of the user in differents projects
Throws:
hero.util.HeroException

getUserRolesInProject

public java.util.Collection getUserRolesInProject(java.lang.String userName)
                                           throws hero.util.HeroException
Get user roles in project. Returns the roles of this user in the current project.

Parameters:
userName - The name of the user
Returns:
Collection of BnRoleValue objects - roles of the user in this project
Throws:
hero.util.HeroException

getUserRolesInProjectNames

public java.util.Collection getUserRolesInProjectNames(java.lang.String userName)
                                                throws hero.util.HeroException
Get user roles in project names. Returns the role names of the user in the current project

Parameters:
userName - The name of the user
Returns:
String Collection - role names of this user in the current project
Throws:
hero.util.HeroException

getNodeRole

public BnRoleLocal getNodeRole(java.lang.String nodeName)
                        throws hero.util.HeroException
Get node role. Returns the role information.

Parameters:
nodeName - The name of the node
Returns:
BnRoleLocal object - the role data
Throws:
hero.util.HeroException

getEdgeCondition

public java.lang.String getEdgeCondition(java.lang.String edge)
                                  throws hero.util.HeroException
Get the edge Condition. This condition is evaluated at run-time in order to perform activity transition. This condition follows the beanshell syntax (Lightweight Scripting for Java).

Parameters:
edge - the edge/transition name
Returns:
String - edge condition
Throws:
hero.util.HeroException

getNodeAnticipable

public boolean getNodeAnticipable(java.lang.String name)
                           throws hero.util.HeroException
Returns if the node is set to be executed in anticipated mode.

Parameters:
name - name of the node
Returns:
boolean - if anticipable node is set to this node.
Throws:
hero.util.HeroException

getNodeRoleName

public java.lang.String getNodeRoleName(java.lang.String nodeName)
                                 throws hero.util.HeroException
Get node role name. Obtains the role name of this node.

Parameters:
nodeName - The name of the node
Returns:
String - the role name of this node
Throws:
hero.util.HeroException

getNodeDeadline

public java.lang.String getNodeDeadline(java.lang.String nodeName)
                                 throws hero.util.HeroException
Get node deadline. Activity deadline is the lastest date in which the activity must be finished.

Parameters:
nodeName - The name of the node
Returns:
String - deadline of this node
Throws:
hero.util.HeroException

getNodeValue

public BnNodeValue getNodeValue(java.lang.String name)
                         throws hero.util.HeroException
Get the node Value. Returns node information.

Parameters:
name - the name of the Node
Returns:
BnNodeValue object - node data.
Throws:
hero.util.HeroException

getAgentValue

public BnAgentValue getAgentValue(java.lang.String name)
                           throws hero.util.HeroException
Get the Agent Value.

Parameters:
name - the name of the Agent
Returns:
BnAgentValue object - agent data.
Throws:
hero.util.HeroException

getAgentEdgeValue

public BnAgentEdgeValue getAgentEdgeValue(java.lang.String name)
                                   throws hero.util.HeroException
Get the AgentEdge Value

Parameters:
name - the name of the BnAgentEdge
Returns:
BnAgentEdgeValue object - agentEdge data.
Throws:
hero.util.HeroException

getNodeLightValue

public BnNodeLightValue getNodeLightValue(java.lang.String name)
                                   throws hero.util.HeroException
Get the node Light Value. Returns node basic information.

Parameters:
name - the name of the Node
Returns:
BnNodeLightValue object - agentEdge data.
Throws:
hero.util.HeroException

getEdgeValue

public BnEdgeValue getEdgeValue(java.lang.String name)
                         throws hero.util.HeroException
Get the edge value.

Parameters:
name - the name of the edge
Returns:
BnEdgeValue object - edge data.
Throws:
hero.util.HeroException

getNodeExecutor

public java.lang.String getNodeExecutor(java.lang.String name)
                                 throws hero.util.HeroException
Get the node executor. Get the name of the user which is executing the activity.

Parameters:
name - the name of the node
Returns:
String - the user executor of this node
Throws:
hero.util.HeroException

getNodeState

public int getNodeState(java.lang.String name)
                 throws hero.util.HeroException
Get the state of the node. The possible states for a node are:

hero.interfaces.Constants.Nd.INITIAL
hero.interfaces.Constants.Nd.READY
hero.interfaces.Constants.Nd.DEAD
hero.interfaces.Constants.Nd.ANTICIPABLE
hero.interfaces.Constants.Nd.ANTICIPATING
hero.interfaces.Constants.Nd.EXECUTING
hero.interfaces.Constants.Nd.TERMINATED

Parameters:
name - of the node
Returns:
int - The state of the node
Throws:
hero.util.HeroException

getNodeType

public int getNodeType(java.lang.String name)
                throws hero.util.HeroException
Get the type of the node. Possibles node types are:

hero.interfaces.Constants.Nd.AND_JOIN_NODE
hero.interfaces.Constants.Nd.OR_JOIN_NODE
hero.interfaces.Constants.Nd.AND_JOIN_AUTOMATIC_NODE
hero.interfaces.Constants.Nd.OR_JOIN_AUTOMATIC_NODE

Parameters:
name - of the node
Returns:
int - The type of the node
Throws:
hero.util.HeroException

getUsers

public java.util.Collection getUsers()
                              throws hero.util.HeroException
Get all users of the project. Obtains the user names of the project

Returns:
String Collection - user names in project
Throws:
hero.util.HeroException

getAllUsers

public java.util.Collection getAllUsers()
                                 throws hero.util.HeroException
Return all registered users. Get user names of Bonita System

Returns:
String Collection - all user names
Throws:
hero.util.HeroException

getNodesNames

public java.util.Collection getNodesNames()
                                   throws hero.util.HeroException
Get all node names of the project

Returns:
String Collection - all node names
Throws:
hero.util.HeroException

getEdgesNames

public java.util.Collection getEdgesNames()
                                   throws hero.util.HeroException
Get all edges names of the project

Returns:
String Collection - all edges names of the project
Throws:
hero.util.HeroException

getEdgeInNode

public java.lang.String getEdgeInNode(java.lang.String edgeName)
                               throws hero.util.HeroException
Get edge in node. Returns the name of in node

Parameters:
edgeName - the name ot the edge
Returns:
String - the name of in node
Throws:
hero.util.HeroException

getEdgeOutNode

public java.lang.String getEdgeOutNode(java.lang.String edgeName)
                                throws hero.util.HeroException
Get edge out node. Returns the name of out node

Parameters:
edgeName - the name ot the edge
Returns:
String - the name of out node
Throws:
hero.util.HeroException

getNodeInEdges

public java.util.Collection getNodeInEdges(java.lang.String name)
                                    throws hero.util.HeroException
Get all in edges of the node

Parameters:
name - the name ot the node
Returns:
String Collection - get in edges of the node
Throws:
hero.util.HeroException

getNodeOutEdges

public java.util.Collection getNodeOutEdges(java.lang.String name)
                                     throws hero.util.HeroException
Get all out edges of the node

Parameters:
name - the name ot the node
Returns:
String Collection - get out edges of the node
Throws:
hero.util.HeroException

getNodeProperties

public java.util.Collection getNodeProperties(java.lang.String nodeName)
                                       throws hero.util.HeroException
Get Node properties. Get a list of pair key/value properties associated to the node.

Parameters:
nodeName - the name of the node
Returns:
Collection of BnNodePropertyValue objects - all node properties
Throws:
hero.util.HeroException

getNodeProperty

public BnNodePropertyValue getNodeProperty(java.lang.String nodeName,
                                           java.lang.String key)
                                    throws hero.util.HeroException
Get Node property value. Get a pair key/value properties associated to the node.

Parameters:
nodeName - the name of the node
key - Property key
Returns:
BnNodePropertyValue object - node property data
Throws:
hero.util.HeroException

getProperty

public BnProjectPropertyValue getProperty(java.lang.String key)
                                   throws hero.util.HeroException
Get property value of the project. Get a pair key/value properties associated to this project.

Parameters:
key - Property key
Returns:
BnProjectPropertyValue object - property data
Throws:
hero.util.HeroException

getNodeHooks

public java.util.Collection getNodeHooks(java.lang.String nodeName)
                                  throws hero.util.HeroException
Get Node hooks of the project. Get hooks of the node. Method to get the list of Java or TCL hooks of the node.

Parameters:
nodeName - the name of the node
Returns:
Collection of BnNodeHookValue - all node hooks
Throws:
hero.util.HeroException

getNodeInterHooks

public java.util.Collection getNodeInterHooks(java.lang.String nodeName)
                                       throws hero.util.HeroException
Get Interactive Node hooks of the project

Parameters:
nodeName - the name of the node
Returns:
Collection of BnNodeInterHookValue objects - all node hooks
Throws:
hero.util.HeroException

getRoleMappers

public java.util.Collection getRoleMappers()
                                    throws hero.util.HeroException
Get role mappers of the project.

Returns:
Collection of BnRoleMapperValue - all role mappers
Throws:
hero.util.HeroException

getInterHooks

public java.util.Collection getInterHooks()
                                   throws hero.util.HeroException
Get Interactive hooks of the project. Returns hooks assigned to project nodes.

Returns:
Collection of ProjectInterHookValue - project inter hooks
Throws:
hero.util.HeroException

getNodeInterHook

public BnNodeInterHookValue getNodeInterHook(java.lang.String nodeName,
                                             java.lang.String interHook)
                                      throws hero.util.HeroException
Get Node inter hook of the project

Parameters:
nodeName - the name of the node
interHook - name of the hooks
Returns:
BnNodeInterHookValue object - node hook data
Throws:
hero.util.HeroException

getPropertiesKey

public java.util.Collection getPropertiesKey()
                                      throws hero.util.HeroException
Get properties key of the project. A property is a pair key/value representing workflow relevant data. This methods obtains properties key of the project.

Returns:
Collection of ProjectPropertyValue - all project properties
Throws:
hero.util.HeroException

getIterations

public java.util.Collection getIterations()
                                   throws hero.util.HeroException
Get Iterations of the project. An Iteration is composed by a condition and two nodes: from and to.

Returns:
Collection of BnIterationLightValue - all project iterations
Throws:
hero.util.HeroException

getToIteration

public java.lang.String getToIteration(java.lang.String from)
                                throws hero.util.HeroException
Get node destination of this iteration. An Iteration is composed by a condition and two nodes: from and to.

Returns:
String - To node
Throws:
hero.util.HeroException

getIterationExist

public boolean getIterationExist(java.lang.String from)
                          throws hero.util.HeroException
Verifies if this node starts an iteration

Returns:
String - from node
Throws:
hero.util.HeroException

getIterationCondition

public java.lang.String getIterationCondition(java.lang.String from)
                                       throws hero.util.HeroException
Get iteration condition

Returns:
String - from node
Throws:
hero.util.HeroException

getProperties

public java.util.Collection getProperties()
                                   throws hero.util.HeroException
Get properties of the project. A property is a pair key/value representing workflow relevant data. This method obtains properties of the project.

Returns:
Collection of ProjectPropertyValue - all project properties
Throws:
hero.util.HeroException

getHooks

public java.util.Collection getHooks()
                              throws hero.util.HeroException
Get hooks of the project. Method to get the list of Java or TCL hooks of the project

Returns:
Collection of BnProjectHooksValue - all project hook
Throws:
hero.util.HeroException

getProjectNameOfInstance

public java.lang.String getProjectNameOfInstance(java.lang.String instanceName)
                                          throws hero.util.HeroException
Get the project name of this instance

Parameters:
instanceName - the name of the instance
Returns:
String - the project name
Throws:
hero.util.HeroException

getParent

public java.lang.String getParent()
                           throws hero.util.HeroException
Get the parent project of this project

Returns:
String - the parent project of this project
Throws:
hero.util.HeroException

getStrutsNode

public hero.util.StrutsNodeValue getStrutsNode(java.lang.String nodeName)
                                        throws hero.util.HeroException
Get the StrutsNode. Returns node information with a specific java bean structure (useful in struts web applications).

Parameters:
nodeName - the name of the Node
Returns:
BnStrutsNodeValue object - node data.
Throws:
hero.util.HeroException

getNodes

public java.lang.Object[] getNodes()
                            throws hero.util.HeroException
Get the project nodes. Returns project nodes data.

Returns:
Array of StrutsNodeValue - all project nodes
Throws:
hero.util.HeroException

getStrutsNodes

public java.util.Collection getStrutsNodes()
                                    throws hero.util.HeroException
Get the StrutsNodes. Returns nodes information with a specific java bean structure (useful in struts web applications).

Returns:
Collection of StrutsNodeValue - all project nodes
Throws:
hero.util.HeroException

getStrutsNodeEdges

public java.util.Collection getStrutsNodeEdges(java.lang.String nodeName)
                                        throws hero.util.HeroException
Get the Edges of the Node. Returns node edges information with a specific java bean structure (useful in struts web applications).

Parameters:
nodeName - the name of the Node
Returns:
Collection of StrutsEdgeValue - all node edges
Throws:
hero.util.HeroException

getStrutsEdges

public java.util.Collection getStrutsEdges()
                                    throws hero.util.HeroException
Get the StrutsEdges. Returns project edges information with a specific java bean structure (useful in struts web applications).

Returns:
Collection of StrutsEdgeValue - all project edges
Throws:
hero.util.HeroException

importProject

public void importProject(java.lang.String projectName)
                   throws hero.util.HeroException
Import all the nodes, hooks and edges of a project to the current project

Throws:
hero.util.HeroException

importProject

public void importProject(java.lang.String projectName,
                          java.lang.String prefix)
                   throws hero.util.HeroException
Import all the nodes, hooks, properties and edges of a project to the current project

Parameters:
prefix - the prefix of names for the project
Throws:
hero.util.HeroException

importInstance

public void importInstance(java.lang.String projectName,
                           java.lang.String instance)
                    throws hero.util.HeroException
Import Project instance. Import all the nodes, hooks, properties,edges and users of a project instant to the current project

Parameters:
instance - the instance name of the project
Throws:
hero.util.HeroException

initProject

public void initProject(java.lang.String projectName)
                 throws hero.util.HeroException
Init the Project Session Bean. You have to call this method after "create" call. After that all methods of ProjectSession API are available.

Parameters:
projectName - project name
Throws:
hero.util.HeroException

initProject

public void initProject(java.lang.String oldProject,
                        java.lang.String newProject)
                 throws javax.ejb.CreateException
init the Project Session Bean (clone project).You have to call this method after "create" call. After that the project is cloned and all methods of ProjectSession API are available.

Parameters:
oldProject - the name of the project to clone
newProject - the name of the project clone.
Throws:
hero.util.HeroException
javax.ejb.CreateException

instantiateProject

public java.lang.String instantiateProject(java.lang.String project)
                                    throws javax.ejb.CreateException
Project instance. You have to call this method after "create" call. After that you have an instance of the project and all methods of ProjectSession API are available.

Parameters:
project - the name of the project to instance
Returns:
String - the name of the project instance
Throws:
javax.ejb.CreateException

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
Creates the Project Session Bean. This method is the first one to invoke in order to use ProjectSession API. If the user is not authorized this method throws an exception.

Throws:
javax.ejb.CreateException

ejbPostCreate

public void ejbPostCreate(java.lang.String oldProject,
                          java.lang.String newProject)
                   throws javax.ejb.CreateException,
                          java.rmi.RemoteException
Internal Enterprise Java Beans method.

Throws:
javax.ejb.CreateException
java.rmi.RemoteException

setSessionContext

public void setSessionContext(javax.ejb.SessionContext context)
Internal Enterprise Java Beans method.

Specified by:
setSessionContext in interface javax.ejb.SessionBean

ejbRemove

public void ejbRemove()
Internal Enterprise Java Beans method.

Specified by:
ejbRemove in interface javax.ejb.SessionBean

ejbActivate

public void ejbActivate()
Internal Enterprise Java Beans method.

Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbPassivate

public void ejbPassivate()
Internal Enterprise Java Beans method.

Specified by:
ejbPassivate in interface javax.ejb.SessionBean

containsUser

public boolean containsUser(java.lang.String userName)
                     throws hero.util.HeroException
Test if the project contains this user

Parameters:
userName - The name of the user to associate to the project
Returns:
boolean - true is the user belongs to the project
Throws:
hero.util.HeroException