package com.kbstar.eai.flowcontrol.action;

import com.eactive.eai.flowcontrol.action.RouteActionException;
import com.eactive.eai.flowcontrol.action.RouteActionSupport;
import com.eactive.eai.transformer.function.util.CodeConversion;

public class YGSRouteAction extends RouteActionSupport  {
	
	public String[] getRouteKeys(byte[] message) throws Exception {
		// 2009.07.13 정길영과장 요청
		//   - 출발지는 호스트, 목적지는 기관
		//   - Offset : 177, 자릿수 : 8자리 (Ex :50500337)
		   
		String[] keys = new String[1];
		int keyIndex = 0;
		
		byte[] keyBytes = new byte[8];
		try {
			System.arraycopy(message, 177, keyBytes, 0, 8);
			keys[0] = new String(CodeConversion.seToAsc(keyBytes));
		} catch(Exception e) {
			throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
		}
        return keys;        
	}
	
	public String getDescription() {
		return "키추출방식 : 전문 [117,8]";
	}
}
