class ApplicationControllerSupport {

    public StatusCategory getCategoryOf(Status status) {
        int codeSeries = status.getCode() - (status.getCode() % 100);
        switch (codeSeries) {
            case ACCEPT_SERIES:
                return StatusCategory.NORMAL;
            case ERROR_SERIES:
            case REJECT_SERIES:
                return StatusCategory.ERROR;
            case SUCCESS_SERIES:
                return status.getCode() == SUCCESS_STATUS ? StatusCategory.NORMAL : StatusCategory.ERROR;
            case PARTIAL_SERIES:
                switch (status.getCode()) {
                    case PARTIAL_SUCCESS_STATUS:
                        return StatusCategory.NORMAL;
                    case PARTIAL_FAILURE_STATUS:
                        return StatusCategory.ERROR;
                    default:
                        return StatusCategory.WARNING;
                }
            default:
                return StatusCategory.WARNING;
        }
    }

}