private static void doState(Context c,WorkflowItem wi, int newstate, EPerson newowner)
private static boolean doState(Context c,WorkflowItem wi, int newstate, EPerson newowner)
    private static void doState(Context c,WorkflowItem wi, int newstate, EPerson newowner)        throws SQLException, IOException, AuthorizeException    {        Collection mycollection = wi.getCollection();        Group mygroup = null;                wi.setState(newstate);        switch (newstate)        {        case WFSTATE_STEP1POOL:            // any reviewers?            // if so, add them to the tasklist            wi.setOwner( null );            //wi.update();            // get reviewers (group 1 )            mygroup = mycollection.getWorkflowGroup( 1 );            if (mygroup != null )            {                // there were reviewers, change the state                //  and add them to the list                createTasks(c, wi, mygroup);                wi.update();                // email notification                notifyGroupOfTask(c, mygroup, wi);            }            else            {                // no reviewers, skip ahead                doState(c, wi, WFSTATE_STEP2POOL, null);            }            break;        case WFSTATE_STEP1:            // remove reviewers from tasklist            // assign owner            deleteTasks(c, wi);            wi.setOwner(newowner);            break;        case WFSTATE_STEP2POOL:            // clear owner            // any approvers?            // if so, add them to tasklist            // if not, skip to next state            wi.setOwner( null );            // get approvers (group 2)            mygroup = mycollection.getWorkflowGroup( 2 );            if( mygroup != null )            {                // there were approvers, change the state                //  timestamp, and add them to the list                createTasks(c, wi, mygroup );                // email notification                notifyGroupOfTask(c, mygroup, wi);            }            else            {                // no reviewers, skip ahead                doState(c, wi, WFSTATE_STEP3POOL, null);            }            break;        case WFSTATE_STEP2:            // remove admins from tasklist            // assign owner            deleteTasks(c, wi);            wi.setOwner(newowner);            break;        case WFSTATE_STEP3POOL:            // any editors?            // if so, add them to tasklist            wi.setOwner( null );            mygroup = mycollection.getWorkflowGroup( 3 );                        if( mygroup != null )            {                // there were editors, change the state                //  timestamp, and add them to the list                createTasks(c, wi, mygroup);                // email notification                notifyGroupOfTask(c, mygroup, wi);            }            else            {                // no editors, skip ahead                doState(c, wi, WFSTATE_ARCHIVE, newowner);            }            break;        case WFSTATE_STEP3:            // remove editors from tasklist            // assign owner            deleteTasks(c, wi);            wi.setOwner(newowner);            break;        case WFSTATE_ARCHIVE:            // put in archive in one transaction            try            {                // remove workflow tasks                deleteTasks(c, wi);                                mycollection = wi.getCollection();                Item myitem = archive(c, wi);                // now email notification                notifyOfArchive(c, myitem, mycollection);            }            catch(IOException e)            {                // indexer causes this                throw e;            }            catch (SQLException e)            {                // problem starting workflow                throw e;            }            break;        }        if (wi != null) wi.update();    }