avatar

955

Fix a few TODO's and some general cleanup.

by mrs, 14 Jun, 2009 09:30 AM
917 955  
252252     if (mLoaded) {
253253       if(mAuction.getServer() != null) setServer((AuctionServerInterface)mAuction.getServer());
254254       setDefaultCurrency(mAuction.getCurBid());
255       checkHighBidder(true);
255       updateHighBid();
256       checkHighBidder();
256257       checkSeller();
257258       checkEnded();
258259     }
------
660661   ///////////////////////////
661662   //  Actual logic functions
662663 
663   //  TODO  -- Check this for the need of a saveDB() occasionally...
664   public void updateHighBid() {
665     int numBidders = getNumBidders();
666 
667     if (numBidders > 0 && isOutbid()) {
668       getServer().updateHighBid(this);
669     }
670   }
671 
664672   /**
665673    * @brief On update, we check if we're the high bidder.
666674    *
667675    * When you change user ID's, you should force a complete update, so
668676    * this is synchronized correctly.
669    *
670    * @param doNetworkCheck - Should we actually check over the network for new bid information, if the user is outbid?
671677    */
672   private void checkHighBidder(boolean doNetworkCheck) {
678   private void checkHighBidder() {
673679     int numBidders = getNumBidders();
674680 
675681     if(numBidders > 0) {
676       //  TODO -- This is silly.  Why should the AuctionEntry know about doing a network check?
677       if(isOutbid() && doNetworkCheck) {
678         getServer().updateHighBid(this);
679       }
680682       if(isBidOn() && isPrivate()) {
681683         Currency curBid = getCurBid();
682684         try {
------
695697           //  eBay knows the 'true' answer, but how to extract it from them...
696698         }
697699       } else {
698         if(!isDutch()) {
699           setWinning(getServer().isCurrentUser(getHighBidder()));
700         }
700         setWinning(getServer().isCurrentUser(getHighBidder()));
701701       }
702702     }
703703   }
------
10371037       if(mEntryEvents == null) {
10381038         getEvents();
10391039       }
1040       checkHighBidder(false);
1040       checkHighBidder();
10411041       checkSeller();
10421042       saveDB();
10431043     }
------
11391139     mLastUpdatedAt = System.currentTimeMillis();
11401140     mAddedRecently = 0;
11411141     try {
1142       checkHighBidder(true);
1142       updateHighBid();
1143       checkHighBidder();
11431144       if(isDutch()) checkDutchHighBidder();
11441145     } catch(Exception e) {
11451146       JConfig.log().handleException("Unexpected exception during high bidder check.", e);
------
12611262     Currency bin = getBuyNow();
12621263     if(bin != null && !bin.isNull()) {
12631264       setBid(getBuyNow());
1264       setBidQuantity(quant);  //  TODO --  Is it possible to Buy more than 1 item?  Yes...how?
1265       setBidQuantity(quant);
12651266       mBidAt = System.currentTimeMillis();
12661267       JConfig.log().logDebug("Buying " + quant + " item[s] of (" + getIdentifier() + ")-" + getTitle());
12671268       rval = getServer().buy(this, quant);
------
15861587       }
15871588     }
15881589 
1589     checkHighBidder(false);
1590     checkHighBidder();
15901591     checkSeller();
15911592     checkEnded();
15921593     saveDB();
917 955  
3232   private static Map<String, String> mKeys;
3333   private String mThumbnailPath;
3434   private Object mServer = null; //  TODO --  This is a hack!
35   //  It's so that the AuctionServer that creates this can record
36   // 'who it is', so the AuctionEntry will pick it up.
3537 
3638   private static void setupKeys() {
3739     mKeys = new HashMap<String, String>();
819 955  
143143     mAuctionEntriesInThisGroup = new LinkedList<Snipeable>();
144144 
145145     for (Snipeable aeFromList : oldEntries) {
146       //  TODO --  Fix this up; this calls back into here, for the remove() function.  This needs to be seperated somehow.
147146       aeFromList.cancelSnipe(false);
148147     }
149148     oldEntries.clear();
949 955  
137137     return sInstance;
138138   }
139139 
140   private void getSQSURL() {
141     StringBuffer sb = http().get(url("my.jbidwatcher.com/services/syncq"));
142     mSyncQueueURL = (sb == null) ? null : sb.toString();
143     sb = http().get(url("my.jbidwatcher.com/services/reportq"));
144     mReportQueueURL = (sb == null) ? null : sb.toString();
145   }
146 
147140   public void postXML(String queue, XMLSerialize ae) {
148141     XMLElement xmlWrapper = new XMLElement("message");
149142     XMLElement user = new XMLElement("user");
816 955  
218218     AuctionServerManager.getInstance().loadAuctionsFromDB(newServer);
219219     AuctionStats as = AuctionServerManager.getInstance().getStats();
220220 
221     //  TODO -- Do something more valuable than just notify, when the auction counts are off.
222221     int savedCount = Integer.parseInt(JConfig.queryConfiguration("last.auctioncount", "-1"));
223222     if (as != null) {
224223       if (as.getCount() != activeCount || (savedCount != -1 && as.getCount() != savedCount)) {
------
259258 
260259     AuctionStats as = AuctionServerManager.getInstance().getStats();
261260 
262     //  TODO -- Do something more valuable than just notify, when the auction counts are off.
263261     int savedCount = Integer.parseInt(JConfig.queryConfiguration("last.auctioncount", "-1"));
264262     if(as != null) {
265263       if(as.getCount() != auctionTotal || (savedCount != -1 && as.getCount() != savedCount)) {
937 955  
912912 
913913     return false;
914914   }
915 
915   // TODO -- Add the ability to pick a quantity to buy, defaulting to 1.
916916   private void DoBuy(Component src, AuctionEntry ae) {
917917     if(anyBiddingErrors(src, ae)) return;
918918 
------
978978     AuctionEntry ae = inAuction;
979979     int[] rowList = mTabs.getPossibleRows();
980980 
981     //  TODO -- It would be nice to be able to show multiple items.
981982     if(rowList.length != 0) {
982 //      Vector<String> multiAuctionIds = new Vector<String>();
983 //      int i;
984 //
985 //      for(i=0; i<rowList.length; i++) {
986 //        AuctionEntry tempEntry = (AuctionEntry) mTabs.getIndexedEntry(rowList[i]);
987 //
988 //        multiAuctionIds.add(tempEntry.getIdentifier());
989 //      }
990 //      TODO -- Find another way to do this...
991 //      JBidProxy.setItems(multiAuctionIds);
992 
993983       ae = (AuctionEntry) mTabs.getIndexedEntry(rowList[0]);
994984     } else {
995985       if(ae == null) {