use of org.estatio.module.lease.dom.LeaseTermForTurnoverRent 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.estatio.module.lease.dom.LeaseTermForTurnoverRent in project estatio by estatio.
the class LeaseTermForTurnoverRentManager method upload.
// endregion
// region > upload (action)
@Action(publishing = Publishing.DISABLED, semantics = SemanticsOf.IDEMPOTENT)
public LeaseTermForTurnoverRentManager upload(@Parameter(fileAccept = ".xlsx") @ParameterLayout(named = "Excel spreadsheet") final Blob spreadsheet) {
List<LeaseTermForTurnoverRentLineItem> lineItems = excelService.fromExcel(spreadsheet, LeaseTermForTurnoverRentLineItem.class, LEASE_TERM_FOR_TURNOVER_RENT_SHEET_NAME);
for (LeaseTermForTurnoverRentLineItem lineItem : lineItems) {
final LeaseTermForTurnoverRent leaseTerm = lineItem.getLeaseTerm();
leaseTerm.setAuditedTurnover(lineItem.getAuditedTurnover());
leaseTerm.verify();
}
return this;
}
use of org.estatio.module.lease.dom.LeaseTermForTurnoverRent in project estatio by estatio.
the class LeaseTermForTurnoverRentBuilder method execute.
@Override
protected void execute(final ExecutionContext ec) {
checkParam("leaseItem", ec, LeaseItem.class);
defaultParam("startDate", ec, leaseItem.getStartDate());
defaultParam("leaseTermFrequency", ec, LeaseTermFrequency.YEARLY);
final Class<?> expectedClass = LeaseTermForTurnoverRent.class;
if (!leaseItem.getType().isCreate(expectedClass)) {
throw new IllegalArgumentException(String.format("LeaseItem type must instantiate %s (is %s)", expectedClass, leaseItem.getType()));
}
final LeaseTermForTurnoverRent leaseTerm = (LeaseTermForTurnoverRent) leaseItem.newTerm(startDate, endDate);
leaseTerm.setFrequency(LeaseTermFrequency.YEARLY);
leaseTerm.setTurnoverRentRule(turnoverRentRule);
ec.addResult(this, leaseTerm);
object = leaseTerm;
}
use of org.estatio.module.lease.dom.LeaseTermForTurnoverRent in project estatio by estatio.
the class LeaseItemForTurnoverRentBuilder method execute.
@Override
protected void execute(final ExecutionContext ec) {
defaultParam("charge", ec, Charge_enum.ItTurnoverRent.findUsing(serviceRegistry));
final ChargeGroup group = getCharge().getGroup();
final ChargeGroup_enum expectedGroup = ChargeGroup_enum.TurnoverRent;
if (group != expectedGroup.findUsing(serviceRegistry)) {
throw new IllegalArgumentException("Charge's group must be " + expectedGroup.getRef());
}
LeaseItem leaseItem = new LeaseItemBuilder().setLease(lease).setCharge(charge).setLeaseItemType(LEASE_ITEM_TYPE).setInvoicingFrequency(INVOICING_FREQUENCY).setInvoicedBy(invoicedBy).setPaymentMethod(paymentMethod).setStatus(status).setSequence(sequence).build(this, ec).getObject();
if (sourceItem != null) {
if (leaseItem.getSourceItems().isEmpty()) {
leaseItem.newSourceItem(sourceItem);
}
}
for (LeaseTermForTurnoverRentBuilder.TermSpec termSpec : termSpecs) {
final LeaseTermForTurnoverRent term = new LeaseTermForTurnoverRentBuilder().setLeaseItem(leaseItem).setStartDate(termSpec.startDate).setEndDate(termSpec.endDate).setLeaseTermFrequency(termSpec.leaseTermFrequency).setTurnoverRentRule(termSpec.turnoverRentRule).build(this, ec).getObject();
terms.add(term);
}
object = leaseItem;
}
Aggregations