class PatchingController implements Constants {

    @RequestMapping(path = "/v1/patching/progress", method = RequestMethod.POST)
    public ResponseEntity<Object> getPatchingProgress(@RequestBody(required = true) PatchingRequest request) {

        Map<String, Object> response = new HashMap<>();
        String assetGroup = request.getAg();
        int quarter = request.getQuarter();
        int year = request.getYear();

        if (Strings.isNullOrEmpty(assetGroup)) {
            return ResponseUtils.buildFailureResponse(new ServiceException(ASSET_MANDATORY));
        }

        if (year == 0) {
            year = patchingService.getOngoingYear();
        }
        if (quarter == 0) {
            quarter = patchingService.getOngoingQuarter();
        }

        if (!(quarter >= 1 && quarter <= FOUR)) {
            return ResponseUtils.buildFailureResponse(new ServiceException(
                    "Quarter number should be one out of 1,2,3,4"));
        }

        if (!(year >= START_YEAR && year <= LAST_YEAR)) {
            return ResponseUtils.buildFailureResponse(new ServiceException("Year should be in between 1900 and 2100"));
        }

        try {
            Map<String, Object> patchProgressList = patchingService.getPatchingProgress(assetGroup, year, quarter);
            response.put("response", patchProgressList);
        } catch (ServiceException e) {
            LOGGER.error("ServiceException in getPatchingProgress ",e);
            return complianceService.formatException(e);
        }
        return ResponseUtils.buildSucessResponse(response);
    }

}