try { WorkflowStore store = getPersistence(); WorkflowEntry entry = store.findEntry(id); WorkflowDescriptor wf = getConfiguration().getWorkflow(entry.getWorkflowName());  PropertySet ps = store.getPropertySet(id); Map transientVars = new HashMap(); Collection currentSteps = store.findCurrentSteps(id); populateTransientMap(entry, transientVars, wf.getRegisters(), null, currentSteps);  List s = new ArrayList();  for (Iterator interator = currentSteps.iterator(); interator.hasNext();) { Step step = (Step) interator.next();  int stepId = step.getStepId();  StepDescriptor xmlStep = wf.getStep(stepId);  List securities = xmlStep.getPermissions();  for (Iterator iterator2 = securities.iterator(); iterator2.hasNext();) { PermissionDescriptor security = (PermissionDescriptor) iterator2.next();    if (security.getRestriction() != null) { if (passesConditions(security.getRestriction().getConditionsDescriptor(), transientVars, ps, xmlStep.getId())) { s.add(security.getName()); } } } }  return s; } catch (Exception e) { log.error("Error getting security permissions for instance #" + id, e); }  return Collections.EMPTY_LIST;
return getSecurityPermissions(id, null);
    public List getSecurityPermissions(long id) {        try {            WorkflowStore store = getPersistence();            WorkflowEntry entry = store.findEntry(id);            WorkflowDescriptor wf = getConfiguration().getWorkflow(entry.getWorkflowName());            PropertySet ps = store.getPropertySet(id);            Map transientVars = new HashMap();            Collection currentSteps = store.findCurrentSteps(id);            populateTransientMap(entry, transientVars, wf.getRegisters(), null, currentSteps);            List s = new ArrayList();            for (Iterator interator = currentSteps.iterator();                    interator.hasNext();) {                Step step = (Step) interator.next();                int stepId = step.getStepId();                StepDescriptor xmlStep = wf.getStep(stepId);                List securities = xmlStep.getPermissions();                for (Iterator iterator2 = securities.iterator();                        iterator2.hasNext();) {                    PermissionDescriptor security = (PermissionDescriptor) iterator2.next();                    // to have the permission, the condition must be met or not specified                    // securities can't have restrictions based on inputs, so it's null                    if (security.getRestriction() != null) {                        if (passesConditions(security.getRestriction().getConditionsDescriptor(), transientVars, ps, xmlStep.getId())) {                            s.add(security.getName());                        }                    }                }            }            return s;        } catch (Exception e) {            log.error("Error getting security permissions for instance #" + id, e);        }        return Collections.EMPTY_LIST;    }