Search in sources :

Example 1 with RecordType

use of password.pwm.svc.intruder.RecordType in project pwm by pwm-project.

the class AdminServlet method restIntruderDataHandler.

@ActionHandler(action = "intruderData")
private ProcessStatus restIntruderDataHandler(final PwmRequest pwmRequest) throws ChaiUnavailableException, PwmUnrecoverableException, IOException {
    final int max = readMaxParameter(pwmRequest, 1000, 10 * 1000);
    final TreeMap<String, Object> returnData = new TreeMap<>();
    try {
        for (final RecordType recordType : RecordType.values()) {
            returnData.put(recordType.toString(), pwmRequest.getPwmApplication().getIntruderManager().getRecords(recordType, max));
        }
    } catch (PwmException e) {
        final ErrorInformation errorInfo = new ErrorInformation(PwmError.ERROR_UNKNOWN, e.getMessage());
        LOGGER.debug(pwmRequest, errorInfo);
        pwmRequest.outputJsonResult(RestResultBean.fromError(errorInfo));
    }
    final RestResultBean restResultBean = RestResultBean.withData(returnData);
    pwmRequest.outputJsonResult(restResultBean);
    return ProcessStatus.Halt;
}
Also used : PwmException(password.pwm.error.PwmException) ErrorInformation(password.pwm.error.ErrorInformation) RecordType(password.pwm.svc.intruder.RecordType) TreeMap(java.util.TreeMap) RestResultBean(password.pwm.ws.server.RestResultBean)

Aggregations

TreeMap (java.util.TreeMap)1 ErrorInformation (password.pwm.error.ErrorInformation)1 PwmException (password.pwm.error.PwmException)1 RecordType (password.pwm.svc.intruder.RecordType)1 RestResultBean (password.pwm.ws.server.RestResultBean)1