use of password.pwm.svc.report.UserCacheRecord in project pwm by pwm-project.
the class AdminServlet method processReportData.
@ActionHandler(action = "reportData")
public ProcessStatus processReportData(final PwmRequest pwmRequest) throws PwmUnrecoverableException, IOException {
final int maximum = Math.min(pwmRequest.readParameterAsInt("maximum", 1000), 10 * 1000);
final ReportService reportService = pwmRequest.getPwmApplication().getReportService();
final ArrayList<UserCacheRecord> reportData = new ArrayList<>();
ClosableIterator<UserCacheRecord> cacheBeanIterator = null;
try {
cacheBeanIterator = reportService.iterator();
while (cacheBeanIterator.hasNext() && reportData.size() < maximum) {
final UserCacheRecord userCacheRecord = cacheBeanIterator.next();
if (userCacheRecord != null) {
reportData.add(userCacheRecord);
}
}
} finally {
if (cacheBeanIterator != null) {
cacheBeanIterator.close();
}
}
final HashMap<String, Object> returnData = new HashMap<>();
returnData.put("users", reportData);
final RestResultBean restResultBean = RestResultBean.withData(returnData);
pwmRequest.outputJsonResult(restResultBean);
return ProcessStatus.Halt;
}
Aggregations