Search in sources :

Example 56 with Programmatic

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

the class LandRegisterImport method importData.

@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
    counter++;
    if (counter == 1) {
        System.out.println();
        LOG.info("importing");
    }
    Unit unit = unitRepository.findUnitByReference(unitReference);
    if (unit == null) {
        unit = unitRepository.findUnitByReference(unitReference.replace(" ", "+"));
    }
    if (unit == null) {
        throw new IllegalArgumentException("Unknown unit: ".concat(unitReference));
    }
    LandRegister landRegister = null;
    List<FixedAssetRegistration> farts = fixedAssetRegistrationRepository.findBySubject(unit);
    if (!farts.isEmpty()) {
        landRegister = (LandRegister) farts.get(0);
    }
    if (landRegister == null) {
        landRegister = (LandRegister) fixedAssetRegistrationTypeRepository.findByTitle("LandRegister").create(factoryService);
        container.persistIfNotAlready(landRegister);
    }
    landRegister.setSubject(unit);
    landRegister.setComuneAmministrativo(comuneAmministrativo);
    landRegister.setComuneCatastale(comuneCatastale);
    landRegister.setCodiceComuneCatastale(codiceComuneCatastale);
    landRegister.setRendita(rendita == null ? null : rendita.setScale(2, RoundingMode.HALF_EVEN));
    landRegister.setFoglio(foglio);
    landRegister.setParticella(particella);
    landRegister.setSubalterno(subalterno);
    landRegister.setCategoria(categoria);
    landRegister.setClasse(classe);
    landRegister.setConsistenza(consistenza);
    System.out.print(".");
    return null;
}
Also used : FixedAssetRegistration(org.estatio.module.asset.dom.registration.FixedAssetRegistration) LandRegister(org.estatio.module.registration.dom.LandRegister) Unit(org.estatio.module.asset.dom.Unit) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 57 with Programmatic

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

the class PartyDtoFactory method newDto.

@Programmatic
public PartyDto newDto(final Party party) {
    PartyDto dto = new PartyDto();
    dto.setSelf(mappingHelper.oidDtoFor(party));
    dto.setName(party.getName());
    dto.setReference(party.getReference());
    final SortedSet<CommunicationChannel> postalAddresses = communicationChannelRepository.findByOwnerAndType(party, CommunicationChannelType.POSTAL_ADDRESS);
    final Optional<CommunicationChannel> postalAddressIfAny = postalAddresses.stream().filter(x -> x.isLegal()).findFirst();
    if (postalAddressIfAny.isPresent()) {
        dto.setLegalPostalAddress(mappingHelper.oidDtoFor(postalAddressIfAny.get()));
    }
    return dto;
}
Also used : Inject(javax.inject.Inject) NatureOfService(org.apache.isis.applib.annotation.NatureOfService) Party(org.estatio.module.party.dom.Party) SortedSet(java.util.SortedSet) DtoMappingHelper(org.apache.isis.applib.services.dto.DtoMappingHelper) CommunicationChannel(org.incode.module.communications.dom.impl.commchannel.CommunicationChannel) CommunicationChannelType(org.incode.module.communications.dom.impl.commchannel.CommunicationChannelType) Optional(java.util.Optional) PartyDto(org.estatio.canonical.party.v1.PartyDto) DomainService(org.apache.isis.applib.annotation.DomainService) CommunicationChannelRepository(org.incode.module.communications.dom.impl.commchannel.CommunicationChannelRepository) Programmatic(org.apache.isis.applib.annotation.Programmatic) PartyDto(org.estatio.canonical.party.v1.PartyDto) CommunicationChannel(org.incode.module.communications.dom.impl.commchannel.CommunicationChannel) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 58 with Programmatic

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

the class GuaranteeImport method importData.

@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
    counter++;
    if (counter == 1) {
        System.out.println();
        LOG.info("importing");
    }
    if (amount == null) {
        amount = BigDecimal.ZERO;
    }
    Guarantee guarantee = guaranteeRepository.findByReference(reference);
    if (guarantee == null) {
        final Lease lease = fetchLease(leaseReference);
        guarantee = guaranteeRepository.newGuarantee(lease, reference, name, guaranteeType, startDate, endDate, description, maximumAmount, null);
    }
    guarantee.setTerminationDate(terminationDate);
    guarantee.setDescription(description);
    guarantee.setComments(comments);
    FinancialAccountTransaction transaction = financialAccountTransactionRepository.findTransaction(guarantee.getFinancialAccount(), transactionDate);
    if (transaction == null && ObjectUtils.compare(amount, BigDecimal.ZERO) > 0 && guarantee.getFinancialAccount() != null) {
        transaction = financialAccountTransactionRepository.newTransaction(guarantee.getFinancialAccount(), transactionDate, transactionDescription, amount);
    }
    // LOG.info("guarantee " + counter + " : " + guarantee.getReference() + " - " + guarantee.getLease().getReference());
    System.out.print(".");
    return Lists.newArrayList(guarantee);
}
Also used : Lease(org.estatio.module.lease.dom.Lease) Guarantee(org.estatio.module.guarantee.dom.Guarantee) FinancialAccountTransaction(org.estatio.module.financial.dom.FinancialAccountTransaction) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 59 with Programmatic

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

the class ChargeImport method importData.

@Override
@Programmatic
public List<Object> importData(Object previousRow) {
    ChargeGroup chargeGroup = null;
    if (getChargeGroupReference() != null) {
        chargeGroup = findOrCreateChargeGroup(chargeGroupReference, chargeGroupName);
    }
    final ApplicationTenancy applicationTenancy = securityApplicationTenancyRepository.findByPath(atPath);
    final Applicability applicability = this.applicability != null ? Applicability.valueOf(this.applicability) : Applicability.IN_AND_OUT;
    Tax tax = null;
    if (getTaxReference() != null) {
        tax = taxRepository.findOrCreate(taxReference, taxReference, applicationTenancy);
    }
    if (getReference() == null) {
        setReference(getName());
    }
    final Charge charge = chargeRepository.upsert(getReference(), getName(), getDescription(), applicationTenancy, applicability, tax, chargeGroup);
    if (getParent() != null) {
        Charge parentCharge = chargeRepository.findByReference(getParent());
        if (parentCharge != null) {
            charge.setParent(parentCharge);
        }
    }
    if (externalReference != null) {
        charge.setExternalReference(externalReference);
    }
    if (sortOrder != null) {
        charge.setSortOrder(sortOrder);
    }
    return Lists.newArrayList(charge);
}
Also used : ChargeGroup(org.estatio.module.charge.dom.ChargeGroup) Charge(org.estatio.module.charge.dom.Charge) Tax(org.estatio.module.tax.dom.Tax) Applicability(org.estatio.module.charge.dom.Applicability) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 60 with Programmatic

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

the class IndexImport method importData.

@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
    final ApplicationTenancy applicationTenancy = applicationTenancyRepository.findByPath(getAtPath());
    // Creator and implement IndexCreator, IndexBaseCreator, IndexValueCreator
    final IndexValue indexValue = indexRepository.findOrCreateIndex(applicationTenancy, indexReference, indexName).findOrCreateBase(indexBaseStartDate, indexBaseFactor).newIndexValue(startDate, value);
    return Lists.newArrayList(indexValue);
}
Also used : IndexValue(org.estatio.module.index.dom.IndexValue) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) 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