cat.debug(">doit:");  IUserAdminSession admin = adminhome.create();  Collection result = admin.findAllUsersByStatus(UserData.STATUS_NEW); Iterator it = result.iterator(); String failedusers = ""; int failcount = 0; String successusers = ""; int successcount = 0; while( it.hasNext() ) { UserAdminData data = (UserAdminData) it.next();  try { cat.debug("Generating keys for " + data.getUsername());  admin.setUserStatus(data.getUsername(), UserData.STATUS_INPROCESS); processUser(data);  admin.setUserStatus(data.getUsername(), UserData.STATUS_GENERATED); successusers += ":" + data.getUsername(); successcount++; } catch (Exception e) {  cat.error("An error happened, setting status to FAILED."); cat.error(e); failedusers += ":" + data.getUsername(); failcount++; admin.setUserStatus(data.getUsername(), UserData.STATUS_FAILED); } } if (failedusers != "") throw new Exception("BatchMakeP12 failed for " + failcount + " users (" + successcount + " succeeded) - " + failedusers); cat.debug(successcount + " new users generated successfully - " + successusers); cat.debug("<doit:");  }
cat.debug(">createAllNew:"); createAllWithStatus(UserData.STATUS_NEW); cat.debug("<createAllNew:"); }
    public void createAllNew() throws Exception {        cat.debug(">doit:");        IUserAdminSession admin = adminhome.create();        Collection result = admin.findAllUsersByStatus(UserData.STATUS_NEW);        Iterator it = result.iterator();        String failedusers = "";        int failcount = 0;        String successusers = "";        int successcount = 0;        while( it.hasNext() ) {            UserAdminData data = (UserAdminData) it.next();            try {                cat.debug("Generating keys for " + data.getUsername());                // Grab new user, set status to INPROCESS                admin.setUserStatus(data.getUsername(), UserData.STATUS_INPROCESS);                processUser(data);                // If all was OK , set status to GENERATED                admin.setUserStatus(data.getUsername(), UserData.STATUS_GENERATED);                successusers += ":" + data.getUsername();                successcount++;            } catch (Exception e) {                // If things went wrong set status to FAILED                cat.error("An error happened, setting status to FAILED.");                cat.error(e);                failedusers += ":" + data.getUsername();                failcount++;                admin.setUserStatus(data.getUsername(), UserData.STATUS_FAILED);            }        }        if (failedusers != "")            throw new Exception("BatchMakeP12 failed for " + failcount + " users (" + successcount + " succeeded) - " + failedusers);        cat.debug(successcount + " new users generated successfully - " + successusers);        cat.debug("<doit:");    } // doit