コード例 #1
0
  public FacilityProductReportEntry(StockCard stockCard, Date endTime) {
    if (endTime == null) {
      endTime = new Date();
    }

    this.productName = stockCard.getProduct().getPrimaryName();
    List<StockCardEntry> stockCardEntryList = filterEntryByDate(stockCard, endTime);
    this.productQuantity = calculateQuantity(stockCardEntryList);

    assignSoonestExpirationDate(stockCardEntryList);

    this.code = stockCard.getProduct().getCode();
  }
コード例 #2
0
 private List<StockCardEntry> filterEntryByDate(final StockCard stockCard, final Date date) {
   return from(stockCard.getEntries())
       .filter(
           new Predicate<StockCardEntry>() {
             @Override
             public boolean apply(StockCardEntry input) {
               return !DateUtils.truncate(input.getCreatedDate(), Calendar.DATE).after(date);
             }
           })
       .toList();
 }