Ejemplo n.º 1
0
  private int doSnipe() {
    //  Just punt if we had failed to get the bidding form initially.
    if (mBidForm == null) return FAIL;
    UpdateBlocker.startBlocking();
    if (mEntry.isMultiSniped()) {
      MultiSnipe ms = mEntry.getMultiSnipe();
      //  Make sure there aren't any update-unfinished items.
      if (ms.anyEarlier(mEntry)) {
        mEntry.setLastStatus(
            "An earlier snipe in this multisnipe group has not ended, or has not been updated after ending.");
        mEntry.setLastStatus(
            "This snipe is NOT being fired, as it could end up winning two items.");
        UpdateBlocker.endBlocking();
        return RESNIPE;
      }
    }
    MQFactory.getConcrete("Swing").enqueue("Sniping on " + mEntry.getTitle());
    mEntry.setLastStatus("Firing actual snipe.");

    int rval =
        mBidder.placeFinalBid(
            mCJ, mBidForm, mEntry, mEntry.getSnipeAmount(), mEntry.getSnipeQuantity());
    JConfig.increment("stats.sniped");
    String snipeResult = getSnipeResult(rval, mEntry.getTitle(), mEntry);
    mEntry.setLastStatus(snipeResult);

    MQFactory.getConcrete("Swing").enqueue("NOTIFY " + snipeResult);
    JConfig.log().logDebug(snipeResult);

    mEntry.snipeCompleted();
    UpdateBlocker.endBlocking();
    return DONE;
  }
Ejemplo n.º 2
0
  public static boolean deleteAll(List<MultiSnipe> toDelete) {
    if (toDelete.isEmpty()) return true;
    String multisnipes = makeCommaList(toDelete);

    for (MultiSnipe ms : toDelete) {
      singleSource.remove(ms.getId());
    }

    return toDelete.get(0).getDatabase().deleteBy("id IN (" + multisnipes + ")");
  }
Ejemplo n.º 3
0
 private static MultiSnipe cacheResult(MultiSnipe rval) {
   if (rval != null) {
     if (singleSource.get(rval.getId()) != null) {
       rval = singleSource.get(rval.getId());
     } else {
       singleSource.put(rval.getId(), rval);
     }
   }
   return rval;
 }
Ejemplo n.º 4
0
  public static MultiSnipe loadFromXML(XMLElement curElement) {
    String identifier = curElement.getProperty("ID");
    String bgColor = curElement.getProperty("COLOR");
    Currency defaultSnipe = Currency.getCurrency(curElement.getProperty("DEFAULT"));
    boolean subtractShipping = curElement.getProperty("SUBTRACTSHIPPING", "false").equals("true");

    MultiSnipe ms = MultiSnipe.findFirstBy("identifier", identifier);
    if (ms == null)
      ms = new MultiSnipe(bgColor, defaultSnipe, Long.parseLong(identifier), subtractShipping);

    return ms;
  }