Examples
Listing of all possible transitions with permissions starting from the current action:
//!firstspirit.scripting.BeanshellWrapper
transitions = context.getTransitions();
print("Number of transitions:" + transitions.length);
for (i=0; i<transitions.length; i++) {
print("Transition:" + transitions[i].getTarget());
allowedUsers = transitions[i].getAllowedUsers();
for (j=0; j<allowedUsers.size(); j++) {
print("Allowed User:" + allowedUsers.get(j));
}
}
State management in workflow instances (counter):
//!firstspirit.scripting.BeanshellWrapper
state=context.getSession();
v=state.get("test");
if(v==null) v=0;
state.put("test",++v);
Generates an instance for every available workflow:
//!firstspirit.scripting.BeanshellWrapper
import firstspirit.access.store.templatestore.*;
u=context.getUserService();
ts=u.getTemplateStore();
wfs=ts.getWorkflows().getAllChilds(Workflow.class);
for (i=0; i<wfs.length; i++) {
print("Workflow:" + wfs[i].getName());
try {
u.createTask(null, wfs[i], wfs[i].getName());
} catch (Exception e) { print("Error!");}
}
Other methods can be taken from the FirstSpirit Access API.