예제 #1
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 + ")");
  }
예제 #2
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;
 }
예제 #3
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;
  }