package com.eactive.eai.agent.transaction; 

import com.eactive.eai.agent.command.Command;
import com.eactive.eai.agent.command.CommandException;
import com.eactive.eai.common.util.Logger;

public class AdditionReportCommand extends Command
{ 
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);

    public AdditionReportCommand() {
        super("AdditionReportCommand");
    }

    public Object execute() throws CommandException
    {
        logger.info(this.name + " Agent 가 호출되었습니다.");

        if ( args == null || !(args instanceof String) ) {
            String msg = makeException("BECEAICAG001", null);
            logger.error(msg);
            throw new CommandException(msg);
        }

        try {
			String sendData = ((String)args).substring(4);
			logger.debug(this.name + "- 받은 데이터 : \n["+sendData+"]");
			
			String result = com.eactive.eai.batch.bokex.BOKEXAddTelegramManager.getInstance().doTelegram(sendData);
			logger.debug(this.name + "- 되돌려 주는  데이터 : \n["+result+"]");
			logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");

			return "0000" + result;
        } catch (Exception ex) {
            String msg = makeException("BECEAICAG002", ex);
            logger.error(msg, ex);
            throw new CommandException(msg);
        }
        
    }
 
} 
