Search in sources :

Example 71 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class BankAccountSubscriptions method on.

@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void on(final BankAccount.RemoveEvent ev) {
    BankAccount sourceBankAccount = ev.getSource();
    List<FixedAssetFinancialAccount> results;
    switch(ev.getEventPhase()) {
        case VALIDATE:
            results = fixedAssetFinancialAccountRepository.findByFinancialAccount(sourceBankAccount);
            if (results.size() > 0) {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append("This bank account is assigned to a fixed asset: remove the bank account from the fixed asset. In use by the following fixed assets: ");
                for (FixedAssetFinancialAccount fixedAssetFinancialAccount : results) {
                    stringBuilder.append(fixedAssetFinancialAccount.getFixedAsset().getName() + "\n");
                }
                ev.invalidate(stringBuilder.toString());
            }
            break;
        default:
            break;
    }
}
Also used : FixedAssetFinancialAccount(org.estatio.module.assetfinancial.dom.FixedAssetFinancialAccount) BankAccount(org.estatio.module.financial.dom.BankAccount) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 72 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class BankMandateDtoFactory method newDto.

@Programmatic
public BankMandateDto newDto(final BankMandate bankMandate) {
    final BankMandateDto dto = new BankMandateDto();
    dto.setSelf(mappingHelper.oidDtoFor(bankMandate));
    dto.setReference(fixup(bankMandate.getReference()));
    dto.setScheme(toDto(bankMandate.getScheme()));
    dto.setSequenceType(toDto2(bankMandate.getSequenceType()));
    dto.setSignatureDate(asXMLGregorianCalendar(bankMandate.getSignatureDate()));
    dto.setBankAccount(mappingHelper.oidDtoFor(bankMandate.getBankAccount()));
    // not currently in the estatio dom, so hard-coded for now
    dto.setStatus(Status.OPEN);
    return dto;
}
Also used : BankMandateDto(org.estatio.canonical.bankmandate.v1.BankMandateDto) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 73 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class UdoDomainObject method getId.

// //////////////////////////////////////
@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 : AbstractDomainObject(org.apache.isis.applib.AbstractDomainObject) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 74 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class Partitioning method getFractionOfYear.

@Programmatic
public BigDecimal getFractionOfYear() {
    BigDecimal numberOfDaysInInterval = BigDecimal.valueOf(getInterval().days());
    BigDecimal numberOfDaysInYear = BigDecimal.valueOf(new LocalDateInterval(new LocalDate(getStartDate().getYear(), 01, 01), new LocalDate(getStartDate().getYear() + 1, 01, 01), AbstractInterval.IntervalEnding.EXCLUDING_END_DATE).days());
    return numberOfDaysInInterval.divide(numberOfDaysInYear, MathContext.DECIMAL64);
}
Also used : LocalDate(org.joda.time.LocalDate) BigDecimal(java.math.BigDecimal) LocalDateInterval(org.incode.module.base.dom.valuetypes.LocalDateInterval) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 75 with Programmatic

use of org.apache.isis.applib.annotation.Programmatic in project estatio by estatio.

the class ProlongationOptionRepository method checkProlongationAndNotificationPeriodStr.

@Programmatic
public String checkProlongationAndNotificationPeriodStr(final String prolongationPeriod, final String notificationPeriod) {
    final Period prolongationPeriodJoda = JodaPeriodUtils.asPeriod(prolongationPeriod);
    if (prolongationPeriod != null && prolongationPeriodJoda == null) {
        return "Prolongation period format not recognized";
    }
    final Period notificationPeriodJoda = JodaPeriodUtils.asPeriod(notificationPeriod);
    if (notificationPeriod != null && notificationPeriodJoda == null) {
        return "Notification period format not recognized";
    }
    return null;
}
Also used : Period(org.joda.time.Period) 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