use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class GuaranteeRepository method newGuarantee.
@Programmatic
public Guarantee newGuarantee(final Lease lease, @Parameter(regexPattern = ReferenceType.Meta.REGEX, regexPatternReplacement = ReferenceType.Meta.REGEX_DESCRIPTION) final String reference, final String name, final GuaranteeType guaranteeType, final LocalDate startDate, final LocalDate endDate, final String description, final BigDecimal contractualAmount, final BigDecimal startAmount) {
AgreementRoleType artGuarantee = agreementRoleTypeRepository.find(GuaranteeAgreementRoleTypeEnum.GUARANTEE);
Party leasePrimaryParty = lease.getPrimaryParty();
AgreementRoleType artGuarantor = agreementRoleTypeRepository.find(GuaranteeAgreementRoleTypeEnum.GUARANTOR);
Party leaseSecondaryParty = lease.getSecondaryParty();
Guarantee guarantee = newTransientInstance(Guarantee.class);
final AgreementType at = agreementTypeRepository.find(GuaranteeAgreementTypeEnum.GUARANTEE);
guarantee.setType(at);
guarantee.setReference(reference);
guarantee.setDescription(description);
guarantee.setName(name);
guarantee.setStartDate(startDate);
guarantee.setEndDate(endDate);
guarantee.setGuaranteeType(guaranteeType);
guarantee.setLease(lease);
guarantee.setContractualAmount(contractualAmount);
guarantee.newRole(artGuarantee, leasePrimaryParty, null, null);
guarantee.newRole(artGuarantor, leaseSecondaryParty, null, null);
FinancialAccountType financialAccountType = guaranteeType.getFinancialAccountType();
if (financialAccountType != null) {
FinancialAccount financialAccount = financialAccountRepository.newFinancialAccount(financialAccountType, reference, name, leaseSecondaryParty);
guarantee.setFinancialAccount(financialAccount);
if (ObjectUtils.compare(startAmount, BigDecimal.ZERO) > 0) {
financialAccountTransactionRepository.newTransaction(guarantee.getFinancialAccount(), startDate, null, startAmount);
}
}
persistIfNotAlready(guarantee);
return guarantee;
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class Invoice method nextItemSequence.
@Programmatic
public BigInteger nextItemSequence() {
BigInteger nextItemSequence = getLastItemSequence() == null ? BigInteger.ONE : getLastItemSequence().add(BigInteger.ONE);
setLastItemSequence(nextItemSequence);
return nextItemSequence;
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class InvoiceItem method calculateTax.
@Programmatic
private void calculateTax() {
if (getTax() != null && getTaxRate() == null)
setTaxRate(tax.taxRateFor(ObjectUtils.firstNonNull(getEffectiveEndDate(), getEndDate(), getDueDate(), getInvoice().getDueDate())));
BigDecimal percentage = getVatPercentage();
setVatAmount(vatFromNet(getNetAmount(), percentage));
setGrossAmount(grossFromNet(getNetAmount(), percentage));
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class BankAccountDtoFactory method newDto.
@Programmatic
public BankAccountDto newDto(final BankAccount bankAccount) {
final BankAccountDto dto = new BankAccountDto();
dto.setSelf(mappingHelper.oidDtoFor(bankAccount));
dto.setAccountNumber(bankAccount.getAccountNumber());
dto.setBankParty(mappingHelper.oidDtoFor(bankAccount.getBank()));
dto.setBranchCode(bankAccount.getBranchCode());
dto.setExternalReference(bankAccount.getExternalReference());
dto.setIban(bankAccount.getIban());
dto.setBic(bankAccount.getBic());
dto.setName(bankAccount.getName());
dto.setNationalBankCode(bankAccount.getNationalBankCode());
dto.setNationalCheckCode(bankAccount.getNationalCheckCode());
dto.setOwnerParty(mappingHelper.oidDtoFor(bankAccount.getOwner()));
dto.setReference(bankAccount.getReference());
return dto;
}
use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.
the class Communication method getId.
// endregion
// region > id (programmatic, for comparison)
@Programmatic
public String getId() {
Object objectId = JDOHelper.getObjectId(this);
if (objectId == null) {
return "";
}
String objectIdStr = objectId.toString();
final String id = objectIdStr.split("\\[OID\\]")[0];
return id;
}
Aggregations