All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.adorsys.xs2a.adapter.sparkasse.SparkasseMapperImpl Maven / Gradle / Ivy

package de.adorsys.xs2a.adapter.sparkasse;

import de.adorsys.xs2a.adapter.api.model.AccountReport;
import de.adorsys.xs2a.adapter.api.model.Balance;
import de.adorsys.xs2a.adapter.api.model.HrefType;
import de.adorsys.xs2a.adapter.api.model.OK200TransactionDetails;
import de.adorsys.xs2a.adapter.api.model.RemittanceInformationStructured;
import de.adorsys.xs2a.adapter.api.model.ReportExchangeRate;
import de.adorsys.xs2a.adapter.api.model.TransactionDetailsBody;
import de.adorsys.xs2a.adapter.api.model.Transactions;
import de.adorsys.xs2a.adapter.api.model.TransactionsResponse200Json;
import de.adorsys.xs2a.adapter.sparkasse.model.SparkasseAccountReport;
import de.adorsys.xs2a.adapter.sparkasse.model.SparkasseOK200TransactionDetails;
import de.adorsys.xs2a.adapter.sparkasse.model.SparkasseTransactionDetails;
import de.adorsys.xs2a.adapter.sparkasse.model.SparkasseTransactionResponse200Json;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Generated;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2021-03-11T09:11:20+0000",
    comments = "version: 1.4.1.Final, compiler: javac, environment: Java 1.8.0_282 (Azul Systems, Inc.)"
)
public class SparkasseMapperImpl implements SparkasseMapper {

    @Override
    public TransactionsResponse200Json toTransactionsResponse200Json(SparkasseTransactionResponse200Json value) {
        if ( value == null ) {
            return null;
        }

        TransactionsResponse200Json transactionsResponse200Json = new TransactionsResponse200Json();

        transactionsResponse200Json.setAccount( value.getAccount() );
        transactionsResponse200Json.setTransactions( sparkasseAccountReportToAccountReport( value.getTransactions() ) );
        List list = value.getBalances();
        if ( list != null ) {
            transactionsResponse200Json.setBalances( new ArrayList( list ) );
        }
        Map map = value.getLinks();
        if ( map != null ) {
            transactionsResponse200Json.setLinks( new HashMap( map ) );
        }

        return transactionsResponse200Json;
    }

    @Override
    public OK200TransactionDetails toOK200TransactionDetails(SparkasseOK200TransactionDetails value) {
        if ( value == null ) {
            return null;
        }

        OK200TransactionDetails oK200TransactionDetails = new OK200TransactionDetails();

        oK200TransactionDetails.setTransactionsDetails( toTransactionDetailsBody( value.getTransactionsDetails() ) );

        return oK200TransactionDetails;
    }

    @Override
    public Transactions toTransactions(SparkasseTransactionDetails value) {
        if ( value == null ) {
            return null;
        }

        Transactions transactions = new Transactions();

        transactions.setTransactionId( value.getTransactionId() );
        transactions.setEntryReference( value.getEntryReference() );
        transactions.setEndToEndId( value.getEndToEndId() );
        transactions.setMandateId( value.getMandateId() );
        transactions.setCheckId( value.getCheckId() );
        transactions.setCreditorId( value.getCreditorId() );
        transactions.setBookingDate( value.getBookingDate() );
        transactions.setValueDate( value.getValueDate() );
        transactions.setTransactionAmount( value.getTransactionAmount() );
        List list = value.getCurrencyExchange();
        if ( list != null ) {
            transactions.setCurrencyExchange( new ArrayList( list ) );
        }
        transactions.setCreditorName( value.getCreditorName() );
        transactions.setCreditorAccount( value.getCreditorAccount() );
        transactions.setCreditorAgent( value.getCreditorAgent() );
        transactions.setUltimateCreditor( value.getUltimateCreditor() );
        transactions.setDebtorName( value.getDebtorName() );
        transactions.setDebtorAccount( value.getDebtorAccount() );
        transactions.setDebtorAgent( value.getDebtorAgent() );
        transactions.setUltimateDebtor( value.getUltimateDebtor() );
        transactions.setRemittanceInformationUnstructured( value.getRemittanceInformationUnstructured() );
        List list1 = value.getRemittanceInformationUnstructuredArray();
        if ( list1 != null ) {
            transactions.setRemittanceInformationUnstructuredArray( new ArrayList( list1 ) );
        }
        transactions.setRemittanceInformationStructured( map( value.getRemittanceInformationStructured() ) );
        List list2 = value.getRemittanceInformationStructuredArray();
        if ( list2 != null ) {
            transactions.setRemittanceInformationStructuredArray( new ArrayList( list2 ) );
        }
        transactions.setAdditionalInformation( value.getAdditionalInformation() );
        transactions.setAdditionalInformationStructured( value.getAdditionalInformationStructured() );
        transactions.setPurposeCode( value.getPurposeCode() );
        transactions.setBankTransactionCode( value.getBankTransactionCode() );
        transactions.setProprietaryBankTransactionCode( value.getProprietaryBankTransactionCode() );
        transactions.setBalanceAfterTransaction( value.getBalanceAfterTransaction() );
        Map map = value.getLinks();
        if ( map != null ) {
            transactions.setLinks( new HashMap( map ) );
        }

        return transactions;
    }

    @Override
    public TransactionDetailsBody toTransactionDetailsBody(SparkasseTransactionDetails value) {
        if ( value == null ) {
            return null;
        }

        TransactionDetailsBody transactionDetailsBody = new TransactionDetailsBody();

        transactionDetailsBody.setTransactionDetails( toTransactions(value) );

        return transactionDetailsBody;
    }

    protected List sparkasseTransactionDetailsListToTransactionsList(List list) {
        if ( list == null ) {
            return null;
        }

        List list1 = new ArrayList( list.size() );
        for ( SparkasseTransactionDetails sparkasseTransactionDetails : list ) {
            list1.add( toTransactions( sparkasseTransactionDetails ) );
        }

        return list1;
    }

    protected AccountReport sparkasseAccountReportToAccountReport(SparkasseAccountReport sparkasseAccountReport) {
        if ( sparkasseAccountReport == null ) {
            return null;
        }

        AccountReport accountReport = new AccountReport();

        accountReport.setBooked( sparkasseTransactionDetailsListToTransactionsList( sparkasseAccountReport.getBooked() ) );
        accountReport.setPending( sparkasseTransactionDetailsListToTransactionsList( sparkasseAccountReport.getPending() ) );
        Map map = sparkasseAccountReport.getLinks();
        if ( map != null ) {
            accountReport.setLinks( new HashMap( map ) );
        }

        return accountReport;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy