class ProjectionController implements Constants {

    @ApiOperation(httpMethod = "POST", value = "Save or Update Projection Details")
    @PostMapping(value = "/v1/updateprojection")
    public ResponseEntity<Object> updateProjectionData(@RequestBody ProjectionRequest projectionRequest)
            throws ServiceException {
        if (Strings.isNullOrEmpty(projectionRequest.getResourceType()) || projectionRequest.getYear() <= 0
                || projectionRequest.getQuarter() <= 0) {
            return ResponseUtils.buildFailureResponse(new ServiceException("targetType/year/quarter is mandatory"));
        }
        if (projectionRequest.getQuarter() > FOUR) {
            return ResponseUtils.buildFailureResponse(new ServiceException("Invalid quarter"));
        }
        boolean isDataupdatedtoDB = false;
        try {
            isDataupdatedtoDB = projectionService.updateProjection(projectionRequest);
        } catch (ServiceException e) {
            LOGGER.error(e.toString());
            return ResponseUtils.buildFailureResponse(e);
        }
        if (isDataupdatedtoDB) {
            return ResponseUtils.buildSucessResponse(HttpStatus.OK);
        } else {
            return ResponseUtils.buildFailureResponse(new ServiceException("Projection Details Saving Failed"));
        }
    }

}