package com.eactive.eai.rms.bap.loader.service;


import com.eactive.eai.rms.bap.loader.intf.InterfaceDeployService;
import com.eactive.eai.rms.bap.loader.intf.deploy.InterfaceDeploy;
import com.eactive.eai.rms.onl.loader.service.TransactionDeployJsonEmptyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service("deployJsonServiceBap")
public class TransactionDeployJsonServiceBap extends TransactionDeployJsonEmptyService {

    @Autowired
    @Qualifier("BapInterfaceDeployService")
    private InterfaceDeployService interfaceDeployService;

    @Override
    public void insertInterfaceLoading(String path, String fileName) throws Exception {
        String json = load(path + fileName, "UTF-8");
        InterfaceDeploy interfaceDeploy = mapper.readValue(json, InterfaceDeploy.class);
        interfaceDeployService.saveDeploy(interfaceDeploy);
    }

}
