Class ReservationAccrualMethodServiceImpl
java.lang.Object
ch.tocco.nice2.optional.reservationaccrualexport.impl.service.ReservationAccrualMethodServiceImpl
- All Implemented Interfaces:
AccrualMethodService<com.google.common.collect.Multimap<Long,
Reservation>>
@Component
public class ReservationAccrualMethodServiceImpl
extends Object
implements AccrualMethodService<com.google.common.collect.Multimap<Long,Reservation>>
Calculates the accrual amount by the count of reservations after the deadline
compared to the total number of reservations
-
Constructor Summary
ConstructorDescriptionReservationAccrualMethodServiceImpl
(Context context, QueryBuilderFactory queryBuilderFactory, PersistenceService persistenceService) -
Method Summary
Modifier and TypeMethodDescriptioncalculate
(Voucher voucher, Order order, org.joda.time.LocalDate deadline, com.google.common.collect.Multimap<Long, Reservation> preparedData) Deprecated.boolean
check
(Voucher voucher, Order order, org.joda.time.LocalDate deadline, com.google.common.collect.Multimap<Long, Reservation> preparedData) boolean
Deprecated.com.google.common.collect.Multimap
<Long, Reservation> prepareData
(List<Voucher> vouchers) Receives all vouchers which should be handled in this task run and should return all the data which is needed to do its job inAccrualMethodService.check(Voucher, Order, LocalDate, T)
andAccrualMethodService.calculate(Voucher, Order, LocalDate, T)
.
-
Constructor Details
-
ReservationAccrualMethodServiceImpl
public ReservationAccrualMethodServiceImpl(Context context, QueryBuilderFactory queryBuilderFactory, PersistenceService persistenceService)
-
-
Method Details
-
prepareData
Description copied from interface:AccrualMethodService
Receives all vouchers which should be handled in this task run and should return all the data which is needed to do its job inAccrualMethodService.check(Voucher, Order, LocalDate, T)
andAccrualMethodService.calculate(Voucher, Order, LocalDate, T)
. This method here should load the needed data as efficient as possible (few queries and only necessary paths). The other methods (`check` and `calculate`) shouldn't have to make any database queries at all.- Specified by:
prepareData
in interfaceAccrualMethodService<com.google.common.collect.Multimap<Long,
Reservation>> - Returns:
- list of linked reservations for every voucher (voucher pk is multimap key)
-
check
public boolean check(Voucher voucher, Order order, org.joda.time.LocalDate deadline, com.google.common.collect.Multimap<Long, Reservation> preparedData) - Specified by:
check
in interfaceAccrualMethodService<com.google.common.collect.Multimap<Long,
Reservation>>
-
calculate
public BigDecimal calculate(Voucher voucher, Order order, org.joda.time.LocalDate deadline, com.google.common.collect.Multimap<Long, Reservation> preparedData) - Specified by:
calculate
in interfaceAccrualMethodService<com.google.common.collect.Multimap<Long,
Reservation>>
-
check
Deprecated.- Specified by:
check
in interfaceAccrualMethodService<com.google.common.collect.Multimap<Long,
Reservation>>
-
calculate
Deprecated.- Specified by:
calculate
in interfaceAccrualMethodService<com.google.common.collect.Multimap<Long,
Reservation>>
-