Package $packageName$.domain

Examples of $packageName$.domain.Product


  /* (non-Javadoc)
   * @see org.springframework.validation.Validator#validate(java.lang.Object, org.springframework.validation.Errors)
   */
  public void validate(Object obj, Errors errors) {
    Product product = (Product)obj;
    if (product.getName() == null || product.getName().length() == 0) {
      errors.rejectValue("name", "required", "");
    }
  }
View Full Code Here


  /* (non-Javadoc)
   * @see org.springframework.validation.Validator#validate(java.lang.Object, org.springframework.validation.Errors)
   */
  public void validate(Object obj, Errors errors) {
    Product product = (Product)obj;
    if (product.getName() == null || product.getName().length() == 0) {
      errors.rejectValue("name", "required", "");
    }
  }
View Full Code Here

    Document document = new Document();
    Element rootElement = new Element(root);
    document.setRootElement(rootElement);
   
    for (Iterator i = products.iterator(); i.hasNext();) {
      Product product = (Product)i.next();
      Element pe = new Element("product");
      pe.setAttribute("productId", Integer.toString(product.getProductId()));
      pe.setAttribute("expirationDate", product.getExpirationDate().toString());
      pe.setText(product.getName());
     
      rootElement.addContent(pe);
    }
   
    return new DOMOutputter().output(document);
View Full Code Here

  /* (non-Javadoc)
   * @see org.springframework.web.servlet.view.document.AbstractPdfView#buildPdfDocument(java.util.Map, com.lowagie.text.Document, com.lowagie.text.pdf.PdfWriter, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
   */
  protected void buildPdfDocument(Map model, Document document, PdfWriter writer, HttpServletRequest request, HttpServletResponse response) throws Exception {
    Product product = (Product) model.get("product");
    if (product == null) throw new NullPointerException("Product not present in the model");

    Paragraph header = new Paragraph("Product details");
    header.font().setSize(20);
    document.add(header);
   
    Paragraph content = new Paragraph(product.getName());
    document.add(content);
   
    Paragraph footer = new Paragraph("Pro Spring Chapter 18");
    footer.setAlignment(Paragraph.ALIGN_BOTTOM);
    document.add(footer);
View Full Code Here

   * @param name The name
   * @param expirationDate The expiration Date
   * @return Product object with all properties set
   */
  private Product createProduct(int productId, String name, Date expirationDate) {
    Product product = new Product();
    product.setProductId(productId);
    product.setName(name);
    product.setExpirationDate(expirationDate);
   
    return product;
  }
View Full Code Here

  /**
   * Handles view
   */
  public ModelAndView view(HttpServletRequest request, HttpServletResponse response) throws Exception {

    Product product = createProduct(1, "Pro Spring", new Date());

    return new ModelAndView("product-view", "product", product);
  }
View Full Code Here

   * @param name The name
   * @param description The description
   * @return Product instance
   */
  private Product createProduct(int productId, String name, String description) {
    Product product = new Product();
    product.setProductId(productId);
    product.setName(name);
    product.setDescription(description);
   
    return product;
  }
View Full Code Here

TOP

Related Classes of $packageName$.domain.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.