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

import com.eactive.eai.rms.bat.loader.intf.InterfaceDeployService;
import com.eactive.eai.rms.bat.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("deployJsonServiceBat")
public class TransactionDeployJsonServiceBat extends TransactionDeployJsonEmptyService {

    @Autowired @Qualifier("BatInterfaceDeployService")
    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);
    }

}
