package com.eactive.eai.agent.schedule;

import java.util.ArrayList;

import com.eactive.eai.agent.command.Command;
import com.eactive.eai.agent.command.CommandException;
import com.eactive.eai.batch.scheduler.ScheduleBasisManager;
import com.eactive.eai.common.util.Logger;
/**
* 1. 기능
* 2. 처리 개요
* 3. 주의사항
*
* @author
* @version  v 1.0.0
* @see : 관련 기능을 참조
* @since
*/

public class GetScheduleBasisListCommand extends Command
{

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
    * 1. 기능   GetScheduleBasisListCommand 생성자
    * 2. 처리 개요
    * 3. 주의사항
    *
    **/
    public GetScheduleBasisListCommand(String name) {
    	super(name);
    }

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

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

    	ArrayList<String> holicodes = null;
    	
    	String day = (String)args;
    	if ( day.length() >0){
    		holicodes = ScheduleBasisManager.getInstance().getIntervalTypes( day );	
    	}else{
    		return null;
    	}
    	String[] arr = new String[holicodes.size()];
    	for ( int inx = 0; inx < holicodes.size(); inx++){
    		arr[inx] = holicodes.get(inx);
    	}
    	return arr;
    }

}
