Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
5.8 kB
3
Indexable
Never
package pl.creditagricole.ufeStewardesaParty.uilogic.external.customer.mapping.request.verifyIndividualPerson;

import lombok.NonNull;
import pl.creditagricole.frontend.utils.mapping.Mapper;
import pl.creditagricole.generation.clients.individualPersonPublic.verifyIndividualPerson.request.ObjectFactory;
import pl.creditagricole.generation.clients.individualPersonPublic.verifyIndividualPerson.request.PartySystem;
import pl.creditagricole.generation.clients.individualPersonPublic.verifyIndividualPerson.request.PartySystemList;
import pl.creditagricole.ufe.stewardesa.party.uilogic.schemas.json.dictionary.request.verifyIndvidualPerson.CustomerBaseData;
import pl.creditagricole.ufe.stewardesa.party.uilogic.schemas.json.dictionary.request.verifyIndvidualPerson.CustomerSystemData;
import pl.creditagricole.ufe.stewardesa.party.uilogic.schemas.json.dictionary.request.verifyIndvidualPerson.VerifyIndvPersonRequest;
import pl.creditagricole.ufeStewardesaParty.uilogic.external.commons.JaxBSetValueUtils;

import java.util.List;

public class PartySystemListMapper implements Mapper<VerifyIndvPersonRequest,PartySystemList> {
    @Override
    public PartySystemList convert(@NonNull VerifyIndvPersonRequest request) {
        List<PartySystem> partySystemList = request.getCustomerBaseData().map(this::mapPartySystem).orElse(null);

        return PartySystemList.builder().ptySys(partySystemList).build();
    }

    private List<PartySystem> mapPartySystem(CustomerBaseData customerBaseData) {
        return customerBaseData.getSystems().map(this::mapSystem).toJavaList();
    }

    private PartySystem mapSystem(CustomerSystemData customerSystemData) {
        ObjectFactory factory = new ObjectFactory();
        PartySystem partySystem = new PartySystem();
        JaxBSetValueUtils<PartySystem> partySystemJaxBSetValueUtils = new JaxBSetValueUtils<>(partySystem);

        partySystemJaxBSetValueUtils.setStringValue(customerSystemData.getSystemIdKey(), PartySystem::setSysId, factory::createPartySystemSysId);
        partySystemJaxBSetValueUtils.setStringValue(customerSystemData.getClientSystemId(), PartySystem::setSrcCstmrId, factory::createPartySystemSrcCstmrId);
        partySystemJaxBSetValueUtils.setStringValue(customerSystemData.getPartySystemUniverse(), PartySystem::setUnvrsTp, factory::createPartySystemUnvrsTp);
        partySystemJaxBSetValueUtils.setLocalDateTimeValue(customerSystemData.getCreatedData(), PartySystem::setDtCret, factory::createPartySystemDtCret);
        partySystemJaxBSetValueUtils.setLocalDateTimeValue(customerSystemData.getModificationData(), PartySystem::setDtMod, factory::createPartySystemDtMod);
        partySystemJaxBSetValueUtils.setStringValue(customerSystemData.getOperatorType(), PartySystem::setOprtrMod, factory::createPartySystemOprtrMod);

        return partySystem;
    }
}

package pl.creditagricole.ufeStewardesaParty.uilogic.external.customer.mapping.request.updateIndividualPerson;

import lombok.NonNull;
import pl.creditagricole.frontend.utils.mapping.Mapper;
import pl.creditagricole.generation.clients.individualPersonPublic.updateIndividualPerson.request.ObjectFactory;
import pl.creditagricole.generation.clients.individualPersonPublic.updateIndividualPerson.request.PartySystem;
import pl.creditagricole.generation.clients.individualPersonPublic.updateIndividualPerson.request.PartySystemList;
import pl.creditagricole.ufe.stewardesa.party.uilogic.schemas.json.dictionary.request.updateIndividualPerson.CustomerBaseData;
import pl.creditagricole.ufe.stewardesa.party.uilogic.schemas.json.dictionary.request.updateIndividualPerson.CustomerSystemData;
import pl.creditagricole.ufe.stewardesa.party.uilogic.schemas.json.dictionary.request.updateIndividualPerson.UpdateIndvPersonRequest;
import pl.creditagricole.ufeStewardesaParty.uilogic.external.commons.JaxBSetValueUtils;

import java.util.List;

public class PartySystemListMapper implements Mapper<UpdateIndvPersonRequest,PartySystemList> {
    @Override
    public PartySystemList convert(@NonNull UpdateIndvPersonRequest request) {
        List<PartySystem> partySystemList = request.getCustomerBaseData().map(this::mapPartySystem).orElse(null);

        return PartySystemList.builder().ptySys(partySystemList).build();
    }

    private List<PartySystem> mapPartySystem(CustomerBaseData customerBaseData) {
        return customerBaseData.getSystems().map(this::mapSystem).toJavaList();
    }

    private PartySystem mapSystem(CustomerSystemData customerSystemData) {
        ObjectFactory factory = new ObjectFactory();
        PartySystem partySystem = new PartySystem();
        JaxBSetValueUtils<PartySystem> partySystemJaxBSetValueUtils = new JaxBSetValueUtils<>(partySystem);

        partySystemJaxBSetValueUtils.setStringValue(customerSystemData.getSystemIdKey(), PartySystem::setSysId, factory::createPartySystemSysId);
        partySystemJaxBSetValueUtils.setStringValue(customerSystemData.getClientSystemId(), PartySystem::setSrcCstmrId, factory::createPartySystemSrcCstmrId);
        partySystemJaxBSetValueUtils.setStringValue(customerSystemData.getPartySystemUniverse(), PartySystem::setUnvrsTp, factory::createPartySystemUnvrsTp);
        partySystemJaxBSetValueUtils.setLocalDateTimeValue(customerSystemData.getCreatedData(), PartySystem::setDtCret, factory::createPartySystemDtCret);
        partySystemJaxBSetValueUtils.setLocalDateTimeValue(customerSystemData.getModificationData(), PartySystem::setDtMod, factory::createPartySystemDtMod);
        partySystemJaxBSetValueUtils.setStringValue(customerSystemData.getOperatorType(), PartySystem::setOprtrMod, factory::createPartySystemOprtrMod);

        return partySystem;
    }
}