use of org.estatio.module.lease.dom.breaks.BreakOption in project estatio by estatio.
the class BreakOptionBuilder method newBreakOption.
private BreakOption newBreakOption(Lease lease, LocalDate breakDate, String notificationPeriodStr, BreakExerciseType exerciseType, BreakType breakType, String description, ExecutionContext executionContext) {
breakOptionContributions.newBreakOption(lease, breakDate, notificationPeriodStr, breakType, exerciseType, description);
final BreakOption breakOption = breakOptionRepository.findByLeaseAndTypeAndBreakDateAndExerciseType(lease, breakType, breakDate, exerciseType);
executionContext.addResult(this, breakOption);
return breakOption;
}
use of org.estatio.module.lease.dom.breaks.BreakOption in project estatio by estatio.
the class BreakOptionBuilder method execute.
@Override
protected void execute(final ExecutionContext ec) {
checkParam("lease", ec, Lease.class);
checkParam("sortOf", ec, SortOf.class);
if (sortOf == SortOf.PLUS_YEARS) {
checkParam("years", ec, Integer.class);
}
checkParam("notificationPeriodStr", ec, String.class);
checkParam("breakType", ec, BreakType.class);
checkParam("exerciseType", ec, BreakExerciseType.class);
// description not required
LocalDate breakDate = breakDateFor(this.lease, this.sortOf, this.years);
final BreakOption breakOption = newBreakOption(this.lease, breakDate, notificationPeriodStr, exerciseType, breakType, description, ec);
object = breakOption;
}
use of org.estatio.module.lease.dom.breaks.BreakOption in project estatio by estatio.
the class BreakOptionImport method importData.
@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
final Lease lease = fetchLease(leaseReference);
final BreakType breakTypeValue = BreakType.valueOf(breakType);
final BreakExerciseType breakExerciseTypeValue = BreakExerciseType.valueOf(breakExcerciseType);
if (notificationDate != null) {
final Period period = new Period(notificationDate, breakDate);
notificationPeriod = JodaPeriodUtils.asSimpleString(period);
}
BreakOption br = breakOptionRepository.findByLeaseAndTypeAndBreakDateAndExerciseType(lease, breakTypeValue, breakDate, breakExerciseTypeValue);
if (br == null) {
breakOptionRepository.newBreakOption(lease, breakDate, notificationPeriod, breakTypeValue, breakExerciseTypeValue, description);
}
return Lists.newArrayList();
}
Aggregations