class ProjectionController implements Constants {

    @RequestMapping(path = "/v1/getprojection", method = RequestMethod.GET)
    public ResponseEntity<Object> getProjectionData(
            @RequestParam(name = "targettype", required = true) String targetType,
            @RequestParam(name = "year", required = true) int year,
            @RequestParam(name = "quarter", required = true) int quarter) {
        if (Strings.isNullOrEmpty(targetType) || year <= 0 || quarter <= 0) {
            return ResponseUtils.buildFailureResponse(new ServiceException("targetType/year/quarter is Mandatory"));
        }
        if (quarter > FOUR) {
            return ResponseUtils.buildFailureResponse(new ServiceException("Invalid quarter"));
        }

        ProjectionResponse response;
        try {
            response = projectionService.getProjection(targetType, year, quarter);
        } catch (ServiceException e) {
            LOGGER.error(e.toString());
            return ResponseUtils.buildFailureResponse(e);
        }
        return ResponseUtils.buildSucessResponse(response);
    }

}