Package org.xulfaces.rubis.model

Examples of org.xulfaces.rubis.model.Item


    ResultSet resultSet = null;
       
    try {     
      resultSet = excecuteScrollableQuery(sqlBuffer.toString());     
      while (resultSet.next()) {
        Item item = new Item();
        item.setId(new Integer(resultSet.getInt("ID")));
        item.setName(resultSet.getString("NAME"));       
        item.setBuyNow(resultSet.getFloat("BUY_NOW"));
        item.setDescription(resultSet.getString("DESCRIPTION"));
        item.setEndDate(resultSet.getDate("END_DATE"));       
        item.setStartDate(resultSet.getDate("START_DATE"));       
        User seller = new User();
        seller.setId(new Integer(resultSet.getInt("SELLER")));
        seller.setFirstname(resultSet.getString("FIRSTNAME"));
        seller.setLastname(resultSet.getString("LASTNAME"));
        item.setSeller(seller);       
        items.add(item);               
      }
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }   
View Full Code Here


    sqlBuffer.append(user.getId());
    ResultSet resultSet = null
    try {
      resultSet = excecuteScrollableQuery(sqlBuffer.toString());
      while(resultSet.next()){
        Item item = new Item();
        item.setSeller(user);
        items.add(item);
      }
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
View Full Code Here

    sqlBuffer.append(category.getId());
    ResultSet resultSet = null;
    try {
      resultSet = excecuteScrollableQuery(sqlBuffer.toString());
      while (resultSet.next()) {
        Item item = new Item();
        item.setId(new Integer(resultSet.getInt("ID")));
        item.setName(resultSet.getString("NAME"));     
        try {
          item.setSeller(userDAO.loadUser(new Integer(resultSet.getInt("SELLER"))));
        } catch (UserNotFoundException e) {         
          e.printStackTrace();
        }
        item.setCategory(category);
        item.setBuyNow(resultSet.getFloat("BUY_NOW"));
        item.setDescription(resultSet.getString("DESCRIPTION"));
        item.setEndDate(resultSet.getDate("END_DATE"));       
        item.setStartDate(resultSet.getDate("START_DATE"));
        items.add(item);               
      }
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
View Full Code Here

      sqlBuffer.append(bidId);
      sqlBuffer.append(",");
      sqlBuffer.append(generateUserId());     
      sqlBuffer.append(",");
      int itemId = generateItemId();
      Item item = this.items.get(new Integer(itemId));
      sqlBuffer.append(itemId);
      sqlBuffer.append(",");
      sqlBuffer.append(1);
      sqlBuffer.append(",");
      sqlBuffer.append((int)item.getInitialPrice());
      sqlBuffer.append(",0,'2006-04-01 13:00:00')\n");
      fileWriter.append(sqlBuffer);
      fileWriter.flush();
    }
    fileWriter.close();
View Full Code Here

  class NameComparator implements Comparator {

    public int compare(Object o1, Object o2) {
      DefaultMutableTreeNode n1 = (DefaultMutableTreeNode) o1;
      DefaultMutableTreeNode n2 = (DefaultMutableTreeNode) o2;
      Item i1 = (Item) n1.getUserObject();
      Item i2 = (Item ) n2.getUserObject();
     
      if(ascendingOrderForName){
        return i1.getName().compareTo(i2.getName())
      }
      else {
        return i2.getName().compareTo(i1.getName());
      }
     
    }     
View Full Code Here

      label.append(" (");
      label.append(category.getNbItems());
      label.append(")")
    }
    else if(arg0 instanceof Item){
      Item item = (Item) arg0;
      label.append(item.getName());
    }
    return label.toString();
  }
View Full Code Here

    FileWriter fileWriter = new FileWriter("items.sql");
    fileWriter.append("DELETE FROM ITEMS\n");
    fileWriter.flush();
    for(int i=0; i < 5000; i++,itemId++){
      StringBuffer sqlBuffer = new StringBuffer("INSERT INTO ITEMS (ID,NAME,DESCRIPTION,INITIAL_PRICE,QUANTITY,RESERVE_PRICE,BUY_NOW,NB_OF_BIDS,MAX_BID,START_DATE,END_DATE,SELLER,CATEGORY) VALUES (");     
      Item item = new Item();
      int categoryId = generateCategoryId();
      item.setId(new Integer(itemId));
      this.items.put(item.getId(),item);
      sqlBuffer.append(itemId);
      sqlBuffer.append(",");
      Category category = this.categories[categoryId-1];
      sqlBuffer.append("'" + category.getName() + " #");
      sqlBuffer.append(itemId);
      sqlBuffer.append("','This incredible item is exactly what you need !',");

      // Initial price
      item.setInitialPrice((float) (Math.random()*15000));
      sqlBuffer.append((int)item.getInitialPrice());
     
      sqlBuffer.append(",");
      // Qty
      item.setQuantity((int)(Math.random()*10));
      sqlBuffer.append(item.getQuantity());
      sqlBuffer.append(",");
      // Reserved price
      item.setReservedPrice((float) (Math.random()*item.getInitialPrice()));
      sqlBuffer.append((int)item.getReservedPrice());
      sqlBuffer.append(",");
      sqlBuffer.append("0,0,0,'2006-04-01 18:23:55','2060-01-01 18:23:55',");       
      sqlBuffer.append(generateUserId());
      sqlBuffer.append(",");
      sqlBuffer.append(categoryId);
View Full Code Here

TOP

Related Classes of org.xulfaces.rubis.model.Item

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.