Search in sources :

Example 1 with CodaElementLevel

use of org.estatio.module.capex.dom.coda.CodaElementLevel in project estatio by estatio.

the class CodaMappingImport method handleRow.

@Override
public void handleRow(final CodaMappingImport previousRow) {
    atPath = atPath == null && previousRow != null ? previousRow.atPath : atPath;
    if (codaElementName == null) {
        String.format("");
    }
    if ((documentType != null || incomingInvoiceType != null) && chargeName != null) {
        IncomingInvoiceType incomingInvoiceTypeEnum = IncomingInvoiceType.valueOf(incomingInvoiceType);
        DocumentType documentTypeEnum = incomingInvoiceTypeEnum == null ? DocumentType.valueOf(documentType) : DocumentType.INVOICE_IN;
        CodaElementLevel codaElementLevelEnum = CodaElementLevel.valueOf(codaElementLevel);
        CodaElement codaElement = codaElementRepository.findOrCreate(codaElementLevelEnum, codaElementCode, codaElementName);
        Charge charge = chargeRepository.findOrCreate(atPath, chargeReference != null ? chargeReference : chargeNameToReference(chargeName), chargeName, "", Applicability.INCOMING);
        final LocalDateInterval interval = period == null ? new LocalDateInterval() : PeriodUtil.yearFromPeriod(period);
        final CodaTransactionType codaTransactionType = valueOfElseDefault(transactionType, CodaTransactionType.STAT);
        codaMappingRepository.findOrCreate(atPath, documentTypeEnum, incomingInvoiceTypeEnum, codaTransactionType, charge, propertyFullyOwned(propertyOwnershipType), interval.startDate(), interval.endDate(), startDate, endDate, codaElement);
    }
}
Also used : IncomingInvoiceType(org.estatio.module.capex.dom.invoice.IncomingInvoiceType) CodaElementLevel(org.estatio.module.capex.dom.coda.CodaElementLevel) CodaElement(org.estatio.module.capex.dom.coda.CodaElement) Charge(org.estatio.module.charge.dom.Charge) DocumentType(org.estatio.module.capex.dom.coda.DocumentType) CodaTransactionType(org.estatio.module.capex.dom.coda.CodaTransactionType) LocalDateInterval(org.incode.module.base.dom.valuetypes.LocalDateInterval)

Aggregations

CodaElement (org.estatio.module.capex.dom.coda.CodaElement)1 CodaElementLevel (org.estatio.module.capex.dom.coda.CodaElementLevel)1 CodaTransactionType (org.estatio.module.capex.dom.coda.CodaTransactionType)1 DocumentType (org.estatio.module.capex.dom.coda.DocumentType)1 IncomingInvoiceType (org.estatio.module.capex.dom.invoice.IncomingInvoiceType)1 Charge (org.estatio.module.charge.dom.Charge)1 LocalDateInterval (org.incode.module.base.dom.valuetypes.LocalDateInterval)1