Package org.joedayz.corespringtest.model

Examples of org.joedayz.corespringtest.model.Product


  @RequestMapping(value = "/productView.htm", method = RequestMethod.GET)
  public @ModelAttribute("product")Product productView
      (@RequestParam(value = "idProduct", required = false) Integer idProduct) {

    if (idProduct != null) {
      Product product = productManager.getProductById(idProduct);
      return product;
    }
    return new Product();
  }
View Full Code Here


    this.hibernateTemplate = new HibernateTemplate(sessionFactory);
    this.jdbcTemplate = new JdbcTemplate(SessionFactoryUtils.getDataSource(sessionFactory));
  }

  public void deleteProduct(Integer idProduct) {
    Product product = getProductById(idProduct);
    hibernateTemplate.delete(product);
  }
View Full Code Here

    Product product = getProductById(idProduct);
    hibernateTemplate.delete(product);
  }

  public Product getProductById(Integer idProduct) {
    Product product = (Product) hibernateTemplate.get(Product.class, idProduct);
    return product;
  }
View Full Code Here

    return Product.class.isAssignableFrom(clazz);
  }

  public void validate(Object object, Errors errors) {
   
    Product product = (Product)object;
    if (StringUtils.isEmpty(product.getName()))
    {
      errors.rejectValue("name", "product.name.required");
    }
   
    if(product.getPrice() == null
        || StringUtils.isEmpty(product.getPrice().toString()))
    {
      errors.rejectValue("price", "product.price.required");   
    }
   
    if (StringUtils.isEmpty(product.getCode()))
    {
      errors.rejectValue("code", "product.code.required");
    }
   
    boolean isRepeatName = productManager.isRepeatDescription(product.getName(), product.getIdProduct());
    if(isRepeatName){
      errors.rejectValue("name", "product.name.isRepeat");   
    }
  }
View Full Code Here

TOP

Related Classes of org.joedayz.corespringtest.model.Product

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.