Search in sources :

Example 1 with BreakOption

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;
}
Also used : BreakOption(org.estatio.module.lease.dom.breaks.BreakOption)

Example 2 with 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;
}
Also used : BreakOption(org.estatio.module.lease.dom.breaks.BreakOption) LocalDate(org.joda.time.LocalDate)

Example 3 with 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();
}
Also used : BreakOption(org.estatio.module.lease.dom.breaks.BreakOption) Lease(org.estatio.module.lease.dom.Lease) BreakType(org.estatio.module.lease.dom.breaks.BreakType) Period(org.joda.time.Period) BreakExerciseType(org.estatio.module.lease.dom.breaks.BreakExerciseType) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Aggregations

BreakOption (org.estatio.module.lease.dom.breaks.BreakOption)3 Programmatic (org.apache.isis.applib.annotation.Programmatic)1 Lease (org.estatio.module.lease.dom.Lease)1 BreakExerciseType (org.estatio.module.lease.dom.breaks.BreakExerciseType)1 BreakType (org.estatio.module.lease.dom.breaks.BreakType)1 LocalDate (org.joda.time.LocalDate)1 Period (org.joda.time.Period)1