Ejemplo n.º 1
0
  /**
   * Get an item to put in the database
   *
   * @param id for the item
   * @param warehouse for the item
   * @return item
   */
  public Item getItem(int id, Warehouse warehouse) {
    Item item = new Item();

    int itemIndex = randInt(0, inventory.size()); // choose an inventory item from list

    item.setItemID(id);
    item.setWarehouseID(warehouse.getWarehouseID());
    item.setName(inventory.get(itemIndex) + id);
    item.setPrice(new BigDecimal((double) randInt(0, 20) + randDouble()));
    item.setCurrentStock(randInt(50, 150)); // random number of stock listings per item, avg of 100

    return item;
  }