stackroute / ibm-wave3-ontrack-hackathon

Other
0 stars 0 forks source link

Exceptions thrown two times in product service impl #66

Open cprakashb opened 5 years ago

cprakashb commented 5 years ago

@Override public Products updateProduct(Products products) throws ProductAlreadyUpdatedException {

   if(productRepository.existsById(products.getProductId())){

       throw new ProductAlreadyUpdatedException("Products doesn't exists.");
   }else

              products.setProductId(products.getProductId());
             products.setProductName(products.getProductName());
               products.setProductType(products.getProductType());
    products.setImageURL(products.getMrp());
    products.setMrp(products.getMrp());
    products.setPrice(products.getPrice());
    products.setDimension(products.getDimension());
    products.setWeight(products.getWeight());
    products.setSize(products.getSize());
    products.setGender(products.getGender());
    products.setDescription(products.getDescription());
    products.setBrand(products.getBrand());
    products.setColour(products.getColour());
    return productRepository.save(products);

}