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