public static void show(Long id) { System.out.printf("=== id: %d\n", id); List<AuctionItem> items = AuctionItem.findAll(); for (AuctionItem item : items) { System.out.printf("--- id: %d\n", item.id); } AuctionItem item = AuctionItem.findById(id); item.viewCount++; item.save(); render(item); }
public static void newBids(Long id) { // count new bids long newBids = Bid.count( "from AuctionItem a join a.bids as b " + "where a.id = ? AND b.date > ?", id, request.date); // wait if needed if (newBids == 0) { await("1s"); } // return the JSON output of the new bids AuctionItem item = AuctionItem.findById(id); JsonObject json = new JsonObject(); json.addProperty("next", item.getNextBidPrice()); json.addProperty("top", item.getCurrentTopBid()); renderJSON(json.toString()); }
public static void showImage(Long id) { AuctionItem item = AuctionItem.findById(id); response.setContentTypeIfNotSet(item.photo.type()); renderBinary(item.photo.get()); }
public static void showPDF(Long id) { AuctionItem item = AuctionItem.findById(id); item.viewCount++; item.save(); renderPDF(item); }
public static void addBid(Long id, Float amount) { AuctionItem item = AuctionItem.findById(id); item.addBid(amount); item.save(); }