WorkflowStore store = getPersistence(); WorkflowEntry entry = store.findEntry(id);  if (entry == null) { throw new IllegalArgumentException("No such workflow id " + id); }  if (entry.getState() != WorkflowEntry.ACTIVATED) { log.debug("--> state is " + entry.getState());  return new int[0]; }  WorkflowDescriptor wf = getWorkflow(entry.getWorkflowName());  if (wf == null) { throw new IllegalArgumentException("No such workflow " + entry.getWorkflowName()); }  List l = new ArrayList(); PropertySet ps = store.getPropertySet(id); Map transientVars = new HashMap(); populateTransientMap(entry, transientVars, wf.getRegisters());   List globalActions = wf.getGlobalActions();  for (Iterator iterator = globalActions.iterator(); iterator.hasNext();) { ActionDescriptor action = (ActionDescriptor) iterator.next(); RestrictionDescriptor restriction = action.getRestriction(); String conditionType = null; List conditions = null;  if (restriction != null) { conditionType = restriction.getConditionType(); conditions = restriction.getConditions(); }  if (passesConditions(conditionType, conditions, transientVars, ps)) { l.add(new Integer(action.getId())); } }   Collection currentSteps = store.findCurrentSteps(id);  for (Iterator iterator = currentSteps.iterator(); iterator.hasNext();) { Step step = (Step) iterator.next(); l.addAll(getAvailableActionsForStep(wf, step, transientVars, ps)); }  int[] actions = new int[l.size()];  for (int i = 0; i < actions.length; i++) { actions[i] = ((Integer) l.get(i)).intValue(); }  return actions;
return getAvailableActions(id, new HashMap());
    public int[] getAvailableActions(long id) throws WorkflowException {        WorkflowStore store = getPersistence();        WorkflowEntry entry = store.findEntry(id);        if (entry == null) {            throw new IllegalArgumentException("No such workflow id " + id);        }        if (entry.getState() != WorkflowEntry.ACTIVATED) {            log.debug("--> state is " + entry.getState());            return new int[0];        }        WorkflowDescriptor wf = getWorkflow(entry.getWorkflowName());        if (wf == null) {            throw new IllegalArgumentException("No such workflow " + entry.getWorkflowName());        }        List l = new ArrayList();        PropertySet ps = store.getPropertySet(id);        Map transientVars = new HashMap();        populateTransientMap(entry, transientVars, wf.getRegisters());        // get global actions        List globalActions = wf.getGlobalActions();        for (Iterator iterator = globalActions.iterator(); iterator.hasNext();) {            ActionDescriptor action = (ActionDescriptor) iterator.next();            RestrictionDescriptor restriction = action.getRestriction();            String conditionType = null;            List conditions = null;            if (restriction != null) {                conditionType = restriction.getConditionType();                conditions = restriction.getConditions();            }            if (passesConditions(conditionType, conditions, transientVars, ps)) {                l.add(new Integer(action.getId()));            }        }        // get normal actions        Collection currentSteps = store.findCurrentSteps(id);        for (Iterator iterator = currentSteps.iterator(); iterator.hasNext();) {            Step step = (Step) iterator.next();            l.addAll(getAvailableActionsForStep(wf, step, transientVars, ps));        }        int[] actions = new int[l.size()];        for (int i = 0; i < actions.length; i++) {            actions[i] = ((Integer) l.get(i)).intValue();        }        return actions;    }