Search in sources :

Example 1 with FixedAssetRegistration

use of org.estatio.dom.asset.registration.FixedAssetRegistration in project estatio by estatio.

the class ApiItaly method putLandRegister.

// //////////////////////////////////////
@ActionSemantics(Of.IDEMPOTENT)
public void putLandRegister(@Named("propertyReference") final String propertyReference, @Named("unitReference") final String unitReference, @Named("comuneAmministrativo") @Optional final String comuneAmministrativo, @Named("comuneCatastale") @Optional final String comuneCatastale, @Named("codiceComuneCatastale") @Optional final String codiceComuneCatastale, @Named("rendita") @Optional final BigDecimal rendita, @Named("foglio") @Optional final String foglio, @Named("particella") @Optional final String particella, @Named("subalterno") @Optional final String subalterno, @Named("categoria") @Optional final String categoria, @Named("classe") @Optional final String classe, @Named("consistenza") @Optional final String consistenza) {
    Unit unit = units.findUnitByReference(unitReference);
    if (unit == null) {
        unit = units.findUnitByReference(unitReference.replace(" ", "+"));
    }
    if (unit == null) {
        throw new IllegalArgumentException("Unknown unit: ".concat(unitReference));
    }
    LandRegister landRegister = null;
    List<FixedAssetRegistration> farts = fixedAssetRegistrations.findBySubject(unit);
    if (!farts.isEmpty()) {
        landRegister = (LandRegister) farts.get(0);
    }
    if (landRegister == null) {
        landRegister = (LandRegister) fixedAssetRegistrationTypes.findByTitle("LandRegister").create(getContainer());
        landRegister.setSubject(unit);
        landRegister.setComuneAmministrativo(comuneAmministrativo);
        landRegister.setComuneCatastale(codiceComuneCatastale);
        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);
        persistIfNotAlready(landRegister);
    }
}
Also used : FixedAssetRegistration(org.estatio.dom.asset.registration.FixedAssetRegistration) LandRegister(org.estatio.dom.asset.registration.LandRegister) Unit(org.estatio.dom.asset.Unit) ActionSemantics(org.apache.isis.applib.annotation.ActionSemantics)

Aggregations

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