/** This method will list all the products present in database */
 @RequestMapping(
     value = "/product",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 public @ResponseBody List<ProductDetails> getAllProducts() {
   return productDetailService.getProducts();
 }
 /** This method will view the detailed description of a particular product */
 @RequestMapping(
     value = "/product/{productName}",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 public @ResponseBody ProductDetails viewProductDetails(
     @PathVariable(value = "productName") String productName) {
   return productDetailService.getProductByName(productName);
 }
  /**
   * This method handle REST call from administrator for adding new product
   *
   * @param
   * @return ProductDetails Object given by MongoDB
   */
  @RequestMapping(
      value = "/product",
      consumes = MediaType.APPLICATION_JSON_VALUE,
      produces = MediaType.APPLICATION_JSON_VALUE,
      method = RequestMethod.POST)
  public @ResponseBody ProductDetails addProduct(
      @RequestBody AddProduct product, @RequestHeader(value = "_id") String authenticationId) {

    return productDetailService.insertProduct(product, authenticationId);
  }
 /**
  * This method handles REST call for administrator for checking if policy name exists already or
  * not
  *
  * @param productName
  * @return true of false
  */
 @RequestMapping(value = "/product/check", produces = MediaType.APPLICATION_JSON_VALUE)
 public @ResponseBody boolean checkProductName(
     @RequestParam(name = "productName") String productName) {
   return productDetailService.isProductPresent(productName);
 }