Search in sources :

Example 1 with FixedAssetRegistration

use of org.estatio.module.asset.dom.registration.FixedAssetRegistration 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)

Aggregations

Programmatic (org.apache.isis.applib.annotation.Programmatic)1 Unit (org.estatio.module.asset.dom.Unit)1 FixedAssetRegistration (org.estatio.module.asset.dom.registration.FixedAssetRegistration)1 LandRegister (org.estatio.module.registration.dom.LandRegister)1