Search in sources :

Example 1 with Applicability

use of org.estatio.module.charge.dom.Applicability 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)

Aggregations

Programmatic (org.apache.isis.applib.annotation.Programmatic)1 Applicability (org.estatio.module.charge.dom.Applicability)1 Charge (org.estatio.module.charge.dom.Charge)1 ChargeGroup (org.estatio.module.charge.dom.ChargeGroup)1 Tax (org.estatio.module.tax.dom.Tax)1 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)1