use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class BankAccountVerificationStateSubscriber method titleOf.
@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void titleOf(BankAccount.TitleUiEvent ev) {
final BankAccount bankAccount = ev.getSource();
final BankAccountVerificationState state = stateTransitionService.currentStateOf(bankAccount, BankAccountVerificationStateTransition.class);
final String title = String.format("%s - %s (%s)", bankAccount.getName(), bankAccount.getOwner().getReference(), Enums.getFriendlyNameOf(state));
ev.setTitle(title);
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class LeaseTermForTurnoverRentImport method importData.
@Programmatic
@Override
public List<Object> importData(Object previousRow) {
LeaseItem item = initLeaseItem();
// create term
LeaseTermForTurnoverRent term = (LeaseTermForTurnoverRent) item.findTermWithSequence(getSequence());
if (term == null) {
if (getStartDate() == null) {
throw new IllegalArgumentException("startDate cannot be empty");
}
if (getSequence().equals(BigInteger.ONE)) {
term = (LeaseTermForTurnoverRent) item.newTerm(getStartDate(), getEndDate());
} else {
final LeaseTerm previousTerm = item.findTermWithSequence(getSequence().subtract(BigInteger.ONE));
if (previousTerm == null) {
throw new IllegalArgumentException("Previous term not found");
}
term = (LeaseTermForTurnoverRent) previousTerm.createNext(getStartDate(), getEndDate());
}
term.setSequence(getSequence());
}
term.setStatus(LeaseTermStatus.valueOf(getStatus()));
// set turnover rent term values
term.setTurnoverRentRule(turnoverRentRule);
term.setAuditedTurnover(auditedTurnover);
term.setAuditedTurnoverRent(auditedTurnoverRent);
return Lists.newArrayList(term);
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class LeaseTypeImport method importData.
@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
final ApplicationTenancy appTenancy = applicationTenancyRepository.findByPath(atPath);
final LeaseType leaseType = leaseTypeRepository.findOrCreate(reference, name, appTenancy);
if (ObjectUtils.compare(name, leaseType.getName()) != 0) {
leaseType.setName(name);
}
return Lists.newArrayList(leaseType);
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class LeaseItemImport method importItem.
@Programmatic
public LeaseItem importItem(boolean updateExisting) {
final Lease lease = fetchLease(leaseReference);
final Charge charge = fetchCharge(chargeReference);
final LeaseItemType itemType = fetchLeaseItemType(itemTypeName);
// for deposit items the start date defaults to the start date of the lease
LocalDate startDateOrDefault;
if (itemType == LeaseItemType.DEPOSIT) {
startDateOrDefault = ObjectUtils.firstNonNull(startDate, lease.getStartDate());
} else {
startDateOrDefault = startDate;
}
LeaseItem item = lease.findItem(itemType, startDateOrDefault, sequence);
if (item == null) {
item = lease.newItem(itemType, LeaseAgreementRoleTypeEnum.LANDLORD, charge, InvoicingFrequency.valueOf(invoicingFrequency), PaymentMethod.valueOf(paymentMethod), startDateOrDefault);
item.setSequence(sequence);
}
if (updateExisting) {
item.setApplicationTenancyPath(atPath);
item.setEpochDate(epochDate);
item.setNextDueDate(nextDueDate);
item.setStatus(LeaseItemStatus.valueOfElse(status, LeaseItemStatus.ACTIVE));
}
return item;
}
use of org.apache.isis.applib.annotation.Programmatic 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