admin.setUserStatus(administrator, data.getUsername(), UserDataConstants.STATUS_FAILED);
admin.setUserStatus(administrator, data.getUsername(), UserDataConstants.STATUS_FAILED, false);
    public void createAllWithStatus(int status) throws Exception {        log.debug(">createAllWithStatus: " + status);        Collection result;        IUserAdminSessionRemote admin = adminhome.create();        boolean stopnow = false;        //Collection result = admin.findAllUsersByStatus(administrator, status);        do {            result = admin.findAllUsersByStatusWithLimit(administrator, status, true);            log.info("Batch generating " + result.size() + " users.");            int failcount = 0;            int successcount = 0;            if (result.size() > 0) {                if (result.size() < UserAdminConstants.MAXIMUM_QUERY_ROWCOUNT) {                    stopnow = true;                }                Iterator it = result.iterator();                String failedusers = "";                String successusers = "";                while (it.hasNext()) {                    UserDataVO data = (UserDataVO) it.next();                    if ((data.getPassword() != null) && (data.getPassword().length() > 0)) {                        try {                            if (doCreate(admin, data, status)) {                                successusers += (":" + data.getUsername());                                successcount++;                            }                        } catch (Exception e) {                            // If things went wrong set status to FAILED                            log.error("An error happened, setting status to FAILED.", e);                            failedusers += (":" + data.getUsername());                            failcount++;                            if (status == UserDataConstants.STATUS_KEYRECOVERY) {                                admin.setUserStatus(administrator, data.getUsername(), UserDataConstants.STATUS_KEYRECOVERY);                            } else {                                admin.setUserStatus(administrator, data.getUsername(), UserDataConstants.STATUS_FAILED);                            }                        }                    } else {                        log.debug("User '" + data.getUsername() +                                "' does not have clear text password.");                    }                }                if (failedusers.length() > 0) {                    throw new Exception("BatchMakeP12 failed for " + failcount + " users (" +                            successcount + " succeeded) - " + failedusers);                }                log.info(successcount + " new users generated successfully - " + successusers);            }        } while ((result.size() > 0) && !stopnow);        log.debug("<createAllWithStatus: " + status);    } // createAllWithStatus