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;
}
Aggregations