示例#1
0
  /** Inits the products. */
  public void initProducts() {
    Product product = null;

    // Samsung Galaxy Tab
    product = new Product();
    product.setName(Products.SAMSUNG_GALAXY_TAB);
    product.setDescription("10.1-Inch, 16GB, Wi-Fi");
    productService.createProduct(product);

    // Amazon Kindle Fire
    product = new Product();
    product.setName(Products.KINDLE_FIRE);
    product.setDescription("Wi-Fi, Full Color 7, Multi-Touch Display");
    productService.createProduct(product);

    // Amazon Kindle Touch
    product = new Product();
    product.setName(Products.KINDLE_TOUCH);
    product.setDescription("Wi-Fi, 6 E Ink Display");
    productService.createProduct(product);

    // Samsung Galaxy Ace
    product = new Product();
    product.setName(Products.SAMSUNG_GALAXY_ACE);
    product.setDescription("Samsung S5830L Galaxy Ace");
    productService.createProduct(product);
  }
  /* (non-Javadoc)
   * @see org.shop.api.ProposalService#createProposal(java.lang.Long, java.lang.Long, java.lang.Double)
   */
  @Override
  public Long createProposal(Long sellerId, Long productId, Double price) {
    Proposal proposal = new Proposal();
    proposal.setPrice(price);
    proposal.setProduct(productService.getProductById(productId));
    proposal.setSeller(sellerService.getSellerById(sellerId));
    proposal.setState(State.NOT_ACTIVE_PROPOSAL);

    return repository.createProposal(proposal);
  }