Search in sources :

Example 61 with Programmatic

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;
}
Also used : AgreementType(org.estatio.module.agreement.dom.type.AgreementType) FinancialAccountType(org.estatio.module.financial.dom.FinancialAccountType) Party(org.estatio.module.party.dom.Party) AgreementRoleType(org.estatio.module.agreement.dom.role.AgreementRoleType) FinancialAccount(org.estatio.module.financial.dom.FinancialAccount) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 62 with Programmatic

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;
}
Also used : BigInteger(java.math.BigInteger) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 63 with Programmatic

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));
}
Also used : BigDecimal(java.math.BigDecimal) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 64 with Programmatic

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;
}
Also used : BankAccountDto(org.estatio.canonical.financial.v1.BankAccountDto) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 65 with Programmatic

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;
}
Also used : DomainObject(org.apache.isis.applib.annotation.DomainObject) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Aggregations

Programmatic (org.apache.isis.applib.annotation.Programmatic)162 Party (org.estatio.module.party.dom.Party)21 Lease (org.estatio.module.lease.dom.Lease)16 DomainObject (org.apache.isis.applib.annotation.DomainObject)11 BankAccount (org.estatio.module.financial.dom.BankAccount)11 Charge (org.estatio.module.charge.dom.Charge)10 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)10 LocalDate (org.joda.time.LocalDate)10 BigDecimal (java.math.BigDecimal)9 Bookmark (org.apache.isis.applib.services.bookmark.Bookmark)9 ApplicationException (org.apache.isis.applib.ApplicationException)8 Property (org.estatio.module.asset.dom.Property)8 CommunicationChannel (org.incode.module.communications.dom.impl.commchannel.CommunicationChannel)8 ArrayList (java.util.ArrayList)7 TranslatableString (org.apache.isis.applib.services.i18n.TranslatableString)7 InvoiceItem (org.estatio.module.invoice.dom.InvoiceItem)7 LeaseItem (org.estatio.module.lease.dom.LeaseItem)7 Inject (javax.inject.Inject)6 Unit (org.estatio.module.asset.dom.Unit)6 Document (org.incode.module.document.dom.impl.docs.Document)6