@Test public void isAvailable() throws Exception { final SkuWarehouseEntity stock = new SkuWarehouseEntity(); final LocalDateTime now0 = DateUtils.ldtParseSDT("2019-08-01"); final LocalDateTime now1 = DateUtils.ldtParseSDT("2019-09-08"); final LocalDateTime now2 = DateUtils.ldtParseSDT("2019-10-16"); assertTrue(stock.isAvailable(now1)); assertTrue(stock.isReleased(now1)); stock.setDisabled(true); assertFalse(stock.isAvailable(now1)); assertTrue(stock.isReleased(now1)); stock.setDisabled(false); stock.setAvailablefrom(DateUtils.ldtParseSDT("2019-09-08")); assertFalse(stock.isAvailable(now0)); assertTrue(stock.isReleased(now0)); assertTrue(stock.isAvailable(now1)); assertTrue(stock.isReleased(now1)); assertTrue(stock.isAvailable(now2)); assertTrue(stock.isReleased(now2)); stock.setAvailableto(DateUtils.ldtParseSDT("2019-09-16")); assertFalse(stock.isAvailable(now0)); assertTrue(stock.isReleased(now0)); assertTrue(stock.isAvailable(now1)); assertTrue(stock.isReleased(now1)); assertFalse(stock.isAvailable(now2)); assertTrue(stock.isReleased(now2)); }
@Override public boolean isAvailable(final LocalDateTime now) { return DomainApiUtils.isObjectAvailableNow(!this.disabled, this.availablefrom, this.availableto, now); }
SkuWarehouseEntity implements org.yes.cart.domain.entity.SkuWarehouse, java.io.Serializable { @Override public boolean isAvailable(final LocalDateTime now) { return DomainApiUtils.isObjectAvailableNow(!this.disabled, this.availablefrom, this.availableto, now); } }
SkuWarehouseEntity implements org.yes.cart.domain.entity.SkuWarehouse, java.io.Serializable { @Override public boolean isAvailable(final LocalDateTime now) { return DomainApiUtils.isObjectAvailableNow(!this.disabled, this.availablefrom, this.availableto, now); } SkuWarehouseEntity(); }
SkuWarehouseEntity implements org.yes.cart.domain.entity.SkuWarehouse, java.io.Serializable { @Override public boolean isAvailable(final LocalDateTime now) { return DomainApiUtils.isObjectAvailableNow(!this.disabled, this.availablefrom, this.availableto, now); } SkuWarehouseEntity(); @Override Warehouse getWarehouse(); @Override void setWarehouse(final Warehouse warehouse); @Override String getSkuCode(); @Override void setSkuCode(final String skuCode); @Override BigDecimal getQuantity(); @Override void setQuantity(final BigDecimal quantity); @Override BigDecimal getReserved(); @Override void setReserved(final BigDecimal reserved); @Override Instant getCreatedTimestamp(); @Override void setCreatedTimestamp(final Instant createdTimestamp); @Override Instant getUpdatedTimestamp(); @Override void setUpdatedTimestamp(final Instant updatedTimestamp); @Override String getCreatedBy(); @Override void setCreatedBy(final String createdBy); @Override String getUpdatedBy(); @Override void setUpdatedBy(final String updatedBy); @Override String getGuid(); @Override void setGuid(final String guid); @Override long getSkuWarehouseId(); @Override long getId(); @Override void setSkuWarehouseId(final long skuWarehouseId); @Override long getVersion(); void setVersion(final long version); @Override boolean isAvailable(final LocalDateTime now); @Override boolean isReleased(final LocalDateTime now); @Override boolean isAvailableToSell(final boolean allowOrderMore); @Override boolean isAvailableToSell(final BigDecimal required, final boolean allowOrderMore); @Override boolean isAvailableToAllocate(final BigDecimal required); @Override BigDecimal getAvailableToSell(); @Override boolean isDisabled(); @Override void setDisabled(final boolean disabled); @Override LocalDateTime getAvailablefrom(); @Override void setAvailablefrom(final LocalDateTime availablefrom); @Override LocalDateTime getAvailableto(); @Override void setAvailableto(final LocalDateTime availableto); @Override int getAvailability(); @Override void setAvailability(final int availability); @Override Boolean getFeatured(); @Override void setFeatured(final Boolean featured); @Override String getTag(); @Override void setTag(final String tag); @Override BigDecimal getMinOrderQuantity(); @Override void setMinOrderQuantity(final BigDecimal minOrderQuantity); @Override BigDecimal getMaxOrderQuantity(); @Override void setMaxOrderQuantity(final BigDecimal maxOrderQuantity); @Override BigDecimal getStepOrderQuantity(); @Override void setStepOrderQuantity(final BigDecimal stepOrderQuantity); @Override LocalDateTime getReleaseDate(); @Override void setReleaseDate(final LocalDateTime releaseDate); @Override LocalDateTime getRestockDate(); @Override void setRestockDate(final LocalDateTime restockDate); String getRestockNoteInternal(); void setRestockNoteInternal(final String restockNoteInternal); @Override I18NModel getRestockNote(); @Override void setRestockNote(final I18NModel restockNote); }
SkuWarehouseEntity implements org.yes.cart.domain.entity.SkuWarehouse, java.io.Serializable { @Override public boolean isAvailable(final LocalDateTime now) { return DomainApiUtils.isObjectAvailableNow(!this.disabled, this.availablefrom, this.availableto, now); } SkuWarehouseEntity(); @Override Warehouse getWarehouse(); @Override void setWarehouse(final Warehouse warehouse); @Override String getSkuCode(); @Override void setSkuCode(final String skuCode); @Override BigDecimal getQuantity(); @Override void setQuantity(final BigDecimal quantity); @Override BigDecimal getReserved(); @Override void setReserved(final BigDecimal reserved); @Override Instant getCreatedTimestamp(); @Override void setCreatedTimestamp(final Instant createdTimestamp); @Override Instant getUpdatedTimestamp(); @Override void setUpdatedTimestamp(final Instant updatedTimestamp); @Override String getCreatedBy(); @Override void setCreatedBy(final String createdBy); @Override String getUpdatedBy(); @Override void setUpdatedBy(final String updatedBy); @Override String getGuid(); @Override void setGuid(final String guid); @Override long getSkuWarehouseId(); @Override long getId(); @Override void setSkuWarehouseId(final long skuWarehouseId); @Override long getVersion(); void setVersion(final long version); @Override boolean isAvailable(final LocalDateTime now); @Override boolean isReleased(final LocalDateTime now); @Override boolean isAvailableToSell(final boolean allowOrderMore); @Override boolean isAvailableToSell(final BigDecimal required, final boolean allowOrderMore); @Override boolean isAvailableToAllocate(final BigDecimal required); @Override BigDecimal getAvailableToSell(); @Override boolean isDisabled(); @Override void setDisabled(final boolean disabled); @Override LocalDateTime getAvailablefrom(); @Override void setAvailablefrom(final LocalDateTime availablefrom); @Override LocalDateTime getAvailableto(); @Override void setAvailableto(final LocalDateTime availableto); @Override int getAvailability(); @Override void setAvailability(final int availability); @Override Boolean getFeatured(); @Override void setFeatured(final Boolean featured); @Override String getTag(); @Override void setTag(final String tag); @Override BigDecimal getMinOrderQuantity(); @Override void setMinOrderQuantity(final BigDecimal minOrderQuantity); @Override BigDecimal getMaxOrderQuantity(); @Override void setMaxOrderQuantity(final BigDecimal maxOrderQuantity); @Override BigDecimal getStepOrderQuantity(); @Override void setStepOrderQuantity(final BigDecimal stepOrderQuantity); @Override LocalDateTime getReleaseDate(); @Override void setReleaseDate(final LocalDateTime releaseDate); @Override LocalDateTime getRestockDate(); @Override void setRestockDate(final LocalDateTime restockDate); String getRestockNoteInternal(); void setRestockNoteInternal(final String restockNoteInternal); @Override I18NModel getRestockNote(); @Override void setRestockNote(final I18NModel restockNote);  }