This commit is contained in:
Rinjae
2025-09-05 18:57:45 +09:00
commit aacc1a389e
1229 changed files with 167963 additions and 0 deletions
@@ -0,0 +1,101 @@
package com.kbstar.eai.common.businessday;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.data.entity.onl.businessday.BusinessDay;
import com.eactive.eai.data.entity.onl.businessday.BusinessDayEvent;
import com.eactive.eai.data.entity.onl.businessday.BusinessDayEventLog;
import com.eactive.eai.data.entity.onl.businessday.BusinessDayEventLogId;
import com.kbstar.eai.common.businessday.loader.BusinessDayEventLoader;
import com.kbstar.eai.common.businessday.loader.BusinessDayEventLogLogger;
import com.kbstar.eai.common.businessday.loader.BusinessDayLoader;
import com.kbstar.eai.common.businessday.mapper.BusinessDayEventMapper;
import com.kbstar.eai.common.businessday.mapper.BusinessDayMapper;
@Service
@Transactional
public class BusinessDayDAO extends BaseDAO {
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
@Autowired
private BusinessDayLoader businessDayLoader;
@Autowired
private BusinessDayMapper businessDayMapper;
@Autowired
private BusinessDayEventLoader businessDayEventLoader;
@Autowired
private BusinessDayEventMapper businessDayEventMapper;
@Autowired
private BusinessDayEventLogLogger businessDayEventLogLogger;
// 일자전환 변경대상목록 정보 전체 조회
public Map<String, BusinessDayVO> getAllMessages() throws DAOException {
try {
List<BusinessDay> businessDays = businessDayLoader.findAll();
Map<String, BusinessDayVO> businessDayMap = new HashMap<>();
logger.info("[ @@ getAllMessages Configuration - starting >>>>>>>>>>>>>>>>> ]");
for (BusinessDay businessDay : businessDays) {
BusinessDayVO vo = businessDayMapper.toVo(businessDay);
businessDayMap.put(vo.getEAISvcName(), vo);
logger.info("@ " + vo.toString());
}
logger.info("[>>getAllMessages Configuration - ended ]");
return businessDayMap;
} catch (Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICIM101"));
}
}
public Map<String, EventSystemInfoVO> getEventSystemInfo() throws DAOException {
try {
List<BusinessDayEvent> businessDayEvents = businessDayEventLoader.findAll();
Map<String, EventSystemInfoVO> businessDayEventMap = new HashMap<>();
logger.info("[ @@ getAllMessages Configuration - starting >>>>>>>>>>>>>>>>> ]");
for (BusinessDayEvent businessDayEvent : businessDayEvents) {
EventSystemInfoVO vo = businessDayEventMapper.toVo(businessDayEvent);
businessDayEventMap.put(vo.getEvntRecvSysName(), vo);
logger.info("@ " + vo.toString());
}
logger.info("[>>getAllMessages Configuration - ended ]");
return businessDayEventMap;
} catch (Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICIM101"));
}
}
public void addEventLog(String evntRecvSysName, String eAIEvntDstcd, String evntSendYMS,
String evntPrcssRsultDpstYMS, String prcssRsultYn) throws DAOException {
try {
BusinessDayEventLog entity = new BusinessDayEventLog();
BusinessDayEventLogId id = new BusinessDayEventLogId();
id.setEaievntdstcd(eAIEvntDstcd);
id.setEvntrecvsysname(evntRecvSysName);
id.setEvntsendyms(evntSendYMS);
entity.setId(id);
entity.setEvntprcssrsultdpstyms(evntPrcssRsultDpstYMS);
entity.setPrcssrsultyn(prcssRsultYn);
businessDayEventLogLogger.save(entity);
} catch (Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e, "RECEAICBM102"));
}
}
}
@@ -0,0 +1,114 @@
package com.kbstar.eai.common.businessday;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.lifecycle.Lifecycle;
import com.eactive.eai.common.lifecycle.LifecycleException;
import com.eactive.eai.common.lifecycle.LifecycleListener;
import com.eactive.eai.common.lifecycle.LifecycleSupport;
import com.eactive.eai.common.util.ApplicationContextProvider;
import com.eactive.eai.common.util.Logger;
// 일자전환 변경대상목록 정보를 DB로 부터 로딩해 메모리에 관리
@Component
public class BusinessDayManager implements Lifecycle {
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
@Autowired
private BusinessDayDAO businessDayDAO;
private Map<String, BusinessDayVO> messages;
private LifecycleSupport lifecycle = new LifecycleSupport(this);
private boolean started;
public static BusinessDayManager getInstance() {
return ApplicationContextProvider.getContext().getBean(BusinessDayManager.class);
}
public void start() throws LifecycleException {
if (started)
throw new LifecycleException("RECEAICIM201");
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
messages = null;
try {
init();
} catch (Exception e) {
throw new LifecycleException(ExceptionUtil.getErrorCode(e, "RECEAICIM202"));
}
started = true;
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
}
private void init() throws Exception {
messages = businessDayDAO.getAllMessages();
}
public synchronized void reload() throws Exception {
if (logger.isWarn()) {
logger.warn("BusinessDayManager] reload all Started ...");
}
init();
if (logger.isWarn()) {
logger.warn("BusinessDayManager] reload all finished ...");
}
}
public void stop() throws LifecycleException {
if (!started)
throw new LifecycleException("RECEAICIM203");
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
messages.clear();
started = false;
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
}
public void addLifecycleListener(LifecycleListener listener) {
lifecycle.addLifecycleListener(listener);
}
public LifecycleListener[] findLifecycleListeners() {
return lifecycle.findLifecycleListeners();
}
public void removeLifecycleListener(LifecycleListener listener) {
lifecycle.removeLifecycleListener(listener);
}
public boolean isStarted() {
return this.started;
}
public BusinessDayVO getMessageVO(String eAISvcName) {
if (eAISvcName == null)
return null;
return messages.get(eAISvcName);
}
public void setMessage(String eAISvcName, BusinessDayVO vo) {
messages.put(eAISvcName, vo);
}
public void setMessage(BusinessDayVO vo) {
messages.put(vo.getEAISvcName(), vo);
}
public void removeMessage(String eAISvcName) {
messages.remove(eAISvcName);
}
public Map<String, BusinessDayVO> getAllBusinessDays() {
return this.messages;
}
public String[] getAllCodes() {
return messages.keySet().toArray(new String[0]);
}
}
@@ -0,0 +1,54 @@
package com.kbstar.eai.common.businessday;
import java.io.Serializable;
import com.eactive.eai.common.util.NullControl;
/**
* 1. 기능 : 일자전환변경대상목록 Java Value Object 클래스.
* 2. 처리 개요 : 일자전환변경대상목록 정보에 대한 Java Value Object 클래스.
* 3. 주의사항
*
* @author : 이동훈
* @version : v 1.0.0
* @see : BusinessDayDAO, BusinessDayManager
* @since :
* :
*/
public class BusinessDayVO implements Serializable
{
/**
* EAI서비스명
*/
private String eAISvcName;
/**
* 전문유효일자
*/
private String telgmValdYmd;
public String getEAISvcName() {
return eAISvcName;
}
public void setEAISvcName(String svcName) {
eAISvcName = svcName;
}
public String getTelgmValdYmd() {
return telgmValdYmd;
}
public void setTelgmValdYmd(String telgmValdYmd) {
this.telgmValdYmd = telgmValdYmd;
}
public BusinessDayVO(String eAISvcName) {
this.eAISvcName = eAISvcName;
}
public BusinessDayVO() {
}
}
@@ -0,0 +1,70 @@
package com.kbstar.eai.common.businessday;
import java.io.Serializable;
import com.eactive.eai.common.util.NullControl;
/**
* 1. 기능 : 일자전환변경대상목록 Java Value Object 클래스.
* 2. 처리 개요 : 일자전환변경대상목록 정보에 대한 Java Value Object 클래스.
* 3. 주의사항
*
* @author : 이동훈
* @version : v 1.0.0
* @see :
* @since :
* :
*/
public class EventSystemInfoVO implements Serializable
{
/**
* 이벤트수신시스템명
*/
private String evntRecvSysName;
/**
* 어댑터업무그룹명
*/
private String adptrBzwkGroupName;
/**
* EAI이벤트처리구분코드
*/
private String eAIEvntPrcssDstcd;
public EventSystemInfoVO() {
}
public String getAdptrBzwkGroupName() {
return adptrBzwkGroupName;
}
public void setAdptrBzwkGroupName(String adptrBzwkGroupName) {
this.adptrBzwkGroupName = adptrBzwkGroupName;
}
public String getEAIEvntPrcssDstcd() {
return eAIEvntPrcssDstcd;
}
public void setEAIEvntPrcssDstcd(String evntPrcssDstcd) {
eAIEvntPrcssDstcd = evntPrcssDstcd;
}
public String getEvntRecvSysName() {
return evntRecvSysName;
}
public void setEvntRecvSysName(String evntRecvSysName) {
this.evntRecvSysName = evntRecvSysName;
}
}
@@ -0,0 +1,19 @@
package com.kbstar.eai.common.businessday.mapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import com.eactive.eai.data.entity.onl.businessday.BusinessDayEvent;
import com.eactive.eai.data.mapper.GenericMapper;
import com.kbstar.eai.common.businessday.BusinessDayVO;
import com.kbstar.eai.common.businessday.EventSystemInfoVO;
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface BusinessDayEventMapper extends GenericMapper<EventSystemInfoVO, BusinessDayEvent> {
@Mapping(source = "evntrecvsysname", target = "evntRecvSysName")
@Mapping(source = "adptrbzwkgroupname", target = "adptrBzwkGroupName")
@Mapping(source = "eaievntprcssdstcd", target = "EAIEvntPrcssDstcd")
@Override
EventSystemInfoVO toVo(BusinessDayEvent entity);
}
@@ -0,0 +1,23 @@
package com.kbstar.eai.common.businessday.mapper;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import com.eactive.eai.common.routing.RoutingVO;
import com.eactive.eai.data.entity.onl.businessday.BusinessDay;
import com.eactive.eai.data.entity.onl.routing.Routing;
import com.eactive.eai.data.mapper.GenericMapper;
import com.kbstar.eai.common.businessday.BusinessDayVO;
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface BusinessDayMapper extends GenericMapper<BusinessDayVO, BusinessDay> {
@Mapping(source = "id", target = "EAISvcName")
@Mapping(source = "splizvaldymd", target = "telgmValdYmd")
@Override
BusinessDayVO toVo(BusinessDay entity);
@InheritInverseConfiguration
BusinessDay toEntity(BusinessDayVO vo);
}
@@ -0,0 +1,46 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
import com.eactive.eai.transformer.util.IConv;
/**
* 1. 기능 : ASCII를 EBCDIC Single로 변환하는 Class
* 2. 처리 개요 :
* - 추가시에만 기능처리
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class A2EHexaHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 0; //
public A2EHexaHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
byte[] full = null;
full = IConv.asciiHexaToEBCDICHexa(message);
return full;
}
// public static void main(String args[]) throws Exception {
// String actionName = "com.kbstar.eai.common.header.A2EHexaHeaderAction";
// }
}
@@ -0,0 +1,158 @@
package com.kbstar.eai.common.header;
import java.util.Arrays;
import com.eactive.eai.common.header.HeaderActionSupport;
/**
* 1. 기능 : ARS공동망 의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class ARSHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 7; // 공동망 헤더Length
public ARSHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
byte[] full = null;
full = new byte[HEADER_LENGTH+message.length];
byte [] header = new byte[HEADER_LENGTH];
byte[] hdr = {'H', 'D', 'R'};
System.arraycopy(hdr, 0, header, 4, 3);
//
System.arraycopy(header, 0, full, 0, HEADER_LENGTH );
System.arraycopy(message, 0, full, HEADER_LENGTH, message.length);
// 전체 전문길이 계산
byte len[] = Integer.toString( message.length +3 ).getBytes();
//길이값 '0'으로 셋팅
Arrays.fill(full, 0, 4, (byte)'0');
//길이값 value 셋팅
System.arraycopy(len, 0, full, 4 - len.length, len.length);
return full;
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.ARSHeaderAction";
/////전송 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0013HDR1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// //orgData = new byte[((byte[])bizObj).length ];
// //System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
//
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
///////////////////////////////////////////
/////전송 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0013HDR1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte[((byte[])bizObj).length ];
// System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte["0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes().length ];
// System.arraycopy("0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes(), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
/////////////////////////////////////////
//
//
// }
}
@@ -0,0 +1,63 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
/**
* 1. 기능 : ARS공동망 의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class BBGHeaderAction extends HeaderActionSupport
{
//BBGHeaderAction - 앞에서부터 15바이트 삭제만
private static final int HEADER_LENGTH = 15;
public BBGHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
// 2009.10.06 정길영과장 요청 : 앞에 space 추가 15자리
public byte[] addHeader(byte[] orgData , byte[] message ) {
byte[] full = null;
full = new byte[HEADER_LENGTH+message.length];
byte [] header = new byte[HEADER_LENGTH];
for(int i=0;i<HEADER_LENGTH; i++) {
header[i] = (byte)0x20;
}
System.arraycopy(header, 0, full, 0, HEADER_LENGTH );
System.arraycopy(message, 0, full, HEADER_LENGTH, message.length);
return full;
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.BBGHeaderAction";
// BBGHeaderAction action = new BBGHeaderAction();
// byte[] res = action.addHeader("12345".getBytes(), "12345".getBytes());
// System.out.println( new String(res) );
// }
}
@@ -0,0 +1,138 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
/**
* 1. 기능 : CSSKIS의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class CSSKISHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 6;
public CSSKISHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
String header = "2C0003";
int headerLength = header.length();
int msgLength = message.length + headerLength;
byte[] retHeader = new byte[msgLength];
System.arraycopy(header.getBytes(), 0, retHeader, 0, headerLength);
System.arraycopy(message, 0, retHeader, headerLength, retHeader.length-headerLength);
return retHeader;
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.CSSKISHeaderAction";
//
//
// /////전송 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0013HDR1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// //orgData = new byte[((byte[])bizObj).length ];
// //System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
//
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
///////////////////////////////////////////
/////전송 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0013HDR1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte[((byte[])bizObj).length ];
// System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte["0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes().length ];
// System.arraycopy("0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes(), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
// }
}
@@ -0,0 +1,137 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderAction;
import com.eactive.eai.common.header.HeaderActionFactory;
import com.eactive.eai.common.header.HeaderActionKeys;
import com.eactive.eai.common.header.HeaderActionSupport;
/**
* 1. 기능 : CSSLOAN(여신임대차 조회) 의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class CSSLOANHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 0;
public CSSLOANHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
String header = "1S0004";
int headerLength = header.length();
int msgLength = message.length + headerLength;
byte[] retHeader = new byte[msgLength];
System.arraycopy(header.getBytes(), 0, retHeader, 0, headerLength);
System.arraycopy(message, 0, retHeader, headerLength, retHeader.length-headerLength);
return retHeader;
}
// public static void main(String args[]) throws Exception {
// String actionName = "com.kbstar.eai.common.header.CSSLOANHeaderAction";
//
//
// /////전송 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0013HDR1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// //orgData = new byte[((byte[])bizObj).length ];
// //System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
//
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
///////////////////////////////////////////
/////전송 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0013HDR1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte[((byte[])bizObj).length ];
// System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte["0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes().length ];
// System.arraycopy("0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes(), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
///////////////////////////////////////////
// }
}
@@ -0,0 +1,110 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
import com.eactive.eai.common.util.DatetimeUtil;
import com.eactive.eai.common.util.StringUtil;
/**
* 1. 기능 : 연계기관 의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class CYUHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 30; // 연계 - 기관간의 헤더Length
// private static int mCount = 0;
public CYUHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message ) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message ) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
String tranOccurPath = "E"; // 거래발생 경로(1)
String serverName = "EAISVR1"; // 서버이름(7)
String sysMinHMSUnit = ""; // 거래시간(12)
String tranSysDstcd = "1"; // 거래처리시스템 구분(1)
String tranLogRecrdEonot = "2"; // 거래log Dump 기록유무(1)
String Blnk0 = " "; // Filler (8)
int msgLength = message.length + HEADER_LENGTH;
sysMinHMSUnit = StringUtil.stringFormat(DatetimeUtil.getFormattedDate("HHmmssSSS"), false, ' ', 12);
StringBuffer sb = new StringBuffer(30);
sb.append(tranOccurPath);
sb.append(serverName);
sb.append(sysMinHMSUnit);
sb.append(tranSysDstcd);
sb.append(tranLogRecrdEonot);
sb.append(Blnk0);
byte[] retHeader = new byte[msgLength];
System.arraycopy(sb.toString().getBytes(), 0, retHeader, 0, HEADER_LENGTH);
System.arraycopy(message, 0, retHeader, HEADER_LENGTH, retHeader.length-HEADER_LENGTH);
return retHeader;
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.CYUHeaderAction";
//
//
// /////전송 AD
//// HeaderAction action = HeaderActionFactory.createAction(actionName);
////
//// Object[] bizObjs =new Object[1];
//// bizObjs[0] = "1234567890".getBytes();
//// Object bizObj = null;
//// if(bizObjs != null && bizObjs.length > 0) {
//// bizObj = bizObjs[0];
//// }
//// byte[] orgData = null;
//// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
//// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
//// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
//// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
//// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.ADD_DELETE_HEADER);
//// System.out.println("header=>"+new String(header));
// /////////////
//
// /////수신 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "EEAISVR1135201896 12 1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// //orgData = new byte[((byte[])bizObj).length ];
// //System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
//
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
// }
}
@@ -0,0 +1,51 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
import com.eactive.eai.transformer.util.IConv;
/**
* 1. 기능 : EBCDIC을 ASCII Single로 변환하는 Class
* 2. 처리 개요 :
* - 추가시에만 기능처리
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class E2AHexaHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 0; //
public E2AHexaHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
byte[] full = null;
full = IConv.ebcdicHexaToASCIIHexa(message);
return full;
}
// public static void main(String args[]) throws Exception {
// String actionName = "com.kbstar.eai.common.header.E2AHexaHeaderAction";
//
//
//
//
//
// }
}
@@ -0,0 +1,130 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
/**
* 1. 기능 : CSSLOAN(여신임대차 조회) 의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class HOSTKISHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 0;
public HOSTKISHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
byte[] header = {(byte)0xC8,(byte)0xE2,(byte)0xD7}; // "HSP"
int headerLength = header.length;
int msgLength = message.length + headerLength;
byte[] retHeader = new byte[msgLength];
System.arraycopy(header, 0, retHeader, 0, headerLength);
System.arraycopy(message, 0, retHeader, headerLength, retHeader.length-headerLength);
return retHeader;
}
// public static void main(String args[]) throws Exception {
// test();
// }
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.HOSTKISHeaderAction";
//
// /////전송 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
/////수신 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0013HDR1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// //orgData = new byte[((byte[])bizObj).length ];
// //System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
//
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
/////전송 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0013HDR1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte[((byte[])bizObj).length ];
// System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte["0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes().length ];
// System.arraycopy("0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes(), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
// }
}
@@ -0,0 +1,64 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
import com.eactive.eai.transformer.util.IConv;
/**
* 1. 기능 : ASCII를 EBCDIC Single로 변환하는 Class
* 2. 처리 개요 :
* - 추가시에만 기능처리
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class InterBankA2EHexaHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 0; //
public InterBankA2EHexaHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
byte[] full = null;
int hostMessageSize = 700;
full = IConv.asciiHexaToEBCDICHexa(message);
//-----------------------------------
// 500 bytes 로 Host Space(0x40) Padding 하여 전달
//-----------------------------------
if(orgData.length < hostMessageSize) {
byte[] ebcdic = new byte[hostMessageSize];
System.arraycopy(full , 0, ebcdic, 0, full.length);
for(int i=full.length; i<hostMessageSize; i++) {
ebcdic[i] = (byte)0x40;
}
return ebcdic;
}
else {
return full;
}
}
// public static void main(String args[]) throws Exception {
// String actionName = "com.kbstar.eai.common.header.InterBankA2EHexaHeaderAction";
// }
}
@@ -0,0 +1,74 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
import com.eactive.eai.transformer.util.IConv;
/**
* 1. 기능 : EBCDIC을 ASCII Single로 변환하는 Class
* 2. 처리 개요 :
* - 추가시에만 기능처리
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class InterBankE2AHexaHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 0; //
public InterBankE2AHexaHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
byte[] full = null;
full = IConv.ebcdicHexaToASCIIHexa(message);
byte[] lengthBytes = new byte[4];
System.arraycopy(full, 0, lengthBytes, 0, lengthBytes.length);
// String llStr = new String(lengthBytes);
int ll = 0;
ll = Integer.parseInt(new String(lengthBytes));
//-----------------------------------
// LL + DATA + FILLER
// LL : DATA Length
// 변환 후 (LL + DATA) 전달
//-----------------------------------
if( ll > 0 && ll <= (full.length - lengthBytes.length) ) {
byte[] ascii = new byte[ll + lengthBytes.length];
System.arraycopy(full, 0, ascii, 0, ascii.length);
return ascii;
}
else {
return full;
}
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.InterBankE2AHexaHeaderAction";
// }
}
@@ -0,0 +1,171 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderAction;
import com.eactive.eai.common.header.HeaderActionFactory;
import com.eactive.eai.common.header.HeaderActionKeys;
import com.eactive.eai.common.header.HeaderActionSupport;
/**
* 1. 기능 : KB신용정보업무의 HEADER 와 CAP 매핑을 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 HEADER->CAP, R 는 CAP -> HEADER
* - DA 의 경우는 S는 CAP -> HEADER, R 는 HEADER->CAP
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class KBSHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 62; // 기관간의 헤더Length
private static final int CAP_LENGTH = 80; // HOST CAP 헤더Length
public KBSHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message ) {
return headerToCap(message);
}
public byte[] deleteHeaderAD(byte[] message, int headerLength) {
return capToHeader(message);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message ) {
return capToHeader(message);
}
public byte[] deleteHeaderDA(byte[] message, int headerLength) {
return headerToCap(message);
}
public byte[] headerToCap(byte[] message) {
int msg_size = message.length - HEADER_LENGTH + CAP_LENGTH;
byte[] retHeader = new byte[msg_size];
byte[] capHeader = new byte[CAP_LENGTH];
//--------------------------------------------
/*
host_msg.trx_code ':=' kb_msg.tran_code for 8 bytes;
host_msg.filler1 ':=' [%H40];
host_msg.io_meche ':=' [%HE3];
host_msg.brno ':=' [%HF2,%HF5,%HF2,%HF7];
host_msg.brno_sub ':=' [%HF0,%HF0,%HF0];
host_msg.term_no ':=' kb_msg.term_no for 3 bytes;
host_msg.term_code ':=' kb_msg.term_code for 2 bytes;
host_msg.serl_no ':=' kb_msg.serl_no for 4 bytes;
host_msg.gsbr ':=' msg_text[62] for 4 bytes;
host_msg.gsbr_sub ':=' [%HF0,%HF0,%HF0];
host_msg.appl_code ':=' kb_msg.upmu_code for 2 bytes;
host_msg.input_code ':=' kb_msg.input_code for 4 bytes;
host_msg.operator ':=' kb_msg.op_no for 4 bytes;
host_msg.stats_flag ':=' kb_msg.flag_code for 4 bytes;
host_msg.resv_no ':=' [%HF0,%HF0];
host_msg.pf_key ':=' kb_msg.pf_key for 1 bytes;
host_msg.user_head ':=' kb_msg.user_head for 30 bytes;
*/
System.arraycopy(message, 0, capHeader, 0, 8);
capHeader[ 8] = (byte)0x40;
capHeader[ 9] = (byte)0xE3;
capHeader[10] = (byte)0xF2;
capHeader[11] = (byte)0xF5;
capHeader[12] = (byte)0xF2;
capHeader[13] = (byte)0xF7;
capHeader[14] = (byte)0xF0;
capHeader[15] = (byte)0xF0;
capHeader[16] = (byte)0xF0;
System.arraycopy(message, 8, capHeader, 17, 3);
System.arraycopy(message, 11, capHeader, 20, 2);
System.arraycopy(message, 13, capHeader, 22, 4);
System.arraycopy(message, 62, capHeader, 26, 4);
capHeader[30] = (byte)0xF0;
capHeader[31] = (byte)0xF0;
capHeader[32] = (byte)0xF0;
System.arraycopy(message, 17, capHeader, 33, 2);
System.arraycopy(message, 19, capHeader, 35, 4);
System.arraycopy(message, 23, capHeader, 39, 4);
System.arraycopy(message, 27, capHeader, 43, 4);
capHeader[47] = (byte)0xF0;
capHeader[48] = (byte)0xF0;
System.arraycopy(message, 31, capHeader, 49, 1);
System.arraycopy(message, 32, capHeader, 50,30);
//--------------------------------------------
System.arraycopy(capHeader, 0, retHeader, 0, CAP_LENGTH);
System.arraycopy(message, HEADER_LENGTH, retHeader, CAP_LENGTH, message.length - HEADER_LENGTH);
return retHeader;
}
public byte[] capToHeader(byte[] message) {
int msg_size = message.length + HEADER_LENGTH - CAP_LENGTH;
byte[] retHeader = new byte[msg_size];
byte[] header = new byte[HEADER_LENGTH];
//--------------------------------------------
/*
kb_msg.tran_code ':=' host_msg.trx_code for 8 bytes;
kb_msg.term_no ':=' host_msg.term_no for 3 bytes;
kb_msg.term_code ':=' host_msg.term_code for 2 bytes;
kb_msg.serl_no ':=' host_msg.serl_no for 4 bytes;
kb_msg.upmu_code ':=' host_msg.appl_code for 2 bytes;
kb_msg.input_code ':=' host_msg.input_code for 4 bytes;
kb_msg.op_no ':=' host_msg.operator for 4 bytes;
kb_msg.flag_code ':=' host_msg.stats_flag for 4 bytes;
kb_msg.pf_key ':=' host_msg.pf_key for 1 bytes;
kb_msg.user_head ':=' host_msg.user_head for 30 bytes;
*/
System.arraycopy(message, 0, header, 0, 8);
System.arraycopy(message, 17, header, 8, 3);
System.arraycopy(message, 20, header, 11, 2);
System.arraycopy(message, 22, header, 13, 4);
System.arraycopy(message, 33, header, 17, 2);
System.arraycopy(message, 35, header, 19, 4);
System.arraycopy(message, 39, header, 23, 4);
System.arraycopy(message, 43, header, 27, 4);
System.arraycopy(message, 49, header, 31, 1);
System.arraycopy(message, 50, header, 32, 30);
//--------------------------------------------
System.arraycopy(header, 0, retHeader, 0, HEADER_LENGTH);
System.arraycopy(message, CAP_LENGTH, retHeader, HEADER_LENGTH, message.length - CAP_LENGTH);
return retHeader;
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.KBSHeaderAction";
//
//
// /////전송 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
// }
}
@@ -0,0 +1,188 @@
package com.kbstar.eai.common.header;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import com.eactive.eai.common.header.HeaderActionSupport;
//import com.kbstar.b2bgw.base.Utillity;
/**
* 1. 기능 : 연계기관 의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class KSHINBOHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 100; // B2B 헤더Length
public KSHINBOHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message ) {
byte[] header = new byte[HEADER_LENGTH];
byte[] full = null;
full = new byte[HEADER_LENGTH + message.length];
byte[] body = message;
System.arraycopy(orgData, 0, header, 0, HEADER_LENGTH);
//전문 총길이를 헤더에 8byte로 추가
// byte[] msgSize = Utillity.fillZero(Integer.toString(full.length), 8).getBytes();
// System.arraycopy(msgSize, 0, header, 0, 8);
byte[] RES_CODE = "0000".getBytes();
System.arraycopy(RES_CODE, 0, header, 8, 4);
byte[] SYSTEM_ID = "BLS".getBytes();
System.arraycopy(SYSTEM_ID, 0, header, 12, 3);
byte[] FLOW_ID = "01".getBytes();
System.arraycopy(FLOW_ID, 0, header, 25, 2);
String tmpSERVICE_CODE = "";
try
{
//DB 삭제(2008.12.3)
tmpSERVICE_CODE = "DD" + new String(body, 19, 4);
}catch(Exception ex){
tmpSERVICE_CODE = "DD????";
}
byte[] SERVICE_CODE = tmpSERVICE_CODE.getBytes();
System.arraycopy(SERVICE_CODE, 0, header, 27, 6);
byte[] IO = "2".getBytes();
System.arraycopy(IO, 0, header, 33, 1);
byte[] FORMAT_ID = "01".getBytes();
System.arraycopy(FORMAT_ID, 0, header, 34, 2);
byte[] USER_ID = "WAPUSER".getBytes();
System.arraycopy(USER_ID, 0, header, 46, USER_ID.length);
byte[] CERT = "0".getBytes();
System.arraycopy(CERT, 0, header, 54, 1);
String tmpIP = "";
try{
tmpIP = InetAddress.getByName("www.shinbo.co.kr").getHostAddress();
}
catch(UnknownHostException exHost){
//tmpIP = "shinbo";
tmpIP = "210.96.165.5";
}
byte[] IP = tmpIP.getBytes();
System.arraycopy(IP, 0, header, 55, IP.length);
/*
byte[] LANG = "1".getBytes();
System.arraycopy(LANG, 0, header, 77, 1);
*/
// String tmpTRAN_DATE = Utillity.getDateStamp();
// byte[] TRAN_DATE = tmpTRAN_DATE.getBytes();
// System.arraycopy(TRAN_DATE, 0, header, 78, TRAN_DATE.length);
/*
String tmpTRAN_SEQ = "SB"+Utillity.fillZero(Long.toString(new Object().hashCode()), 6);
byte[] TRAN_SEQ = tmpTRAN_SEQ.getBytes();
System.arraycopy(TRAN_SEQ, 0, header, 86, TRAN_SEQ.length);
*/
System.arraycopy(header, 0, full, 0, HEADER_LENGTH );
System.arraycopy(message, 0, full, HEADER_LENGTH, body.length );
return full;
}
public byte[] addHeaderAD(byte[] orgData , byte[] message ) {
byte[] header = new byte[HEADER_LENGTH];
byte[] full = null;
int bodySize = message.length - 15;
//15 byte Skip - 받은 메시지 중에 15byte는 Skip하여 처리한다.
full = new byte[HEADER_LENGTH + bodySize];
byte[] bodyMsg = new byte[bodySize];
System.arraycopy(message, 15, bodyMsg, 0, bodySize);
byte[] body = bodyMsg;
//Header에 화이트 스페이스 초기화
Arrays.fill(header, 0, HEADER_LENGTH, (byte)' ');
//전문 총길이를 헤더에 8byte로 추가
// byte[] msgSize = Utillity.fillZero(Integer.toString(full.length), 8).getBytes();
// System.arraycopy(msgSize, 0, header, 0, 8);
byte[] RES_CODE = "0000".getBytes();
System.arraycopy(RES_CODE, 0, header, 8, 4);
byte[] SYSTEM_ID = "BLS".getBytes();
System.arraycopy(SYSTEM_ID, 0, header, 12, 3);
byte[] FLOW_ID = "01".getBytes();
System.arraycopy(FLOW_ID, 0, header, 25, 2);
String tmpSERVICE_CODE = "";
try
{
//DB 삭제(2008.12.3)
tmpSERVICE_CODE = "DD" + new String(body, 19, 4);
}catch(Exception ex){
tmpSERVICE_CODE = "DD????";
}
byte[] SERVICE_CODE = tmpSERVICE_CODE.getBytes();
System.arraycopy(SERVICE_CODE, 0, header, 27, 6);
byte[] IO = "1".getBytes();
System.arraycopy(IO, 0, header, 33, 1);
byte[] FORMAT_ID = "01".getBytes();
System.arraycopy(FORMAT_ID, 0, header, 34, 2);
byte[] USER_ID = "WAPUSER".getBytes();
System.arraycopy(USER_ID, 0, header, 46, USER_ID.length);
byte[] CERT = "0".getBytes();
System.arraycopy(CERT, 0, header, 54, 1);
String tmpIP = "";
try{
tmpIP = InetAddress.getByName("www.shinbo.co.kr").getHostAddress();
}
catch(UnknownHostException exHost){
tmpIP = "shinbo";
}
byte[] IP = tmpIP.getBytes();
System.arraycopy(IP, 0, header, 55, IP.length);
/*
byte[] LANG = "1".getBytes();
System.arraycopy(LANG, 0, header, 77, 1);
*/
// String tmpTRAN_DATE = Utillity.getDateStamp();
// byte[] TRAN_DATE = tmpTRAN_DATE.getBytes();
// System.arraycopy(TRAN_DATE, 0, header, 78, TRAN_DATE.length);
//IB.최진원대리,이민욱대리요청(2008.11.27) SB --> GB
// String tmpTRAN_SEQ = "GB"+Utillity.fillZero(Long.toString(new Object().hashCode()), 6);
// byte[] TRAN_SEQ = tmpTRAN_SEQ.getBytes();
// System.arraycopy(TRAN_SEQ, 0, header, 86, TRAN_SEQ.length);
System.arraycopy(header, 0, full, 0, HEADER_LENGTH );
System.arraycopy(bodyMsg, 0, full, HEADER_LENGTH, body.length );
// System.out.println("full][" +new String(full)+ "]");
return full;
}
public byte[] deleteHeaderAD(byte[] message, int headerLength) {
int msgLength = message.length - headerLength;
//원 전문(요청전문-업무)에서 앞 15byte를 skip하고 호스트에 데이타를 전송하게 되면
//응답 전문 또한 15byte를 추가하여 응답으로 전송하게 된다.
//이에 15byte를 추가하는 부분
int TMP_HEADER_SIZE = 15; // 15byte 크기 확보
if(msgLength > 0) {
byte[] retHeader = new byte[msgLength+TMP_HEADER_SIZE];
byte[] tmpHeader = new byte[TMP_HEADER_SIZE];
tmpHeader = " ".getBytes();
System.arraycopy(tmpHeader, 0, retHeader, 0, TMP_HEADER_SIZE);
System.arraycopy(message, headerLength, retHeader, 15, msgLength);
return retHeader;
}else {
return message;
}
}
}
@@ -0,0 +1,92 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
/**
* 1. 기능 : OTP 서버의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class OTPHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 19; // OTP - > HOST 서버간의 헤더Length
private static final int OPT_HEADER_LENGTH = 10; // HOST -> OTP 서버간의 헤더Length
public OTPHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message ) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message ) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
int msgLength = message.length + OPT_HEADER_LENGTH;
String otpHeader = "OPT ";
byte[] retHeader = new byte[msgLength];
System.arraycopy(otpHeader.getBytes(), 0, retHeader, 0, OPT_HEADER_LENGTH);
System.arraycopy(message, 0, retHeader, OPT_HEADER_LENGTH, retHeader.length-OPT_HEADER_LENGTH);
return retHeader;
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.OTPHeaderAction";
/////전송 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "EEAISVR1135201896 12 1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// //orgData = new byte[((byte[])bizObj).length ];
// //System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
//
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
// }
}
@@ -0,0 +1,71 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
import com.eactive.eai.common.util.CommonLib;
import com.eactive.eai.transformer.util.IConv;
/**
* 1. 기능 : ASCII를 EBCDIC Single로 변환하는 Class
* 2. 처리 개요 :
* - 추가시에만 기능처리
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class POSCOA2EHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 0; //
public POSCOA2EHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
byte[] full = message;
byte[] header = null;
if(message.length > 52) {
header = new byte[52];
System.arraycopy(message, 0, header, 0, header.length);
header = IConv.asciiHexaToEBCDICHexa(header);
System.arraycopy(header, 0, full, 0, header.length);
return full;
}
else {
full = IConv.asciiHexaToEBCDICHexa(full);
return full;
}
}
// public static void main(String args[]) throws Exception {
// String actionName = "com.kbstar.eai.common.header.POSCOA2EHeaderAction";
//System.out.println(actionName);
// POSCOA2EHeaderAction action = new POSCOA2EHeaderAction();
// byte[] msg = "111111111111111111111111111111111111111111111111112233333".getBytes();
// byte[] res = action.addHeader(msg, msg);
//
// System.out.println(CommonLib.getDumpMessage(res));
//
// byte[] msg2 = "11111111111111111111111111111111111111111111111111".getBytes();
// byte[] res2 = action.addHeader(msg2, msg2);
//
// System.out.println(CommonLib.getDumpMessage(res2));
//
// }
}
@@ -0,0 +1,72 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
import com.eactive.eai.transformer.util.IConv;
/**
* 1. 기능 : ASCII를 EBCDIC Single로 변환하는 Class
* 2. 처리 개요 :
* - 추가시에만 기능처리
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class POSCOE2AHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 0; //
public POSCOE2AHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
byte[] full = message;
byte[] header = null;
if(message.length > 52) {
header = new byte[52];
System.arraycopy(message, 0, header, 0, header.length);
header = IConv.ebcdicHexaToASCIIHexa(header);
System.arraycopy(header, 0, full, 0, header.length);
return full;
}
else {
full = IConv.ebcdicHexaToASCIIHexa(full);
return full;
}
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.POSCOE2AHeaderAction";
//System.out.println(actionName);
// POSCOE2AHeaderAction action = new POSCOE2AHeaderAction();
// byte[] msg = "111111111111111111111111111111111111111111111111112233333".getBytes();
// byte[] res = action.addHeader(msg, msg);
//
// System.out.println(CommonLib.getDumpMessage(res));
//
// byte[] msg2 = "11111111111111111111111111111111111111111111111111".getBytes();
// byte[] res2 = action.addHeader(msg2, msg2);
//
// System.out.println(CommonLib.getDumpMessage(res2));
// }
}
@@ -0,0 +1,202 @@
package com.kbstar.eai.common.header;
import java.util.Arrays;
import com.eactive.eai.common.header.HeaderActionSupport;
import com.eactive.eai.common.util.DatetimeUtil;
/**
* 1. 기능 : 조달청 의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class PPSHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 100; // 조달청 헤더Length
private static int mCount = 0;
public PPSHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
private static int getIncMCount() {
if (mCount >= 99999){
mCount =0;
}
mCount++;
return mCount;
}
public byte[] addHeaderDA(byte[] orgData , byte[] message ) {
byte[] full = null;
byte[] reqMessage = null;
reqMessage = orgData;
full = new byte[HEADER_LENGTH+message.length];
byte [] header = new byte[HEADER_LENGTH];
System.arraycopy(reqMessage, 0, header, 0, HEADER_LENGTH );
//header 응답코드 변경
Arrays.fill(header, 38 , 42, (byte)'0'); //header = header.substring(0, 38) + "0000" + header.substring(42);
//
System.arraycopy(header, 0, full, 0, HEADER_LENGTH );
System.arraycopy(message, 0, full, HEADER_LENGTH, message.length);
// 전체 전문길이 계산
byte len[] = Integer.toString( full.length ).getBytes();
//길이값 '0'으로 셋팅
Arrays.fill(full, 0, 4, (byte)'0');
//길이값 value 셋팅
System.arraycopy(len, 0, full, 4 - len.length, len.length);
return full;
}
public byte[] addHeaderAD(byte[] orgData , byte[] message ) {
byte[] full = null;
full = new byte[HEADER_LENGTH + message.length];
byte[] body = message;
// 보안헤더
byte[] sec = new byte[HEADER_LENGTH];
Arrays.fill(sec, 0, HEADER_LENGTH, (byte)' ');
//길이 셋팅
byte[] length = Integer.toString(body.length + HEADER_LENGTH).getBytes();
Arrays.fill(sec, 0, 4, (byte)'0');
System.arraycopy(length, 0, sec, 4 - length.length, length.length);
byte[] date = DatetimeUtil.getCurrentDateTime().getBytes();
System.arraycopy(date, 0, sec, 4, 14);
byte[] seq = Integer.toString( PPSHeaderAction.getIncMCount() ).getBytes();
Arrays.fill(sec, 18, 30, (byte)'0');
System.arraycopy(seq, 0, sec, 30 - seq.length, seq.length);
byte[] m_type = {'0', '2', '0', '0'};
System.arraycopy(m_type, 0, sec, 30, 4);
byte[] t_code = {'X', '2', '0', '3'};
System.arraycopy(t_code, 0, sec, 34, 4);
byte[] c_code = {'1', '3', '7', '0', '1', '0', '0', '0'};
System.arraycopy(c_code, 0, sec, 42, 8);
byte[] i_code = {'0', '0', '0', '0', '2'};
System.arraycopy(i_code, 0, sec, 50, 5);
byte[] s_code = {'S', 'F', 'X', ' '};
System.arraycopy(s_code, 0, sec, 55, 4);
byte[] sr_type = {'1'};
System.arraycopy(sr_type, 0, sec, 68, 1);
System.arraycopy(sec,0,full,0,HEADER_LENGTH);
System.arraycopy(body,0,full,HEADER_LENGTH,body.length);
return full;
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.PPSHeaderAction";
/////전송 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// //orgData = new byte[((byte[])bizObj).length ];
// //System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
//
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
///////////////////////////////////////////
/////전송 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte[((byte[])bizObj).length ];
// System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte["0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes().length ];
// System.arraycopy("0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes(), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
// }
}
@@ -0,0 +1,178 @@
package com.kbstar.eai.common.header;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import com.eactive.eai.common.header.HeaderActionSupport;
//import com.kbstar.b2bgw.base.Utillity;
/**
* 1. 기능 : 연계기관 의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class SHINBOHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 100; // B2B 헤더Length
public SHINBOHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message ) {
byte[] header = new byte[HEADER_LENGTH];
byte[] full = null;
full = new byte[HEADER_LENGTH + message.length];
byte[] body = message;
System.arraycopy(orgData, 0, header, 0, HEADER_LENGTH);
//전문 총길이를 헤더에 8byte로 추가
// byte[] msgSize = Utillity.fillZero(Integer.toString(full.length), 8).getBytes();
// System.arraycopy(msgSize, 0, header, 0, 8);
byte[] RES_CODE = "0000".getBytes();
System.arraycopy(RES_CODE, 0, header, 8, 4);
byte[] SYSTEM_ID = "BLS".getBytes();
System.arraycopy(SYSTEM_ID, 0, header, 12, 3);
byte[] FLOW_ID = "01".getBytes();
System.arraycopy(FLOW_ID, 0, header, 25, 2);
String tmpSERVICE_CODE = "";
try
{
//DB 삭제(2008.12.3)
tmpSERVICE_CODE = "DD" + new String(body, 19, 4);
}catch(Exception ex){
tmpSERVICE_CODE = "DD????";
}
byte[] SERVICE_CODE = tmpSERVICE_CODE.getBytes();
System.arraycopy(SERVICE_CODE, 0, header, 27, 6);
byte[] IO = "2".getBytes();
System.arraycopy(IO, 0, header, 33, 1);
byte[] FORMAT_ID = "01".getBytes();
System.arraycopy(FORMAT_ID, 0, header, 34, 2);
byte[] USER_ID = "WAPUSER".getBytes();
System.arraycopy(USER_ID, 0, header, 46, USER_ID.length);
byte[] CERT = "0".getBytes();
System.arraycopy(CERT, 0, header, 54, 1);
String tmpIP = "";
try{
tmpIP = InetAddress.getByName("www.shinbo.co.kr").getHostAddress();
}
catch(UnknownHostException exHost){
//tmpIP = "shinbo";
tmpIP = "210.96.165.5";
}
byte[] IP = tmpIP.getBytes();
System.arraycopy(IP, 0, header, 55, IP.length);
/*
byte[] LANG = "1".getBytes();
System.arraycopy(LANG, 0, header, 77, 1);
*/
// String tmpTRAN_DATE = Utillity.getDateStamp();
// byte[] TRAN_DATE = tmpTRAN_DATE.getBytes();
// System.arraycopy(TRAN_DATE, 0, header, 78, TRAN_DATE.length);
/*
String tmpTRAN_SEQ = "SB"+Utillity.fillZero(Long.toString(new Object().hashCode()), 6);
byte[] TRAN_SEQ = tmpTRAN_SEQ.getBytes();
System.arraycopy(TRAN_SEQ, 0, header, 86, TRAN_SEQ.length);
*/
System.arraycopy(header, 0, full, 0, HEADER_LENGTH );
System.arraycopy(message, 0, full, HEADER_LENGTH, body.length );
return full;
}
public byte[] addHeaderAD(byte[] orgData , byte[] message ) {
byte[] header = new byte[HEADER_LENGTH];
byte[] full = null;
full = new byte[HEADER_LENGTH + message.length];
byte[] body = message;
//Header에 화이트 스페이스 초기화
Arrays.fill(header, 0, HEADER_LENGTH, (byte)' ');
//전문 총길이를 헤더에 8byte로 추가
// byte[] msgSize = Utillity.fillZero(Integer.toString(full.length), 8).getBytes();
// System.arraycopy(msgSize, 0, header, 0, 8);
byte[] RES_CODE = "0000".getBytes();
System.arraycopy(RES_CODE, 0, header, 8, 4);
byte[] SYSTEM_ID = "BLS".getBytes();
System.arraycopy(SYSTEM_ID, 0, header, 12, 3);
byte[] FLOW_ID = "01".getBytes();
System.arraycopy(FLOW_ID, 0, header, 25, 2);
String tmpSERVICE_CODE = "";
try
{
// DB 삭제(2008.12.3)
tmpSERVICE_CODE = "DD" + new String(body, 19, 4);
}catch(Exception ex){
tmpSERVICE_CODE = "DD????";
}
byte[] SERVICE_CODE = tmpSERVICE_CODE.getBytes();
System.arraycopy(SERVICE_CODE, 0, header, 27, 6);
byte[] IO = "1".getBytes();
System.arraycopy(IO, 0, header, 33, 1);
byte[] FORMAT_ID = "01".getBytes();
System.arraycopy(FORMAT_ID, 0, header, 34, 2);
byte[] USER_ID = "WAPUSER".getBytes();
System.arraycopy(USER_ID, 0, header, 46, USER_ID.length);
byte[] CERT = "0".getBytes();
System.arraycopy(CERT, 0, header, 54, 1);
String tmpIP = "";
try{
tmpIP = InetAddress.getByName("www.shinbo.co.kr").getHostAddress();
}
catch(UnknownHostException exHost){
tmpIP = "shinbo";
}
byte[] IP = tmpIP.getBytes();
System.arraycopy(IP, 0, header, 55, IP.length);
/*
byte[] LANG = "1".getBytes();
System.arraycopy(LANG, 0, header, 77, 1);
*/
// String tmpTRAN_DATE = Utillity.getDateStamp();
// byte[] TRAN_DATE = tmpTRAN_DATE.getBytes();
// System.arraycopy(TRAN_DATE, 0, header, 78, TRAN_DATE.length);
//
// String tmpTRAN_SEQ = "SB"+Utillity.fillZero(Long.toString(new Object().hashCode()), 6);
// byte[] TRAN_SEQ = tmpTRAN_SEQ.getBytes();
// System.arraycopy(TRAN_SEQ, 0, header, 86, TRAN_SEQ.length);
System.arraycopy(header, 0, full, 0, HEADER_LENGTH );
System.arraycopy(message, 0, full, HEADER_LENGTH, body.length );
// System.out.println("full][" +new String(full)+ "]");
return full;
}
/*
public static void main(String[] args){
//addHeaderDA(byte[] orgData , byte[] message )
//String tmpOrgData = "000002680000BLSCBB0DDA12101DDA121101WAPUSER WAPUSER 010.88.50.117 N04EF 2008051900000025 063377 00030760000 A121200805191840490000 3377734701 68100916347143010535770";
//String tmpMessage = "063377+00035760000+A122200805192027440000+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++3377734701+++++++++++++++++++++++++++++6810091634714301053577019560450연인컴퓨터 장지광 청주 01TLA2000018151101일반자금대출 200010040000000340000002000101300000003400000020051012000000034000000 000000040000000000000034000000.00044040 06";
String tmpMessage = "760000 0111104 A185200806131015000000 ";
byte[] orgData = null;
byte[] message = tmpMessage.getBytes();
SHINBOHeaderAction sha = new SHINBOHeaderAction();
byte[] res = sha.addHeaderAD(orgData, message);
System.out.println("res]" +new String(res));
}
*/
}
@@ -0,0 +1,160 @@
package com.kbstar.eai.common.header;
import java.util.Arrays;
import com.eactive.eai.common.header.HeaderActionSupport;
import com.eactive.eai.common.server.Keys;
import com.eactive.eai.common.util.DatetimeUtil;
import com.eactive.eai.common.util.StringUtil;
/**
* 1. 기능 : 연계기관 의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class THHCYUHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 30; // 연계 - 기관간의 헤더Length
// private static int mCount = 0;
private static String tranSysDstcd;
static {
String serverName = System.getProperty(Keys.SERVER_KEY);
tranSysDstcd = "1";
if(serverName != null && serverName.length() > 2) {
//juns 서버명 변경에 따른 인스턴스 룰 추출변경
//ex)EAIDSG_i11 => EAIDS01_i01
//tranSysDstcd = serverName.substring(serverName.length()-2, serverName.length()-1);
tranSysDstcd = serverName.substring(serverName.length()-5, serverName.length()-4);
}
}
public THHCYUHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] deleteHeaderAD(byte[] message, int headerLength) {
return deleteHeader(message,headerLength);
}
public byte[] deleteHeaderDA(byte[] message, int headerLength) {
return deleteHeader(message,headerLength);
}
public byte[] deleteHeader(byte[] message, int headerLength) {
int msgLength = message.length - headerLength;
if(msgLength > 0) {
byte[] full = null;
full = new byte[7 + message.length - HEADER_LENGTH];
byte [] header = new byte[7];
byte[] hdr = {'H', 'D', 'R'};
System.arraycopy(hdr, 0, header, 4, 3);
//
System.arraycopy(header, 0, full, 0, 7 );
System.arraycopy(message, HEADER_LENGTH, full, 7, message.length-HEADER_LENGTH);
// 전체 전문길이 계산
byte len[] = Integer.toString( message.length +3 ).getBytes();
//길이값 '0'으로 셋팅
Arrays.fill(full, 0, 4, (byte)'0');
//길이값 value 셋팅
System.arraycopy(len, 0, full, 4 - len.length, len.length);
return full;
}
else {
return message;
}
}
public byte[] addHeaderDA(byte[] orgData , byte[] message ) {
return addHeader(orgData,message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message ) {
return addHeader(orgData,message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
String serviceCode = "EAIKFTTA"; // 턱시도서비스코드(8)
String sysMinHMSUnit = ""; // 거래시간(12)
//String tranSysDstcd = "1"; // 거래처리시스템 구분(1)
String tranLogRecrdEonot = "2"; // 거래log Dump 기록유무(1)
String Blnk0 = " "; // Filler (8)
int msgLength = message.length + HEADER_LENGTH;
sysMinHMSUnit = StringUtil.stringFormat(DatetimeUtil.getFormattedDate("MMDDHHmmssSSS"), false, ' ', 12);
StringBuffer sb = new StringBuffer(30);
sb.append(serviceCode);
sb.append(sysMinHMSUnit);
sb.append(tranSysDstcd);
sb.append(tranLogRecrdEonot);
sb.append(Blnk0);
byte[] retHeader = new byte[msgLength];
System.arraycopy(sb.toString().getBytes(), 0, retHeader, 0, HEADER_LENGTH);
System.arraycopy(message, 7, retHeader, HEADER_LENGTH, retHeader.length-HEADER_LENGTH-7);
return retHeader;
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.THHCYUHeaderAction";
//
//
// /////전송 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "HDR00001234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
// /////////////
//
// /////수신 AD
//
// bizObjs[0] = "EAIKFTTA135201896 12 1234567890".getBytes();
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// orgData = null;
// //orgData = new byte[((byte[])bizObj).length ];
// //System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
//
// header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
// }
}
@@ -0,0 +1,129 @@
package com.kbstar.eai.common.header;
import com.eactive.eai.common.header.HeaderActionSupport;
/**
* 1. 기능 : Transaction Code(9) Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class TrcodeHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 9; // transaction Code Length
public TrcodeHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
return addHeader(orgData, message);
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return addHeader(orgData, message);
}
public byte[] addHeader(byte[] orgData , byte[] message ) {
// 추가로직은 없음
// message 를 리턴하도록 수정 - 20081126
// 정길영 과장 요청사항
return message;
}
// public static void main(String args[]) throws Exception {
// String actionName = "com.kbstar.eai.common.header.TrcodeHeaderAction";
//
//
/////전송 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0013HDR1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// //orgData = new byte[((byte[])bizObj).length ];
// //System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
//
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
///////////////////////////////////////////
/////전송 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0013HDR1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte[((byte[])bizObj).length ];
// System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte["0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes().length ];
// System.arraycopy("0110200805021112280000000000010200X203 1370100000002SFX 1 1234567890".getBytes(), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
///////////////////////////////////////////
// }
}
@@ -0,0 +1,144 @@
package com.kbstar.eai.common.header;
import java.util.Arrays;
import com.eactive.eai.common.header.HeaderActionSupport;
/**
* 1. 기능 : WebFirmBanking 의 Header를 EAI에서 생성하거나 삭제해야하는 경우를 위한 Class
* 2. 처리 개요 :
* - 메시지종류에 따라 헤더를 생성하거나 삭제하는 API를 제공
* 3. 주의사항
* - AD 의 경우는 S는 ADD, R 는 DELETE
* - DA 의 경우는 S는 DELETE, R 는 ADD
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class WebFirmHeaderAction extends HeaderActionSupport
{
private static final int HEADER_LENGTH = 7; // XecureConnect 헤더Length
public WebFirmHeaderAction(){
super.setHeaderLength(HEADER_LENGTH);
}
public byte[] addHeaderDA(byte[] orgData , byte[] message) {
byte[] full = null;
full = new byte[HEADER_LENGTH+message.length];
System.arraycopy(message, 0, full, 7, message.length);
// 전체 전문길이 계산
byte len[] = Integer.toString( message.length ).getBytes();
//길이값 '0'으로 셋팅
Arrays.fill(full, 0, 7, (byte)'0');
//길이값 value 셋팅
System.arraycopy(len, 0, full, 7 - len.length, len.length);
return full;
}
public byte[] addHeaderAD(byte[] orgData , byte[] message) {
return "".getBytes();
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String actionName = "com.kbstar.eai.common.header.WebFirmHeaderAction";
//
/////전송 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 AD
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0013HDR1234567890".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// //orgData = new byte[((byte[])bizObj).length ];
// //System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.ADD_DELETE_HEADER);
//
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.ADD_DELETE_HEADER);
// System.out.println("header=>"+new String(header));
///////////////////////////////////////////
/////전송 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "00000140000000004ABCD".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte[((byte[])bizObj).length ];
// System.arraycopy(((byte[])bizObj), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_SEND);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_SEND, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
/////////////
/////수신 DA
// HeaderAction action = HeaderActionFactory.createAction(actionName);
//
// Object[] bizObjs =new Object[1];
// bizObjs[0] = "0000000004ABCD".getBytes();
// Object bizObj = null;
// if(bizObjs != null && bizObjs.length > 0) {
// bizObj = bizObjs[0];
// }
// byte[] orgData = null;
// orgData = new byte["00000140000000004ABCD".getBytes().length ];
// System.arraycopy("00000140000000004ABCD".getBytes(), 0, orgData, 0,orgData.length);
// System.out.println("orgData=>"+new String(orgData==null?"".getBytes():orgData));
// System.out.println("message=>"+new String(bizObj==null?"".getBytes():(byte[])bizObj));
// System.out.println("sendRecv=>"+HeaderActionKeys.MESSAGE_RECV);
// System.out.println("commandType=>"+HeaderActionKeys.DELETE_ADD_HEADER);
// byte[] header = action.excute(orgData ,(byte[])bizObj, HeaderActionKeys.MESSAGE_RECV, HeaderActionKeys.DELETE_ADD_HEADER);
// System.out.println("header=>"+new String(header));
// ///////////////////////////////////////////
//
//
// }
}
@@ -0,0 +1,810 @@
package com.kbstar.eai.common.loader;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.temporal.TemporalField;
import java.time.temporal.WeekFields;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import java.util.Properties;
import com.eactive.eai.common.util.StringUtil;
//import com.penta.scpdb.ScpDbAgent;
/**
* 1. 기능 : 거래로그 파일을 DB에 저장
* 2. 처리 개요 : 거래로그 파일을 DB에 저장
* 3. 주의사항 : 독립모듈로 사용하기 위해 개발
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class EAILogFIleLoader {
private String driver = "";
private String url = "";
private String ival = "";
private String pval = "";
private String tableOwner = "inst1";
private final String delimeter = "#[|]@";
private final String EOL = "EOL$$;";
private final String NEWLINE = "\n";
private int COL_COUNT = 182;
private int totalCount = 0;
private int insertCount = 0;
private int position = 0;
private int commitSize = 100; // commit size
private String logSQL = " INSERT INTO #{LOG_MASTER_TABLE} ( \n"
//EAI업무공통부
+ " EAIBZWKDSTCD, MSGDPSTYMS, EAISVCSERNO, LOGPRCSSSERNO, EAISEVRINSTNCNAME, \n"
+ " EAISVCNAME, SVCHMSEONOT, SVCMOTIVUSEDSTCD, SVCPRCSSDSTICNAME, FLOWCTRLROUTNAME, \n"
+ " INTGRADSTICNAME, GSTATSVCDSTICNAME, SVCPRCSSNO, SVCBFCLMNLOGYN, STNDMSGUSEYN, \n"
+ " GSTATSYSADPTRBZWKGROUPNAME, PRSNTMSGIDNAME, RSPNSERRCDNAME, MSGPRCSSYMS, SEVRLOGLVELNO, \n"
+ " SVCLOGLVELNO, ERREAISVCNAME, DMNDERRCHNGIDNAME, DMNDERRFLDNAME, RSPNSERRCHNGIDNAME, \n"
+ " RSPNSERRFLDNAME, PSVINTFACDSTICNAME, PSVBZWKSYSNAME, PSVSYSIDNAME, PSVSYSSVCDSTICNAME, \n"
+ " PSVSYSADPTRBZWKGROUPNAME, FLOVRYN, CHNGYN, CHNGMSGIDNAME, INPTMSGIDNAME, \n"
+ " BASCRSPNSMSGCMPRCTNT, BASCRSPNSCHNGYN, BASCRSPNSCHNGMSGIDNAME, ERRRSPNSMSGCMPRCTNT, ERRRSPNSCHNGYN, \n"
+ " ERRRSPNSCHNGMSGIDNAME, NEXTSVCPRCSSNO, OUTBNDROUTNAME, TOUTVAL, CMPENSVCPRCSSNAME, \n"
+ " SUPPLBZWKDATAYN, KEYMGTMSGCTNT, TRACKASISKEY1CTNT, TRACKASISKEY2CTNT, TRACKASISKEY3CTNT, \n"
+ " TRACKASISKEY4CTNT, EAIGROUPCODSTCD, PGUID, TRANTYPE, RSPNSCHNGMSGTYPE, \n"
+ " EAIERRCD, EAIERRCTNT, SEVRGROUPNAME, COMPANYCODE, SPLIZLENGTH, ADPTRINSTICODE, \n"
//EAI업무개별부
+ " BZWKDATACTNT, \n"
//전행통합로그 헤더부
+ " TRANSTARTYMS, LGINGSYSID, LGINGSYSINSTNCID, LGINGYMS, INTGRALOGGUID, \n"
+ " INTGRALOGIOMSGSERNO, EAISNDRCVTELGMDSTCD, \n"
//전행통합로그 공통부
+ " INTGRALOGTELGMRECVTRANCD, INTGRALOGERRCD, EAILOGKNDDSTCD, EAIBZWKTELGMDSTCD, INTGRALOGCHNLDSTCD, \n"
+ " INTGRALOGMDIADSTCD, EAIDTALSBZWKCD, INTGRALOGTRANBRNCD, LOGIDIVICGRYVSNNO, INTGRALOGITSMMONITAGETYN, \n"
+ " INTGRALOGTRANSCRENNO, INTGRALOGUSEREMPID, EAISCOPPERCTNT, \n"
//내부표준전문 헤더부
+ " CICSTRNCD, INTNLSTELGMLEN, TRANBASEYMD, GUIDNO, TELGMDMNDDSTCD, \n"
+ " TELGMFMATDSTCD, TELGMVALDYMD, TELGMVSNNO, GNRZTOUTCRTCNMVL, SYSIDNAME, \n"
+ " OGTRANRCHNLDSTCD,PRCSSTCICSTRNCD,TRANPGROUPCOCD,ISCSENDSYSID, SPAREAREA, \n"
//내부표준전문 공통부(거래정보)
+ " GROUPCOCD, TELGMRECVTRANCD, PRCSSRTDTRANCD, SCRENNO, OSIDINSTICD, \n"
+ " TRANSERNO, INOPARTLDSTCD, CMPXTDMNDDSTCD, SYSOEVIRNDSTCD, ITSMMONITAGETYN, \n"
+ " TRANPTRNDSTCD, RBNDTRANYN, TERMLWAITRQSTYN, OGTRANRSTRYN, OGTRANGUIDNO, \n"
//내부표준전문 공통부(채널정보)
+ " BNKCD, TRANBRNCD, FEEPRCSSBRNCD, RELAYCHNLDSTCD, CHNLDSTCD, \n"
+ " CHNLDBZWKDSTCD, MDIADSTCD, LANGDSTCD, TRMNO, USEREMPID, \n"
+ " TERMLOPRTRNO, TERMLSPVSRNO, N1STSPVSRBRNCD, N2NDSPVSRBRNCD, N2NDSPVSRTRMNO, \n"
//내부표준전문 공통부(입력메시지정보)
+ " INPTMSGPTRNDSTCD, INPTMSGCTNNYN, INPTMSGSERNO, INPTMSGWRITYMS, \n"
//내부표준전문 공통부(승인정보)
+ " ATHORFNSHDSTCD, SPVSRATHORDSTCD, N1STSPVSREMPID, N2NDSPVSREMPID, SPVSRARESNNOITM, \n"
+ " SPVSRATHORRESNCD, \n"
//내부표준전문 공통부(전행업무공통부)
+ " CLSNGAFYN, LSDTTRANYN, IDTREK, BZOPRDDDSTCD, SODBBRNPTRNDSTCD, \n"
+ " SODUSERPTRNDSTCD, INOTABILYN, NORTAUSERYN, TRANDSCNDMNDYN, CALLGPGMNAME, \n"
+ " RECVLUNAME, CNCLDSTCD, CNCLPTRNDSTCD, TRANCCRESNDSTCD, TRANCCRESNCTNT, \n"
+ " OGTRANYMS, CNCLRSTRINFOCTNT, DSCNTRANDSTCD, IDIVIDATAEDTYN, OPBRNCD, \n"
+ " CNCUTISCOPADDR, \n"
//내부표준전문 공통부(출력메시지정보)
+ " OUTPTDPTRNDSTCD, OUTPTMPTRNDSTCD, OUTPTMSGCTNNYN, OUTPTMSGSERNO, OUTPTMSGWRITYMS,\n"
+ " BRNCLSNGYN, \n"
//내부표준전문 공통부(에러정보)
+ " ERRCD, TREATCD, CNCUTDSCNRQSTYN, FWORKCISCOPADDR, INTFACSENDTRANCD, \n"
+ " CNCLECLUDYN, TRSMTRQSTID, CNCLABILYN, OUTPTMDIAEDTNO, ATMCSHRETUNDSTCD, \n"
+ " SENDEAISVCNAME, \n"
+ " LUSNDRCVTYPDSTCD, DTECALLOWTRANYN, IPADDR, \n"
+ " CHCMNLEN, MSGCHNLDSTCD, CNTERDSTCD, \n"
+ " SPAREAREA2, TESTCASID, \n"
//내부표준전문 공통부(입력매체부정보)
+ " INPTMDIAPARTLLEN \n"
//내부표준전문 채널공통부
+ " ,CHANNELCOMMON \n"
+ " ) VALUES ( \n"
//EAI업무공통부
+ " ?, ?, ?, ?, ?, \n" //index to 5
+ " ?, ?, ?, ?, ?, \n" //index to 10
+ " ?, ?, ?, ?, ?, \n" //index to 15
+ " ?, ?, ?, ?, ?, \n" //index to 20
+ " ?, ?, ?, ?, ?, \n" //index to 25
+ " ?, ?, ?, ?, ?, \n" //index to 30
+ " ?, ?, ?, ?, ?, \n" //index to 35
+ " ?, ?, ?, ?, ?, \n" //index to 40
+ " ?, ?, ?, ?, ?, \n" //index to 45
+ " ?, ?, ?, ?, ?, \n" //index to 50
+ " ?, ?, ?, ?, ?, \n" //index to 55
+ " ?, ?, ?, ?, ?, \n" //index to 60
+ " ?, \n" //index to 61
//EAI업무개별부
+ " CAST(? AS VARCHAR(1000))||CAST(? AS VARCHAR(1000))||CAST(? AS VARCHAR(1000))||CAST(? AS VARCHAR(1000)), \n" // 61
//전행통합로그 헤더부
+ " ?, ?, ?, ?, ?, \n" //index to 66
+ " ?, ?, \n" //index to 68
//전행통합로그 공통부
+ " ?, ?, ?, ?, ?, \n" //index to 68
+ " ?, ?, ?, ?, ?, \n" //index to 73
+ " ?, ?, ?, \n" //index to 76
//내부표준전문 헤더부
+ " ?, ?, ?, ?, ?, \n"
+ " ?, ?, ?, ?, ?, \n"
+ " ?, ?, ?, ?, ?, \n"
//내부표준전문 공통부(거래정보)
+ " ?, ?, ?, ?, ?, \n"
+ " ?, ?, ?, ?, ?, \n"
+ " ?, ?, ?, ?, ?, \n"
//내부표준전문 공통부(채널정보)
+ " ?, ?, ?, ?, ?, \n"
+ " ?, ?, ?, ?, ?, \n"
+ " ?, ?, ?, ?, ?, \n"
//내부표준전문 공통부(입력메시지정보)
+ " ?, ?, ?, ?, \n"
//내부표준전문 공통부(승인정보)
+ " ?, ?, ?, ?, ?, \n"
+ " ?, \n"
//내부표준전문 공통부(전행업무공통부)
+ " ?, ?, ?, ?, ?, \n"
+ " ?, ?, ?, ?, ?, \n"
+ " ?, ?, ?, ?, ?, \n"
+ " ?, ?, ?, ?, ?, \n"
+ " ?, \n"
//내부표준전문 공통부(출력메시지정보)
+ " ?, ?, ?, ?, ?, \n"
+ " ?, \n"
//내부표준전문 공통부(에러정보)
+ " ?, ?, ?, ?, ?, \n"
+ " ?, ?, ?, ?, ?, \n"
+ " ?, ?, ?, \n"
+ " ?, ?, ?, ?, ?, \n"
+ " ?, \n" //채널공통부길이 추가
//내부표준전문 공통부(입력매체부정보)
+ " ?, \n"
// 채널공통부(200)
+ " ? \n"
+ " ) ";
private String logSubSQL =
" INSERT INTO #{LOG_SLAVE_TABLE} ( \n"
+ " EAIBZWKDSTCD, MSGDPSTYMS, EAISVCSERNO, BZWKDATASERNO, LOGPRCSSSERNO \n"
+ " , BZWKDATACTNT \n"
+ " ) VALUES ( ?, ?, ?, ?, ? , ? ) ";
private void init(String configPath) throws Exception {
Properties p = new Properties();
FileInputStream in = null;
try{
in = new FileInputStream(configPath);
p.load(in);
} catch (Exception e){
System.out.println("환경설정 파일이 없습니다. - 파일명 : " + configPath);
throw e;
}
finally{
if(in != null) {
try {
in.close();
}
catch(Exception e) {
System.out.println("close error");
}
}
}
driver = p.getProperty("jdbc.driver");
url = p.getProperty("jdbc.url");
ival = p.getProperty("jdbc.ivalue");
tableOwner = p.getProperty("table.owner");
String iniFilePath = p.getProperty("ini.file.path");
// String iniKey = p.getProperty("ini.key");
String encpval = p.getProperty("jdbc.pvalue");
System.out.println("=========================================================");
System.out.println(" EAILogFileLoader Configuration - "+ new Date());
System.out.println("=========================================================");
// System.out.println("driver = " + driver);
// System.out.println("url = " + url);
// System.out.println("ivalue = " + ival);
// System.out.println("pvalue = " + encpval);
// System.out.println("Table Owner = " + tableOwner);
// System.out.println("iniFilePath = " + iniFilePath);
System.out.println("=========================================================");
// ScpDbAgent agt = new ScpDbAgent();
// try {
// pval = agt.ScpDecB64(iniFilePath, "SEC", encpval);
// }
// catch(Exception e) {
// System.out.println("ScpDecB64 error-" +e.toString());
// }
//
}
private static ZonedDateTime get(long time){
Instant instant = Instant.ofEpochMilli(time);
return ZonedDateTime.ofInstant(instant, ZoneId.systemDefault());
}
public static int getDayOfWeekNum(String timeStr) {
Date date = new Date();
try {
date = new SimpleDateFormat("yyyyMMdd").parse(timeStr); // "yyyyMMddHHmmssSSS"
} catch (ParseException e) {
System.out.println("getDayOfWeekNum error - "+timeStr);
// e.printStackTrace();
}
long time = date.getTime();
ZonedDateTime zdt = get(time);
TemporalField filedISO = WeekFields.of(Locale.KOREA).dayOfWeek();
return zdt.getDayOfWeek().get(filedISO);
}
private int toInt(String s) {
try {
return Integer.parseInt(s);
}
catch(Exception ex) {
return 0;
}
}
private void loadLog(String cDay, ArrayList list, boolean isForce) throws Exception {
int insertResult = 0;
Connection conn = null;
PreparedStatement preparedStatement = null;
String[] info = null;
try {
System.out.println(">> Log Date : " + cDay + ", rows=" + list.size());
if( driver != null ) {
Class.forName(driver);
conn = DriverManager.getConnection(url, ival, pval);
conn.setAutoCommit(true);
int dayOfWeek = getDayOfWeekNum(cDay);
String tableName = tableOwner+".TSEAILG1" + dayOfWeek;
String cLogSQL = logSQL.replace("#{LOG_MASTER_TABLE}", tableName);
// System.out.println(cLogSQL);
preparedStatement = conn.prepareStatement(cLogSQL);
String apndBwkDataYn = "N"; //추가업무데이터 여부
for (int i=0; i<list.size(); i++) {
info = (String[]) list.get(i);
try {
position++;
totalCount++;
// System.out.println("column size : " + info.length);
// for(int p=0; p<info.length;p++) {
// System.out.println("column ["+p+"] : [" + info[p] +"] -" + info[p].length());
// }
if(info == null || info.length != COL_COUNT) {
throw new Exception("파싱데이터에 오류가 있음, 항목갯수 오류("+ info.length+"/"+COL_COUNT+") - line : "+(i+1));
}
int index = 1;
int info_index = 0;
apndBwkDataYn = "N";
preparedStatement.setString(index++, info[info_index++]); //EAI업무구분코드
preparedStatement.setString(index++, info[info_index++]); //메시지수신시각
preparedStatement.setString(index++, info[info_index++]); //EAI서비스일련번호
preparedStatement.setString(index++, info[info_index++]); //로그처리일련번호
preparedStatement.setString(index++, info[info_index++]); //EAI서버인스탄스명
preparedStatement.setString(index++, info[info_index++]); //EAI서비스명
preparedStatement.setString(index++, info[info_index++]); //서비스시각유무
preparedStatement.setString(index++, info[info_index++]); //서비스동기사용구분코드
preparedStatement.setString(index++, info[info_index++]); //서비스처리구분명
preparedStatement.setString(index++, info[info_index++]); //흐름통제라우팅명
//index 10
preparedStatement.setString(index++, info[info_index++]); //통합구분명
preparedStatement.setString(index++, info[info_index++]); //기동서비스구분명
preparedStatement.setString(index++, info[info_index++]); //서비스처리번호
preparedStatement.setString(index++, info[info_index++]); //서비스전컬럼로그여부
preparedStatement.setString(index++, info[info_index++]); //표준메시지사용여부
preparedStatement.setString(index++, info[info_index++]); //기동시스템어댑터업무그룹명
preparedStatement.setString(index++, info[info_index++]); //현재메시지ID명
preparedStatement.setString(index++, info[info_index++]); //응답에러코드명
preparedStatement.setString(index++, info[info_index++]); //메시지처리시각
preparedStatement.setString(index++, info[info_index++]); //서버로그레벨번호
//index 20
preparedStatement.setString(index++, info[info_index++]); //서비스로그레벨번호
preparedStatement.setString(index++, info[info_index++]); //오류EAI서비스명
preparedStatement.setString(index++, info[info_index++]); //요청오류변환ID명
preparedStatement.setString(index++, info[info_index++]); //요청에러필드명
preparedStatement.setString(index++, info[info_index++]); //응답오류변환ID명
preparedStatement.setString(index++, info[info_index++]); //응답에러필드명
preparedStatement.setString(index++, info[info_index++]); //수동인터페이스구분명
preparedStatement.setString(index++, info[info_index++]); //수동업무시스템명
preparedStatement.setString(index++, info[info_index++]); //수동시스템ID명
preparedStatement.setString(index++, info[info_index++]); //수동시스템서비스구분명
//index 30
preparedStatement.setString(index++, info[info_index++]); //수동시스템어댑터업무그룹명
preparedStatement.setString(index++, info[info_index++]); //장애극복여부
preparedStatement.setString(index++, info[info_index++]); //변환여부
preparedStatement.setString(index++, info[info_index++]); //변환메시지ID명
preparedStatement.setString(index++, info[info_index++]); //입력메시지ID명
preparedStatement.setString(index++, info[info_index++]); //기본응답메시지비교내용
preparedStatement.setString(index++, info[info_index++]); //기본응답변환여부
preparedStatement.setString(index++, info[info_index++]); //기본응답변환메시지ID명
preparedStatement.setString(index++, info[info_index++]); //오류응답메시지비교내용
preparedStatement.setString(index++, info[info_index++]); //오류응답변환여부
//index 40
preparedStatement.setString(index++, info[info_index++]); //오류응답변환메시지ID명
preparedStatement.setString(index++, info[info_index++]); //다음서비스처리번호
preparedStatement.setString(index++, info[info_index++]); //아웃바운드라우팅명
preparedStatement.setInt(index++, toInt(info[info_index++])); //타임아웃값
preparedStatement.setString(index++, info[info_index++]); //보상서비스처리명
preparedStatement.setString(index++, info[info_index++]); //추가업무데이터여부
preparedStatement.setString(index++, info[info_index++]); //키관리메시지내용
preparedStatement.setString(index++, info[info_index++]); //추적보조키1내용
preparedStatement.setString(index++, info[info_index++]); //추적보조키2내용
preparedStatement.setString(index++, info[info_index++]); //추적보조키3내용
//index 50
preparedStatement.setString(index++, info[info_index++]); //추적보조키4내용
preparedStatement.setString(index++, info[info_index++]); // EAI서비스코드의 그룹회사코드
preparedStatement.setString(index++, info[info_index++]); // PGUID
preparedStatement.setString(index++, info[info_index++]); // 거래처리구분코드내용
preparedStatement.setString(index++, info[info_index++]); // 기본에러응답변환여부
preparedStatement.setString(index++, info[info_index++]); //EAI에러코드
preparedStatement.setString(index++, info[info_index++]); //EAI에러내용
preparedStatement.setString(index++, info[info_index++]); //서버그룹명
preparedStatement.setString(index++, info[info_index++]); //업체코드, add 20190404
preparedStatement.setInt(index++, toInt(info[info_index++])); //전문크기, add 20190404
//index 60
preparedStatement.setString(index++, info[info_index++]);// add 20190404 // adapterNickName
// EAI 업무 개별부(4,000bytes)
String bizMsgStr = info[info_index++];
if(bizMsgStr == null || bizMsgStr.equals(""))
bizMsgStr = " ";
String[] bizMsgSplit = StringUtil.chunkStringArray(bizMsgStr, 4000);
String bwkData = bizMsgSplit[0];
String addBwkData = bizMsgSplit[1];
if (!"".equals(addBwkData))
apndBwkDataYn = "Y";
String[] bwkDataSplit = StringUtil.chunkStringTotal(bwkData, 1000);
for(int x = 0; x < 4; x++) { //업무데이터내용 - 59, 60, 61, 62
if(bwkDataSplit.length > x)
preparedStatement.setString(index++, bwkDataSplit[x]);
else
preparedStatement.setString(index++, "");
}
// 전행통합로그헤더부(92bytes)
preparedStatement.setString(index++, info[info_index++]); //채널거래시작일시
preparedStatement.setString(index++, info[info_index++]); //로깅시스템ID, 차세대표준화-기술요소 명명규칙참조(mainframe,서버:시스템id)
preparedStatement.setString(index++, info[info_index++]); //로깅시스템인스턴스ID, 차세대표준화-기술요소 명명규칙참조(WAS의 인스턴스)
preparedStatement.setString(index++, info[info_index++]); //로깅일시
preparedStatement.setString(index++, info[info_index++]); //GUID번호
preparedStatement.setString(index++, info[info_index++]); //입력메시지일련번호
preparedStatement.setString(index++, info[info_index++]); //송수신전문구분코드
// 전행통합로그공통부(131bytes)
preparedStatement.setString(index++, info[info_index++]); //전문수신거래코드
preparedStatement.setString(index++, info[info_index++]); //에러코드
preparedStatement.setString(index++, info[info_index++]); //로그종류구분코드 - 1.업무로그(정상로그) 2. 업무로그(에러로그), 3. 중계 로그
preparedStatement.setString(index++, info[info_index++]);
preparedStatement.setString(index++, info[info_index++]); //채널구분코드
preparedStatement.setString(index++, info[info_index++]); //매체구분코드
preparedStatement.setString(index++, info[info_index++]); //세부업무구분코드
preparedStatement.setString(index++, info[info_index++]);//거래부점코드
preparedStatement.setString(index++, info[info_index++]);
preparedStatement.setString(index++, info[info_index++]); //ITSM모니터링대상여부
preparedStatement.setString(index++, info[info_index++]); //화면번호
preparedStatement.setString(index++, info[info_index++]); //사용자번호
preparedStatement.setString(index++, info[info_index++]); //영역별내용
// 내부표준전문 헤더부(73bytes)
preparedStatement.setString(index++, info[info_index++]);//CICS트랜젝션코드
preparedStatement.setInt(index++, toInt(info[info_index++]) ); //내부표준전문길이
preparedStatement.setString(index++, info[info_index++]); //거래기준년월일
preparedStatement.setString(index++, info[info_index++]); //GUID번호
preparedStatement.setString(index++, info[info_index++]); //전문요청구분코드
preparedStatement.setString(index++, info[info_index++]); //전문형식구분코드
preparedStatement.setString(index++, info[info_index++]);//전문유효년월일
preparedStatement.setString(index++, info[info_index++]);//전문버전번호(TelgmVsnno), add ver.20090128
preparedStatement.setInt(index++, toInt(info[info_index++]) );//총괄타임아웃임계치수(GnrzToutCrtcNmvl), add ver.20090128
preparedStatement.setString(index++, info[info_index++]); //SYSID명, add 20090824
preparedStatement.setString(index++, info[info_index++]); //중계채널구분코드, add 20090824
preparedStatement.setString(index++, info[info_index++]); //처리대상CICS트랜젝션코드 , add 20101221
preparedStatement.setString(index++, info[info_index++]); //거래처리그룹회사코드, add 20101221
preparedStatement.setString(index++, info[info_index++]); //ISC전송SYSID, add 20200429
preparedStatement.setString(index++, info[info_index++]); //예비 AREA, add 20101221
// 내부표준전문 공통부(거래정보, 112bytes)
preparedStatement.setString(index++, info[info_index++]); //그룹회사코드
preparedStatement.setString(index++, info[info_index++]); //전문수신거래코드
preparedStatement.setString(index++, info[info_index++]); //처리결과전문수신거래코드
preparedStatement.setString(index++, info[info_index++]);//화면번호
preparedStatement.setString(index++, info[info_index++]); //대외기관코드
preparedStatement.setString(index++, info[info_index++]);//거래일련번호
preparedStatement.setString(index++, info[info_index++]); //내외부구분코드
preparedStatement.setString(index++, info[info_index++]); //복합거래요청구분코드
preparedStatement.setString(index++, info[info_index++]); //시스템운영환경구분코드
preparedStatement.setString(index++, info[info_index++]);//ITSM모니터링대상여부(ITSMMoniTagetYn), add ver.20090128
preparedStatement.setString(index++, info[info_index++]);//거래유형구분코드
preparedStatement.setString(index++, info[info_index++]);//리바운드 거래여부
preparedStatement.setString(index++, info[info_index++]); //단말대기요구 여부
preparedStatement.setString(index++, info[info_index++]); //원거래복원여부
preparedStatement.setString(index++, info[info_index++]); //원거래 GUID번호
//내부표준전문 공통부(채널정보, 47bytes)
preparedStatement.setString(index++, info[info_index++]);//은행코드
preparedStatement.setString(index++, info[info_index++]); //거래부점코드
preparedStatement.setString(index++, info[info_index++]);//수수료처리부점코드(FeePrcssBrncd), add ver.20090128
preparedStatement.setString(index++, info[info_index++]);//중계채널구분코드
preparedStatement.setString(index++, info[info_index++]); //채널구분코드
preparedStatement.setString(index++, info[info_index++]); //채널세부업무구분코드(ChnlDtalsBzwkDstcd), add ver.20090128
preparedStatement.setString(index++, info[info_index++]); //매체구분코드
preparedStatement.setString(index++, info[info_index++]); //언어구분코드
preparedStatement.setString(index++, info[info_index++]); //단말번호
preparedStatement.setString(index++, info[info_index++]); //사용자직원번호
preparedStatement.setString(index++, info[info_index++]);//단말조작자번호
preparedStatement.setString(index++, info[info_index++]);//단말책임자번호
preparedStatement.setString(index++, info[info_index++]);//1차책임자부점코드(1stSpvsrBrncd), add ver.20090128
preparedStatement.setString(index++, info[info_index++]); //2차책임자부점코드
preparedStatement.setString(index++, info[info_index++]);//2차책임자단말번호
//내부표준전문 공통부(입력메시지정보, 26bytes)
preparedStatement.setString(index++, info[info_index++]); //입력메시지유형구분코드
preparedStatement.setString(index++, info[info_index++]); //입력메시지계속여부
preparedStatement.setString(index++, info[info_index++]);//입력메시지일련번호
preparedStatement.setString(index++, info[info_index++]); //입력메시지작성일시
//내부표준전문 공통부(승인정보, 98bytes)
preparedStatement.setString(index++, info[info_index++]); //승인완료구분코드
preparedStatement.setString(index++, info[info_index++]);//책임자승인구분코드
preparedStatement.setString(index++, info[info_index++]);//1차책임자직원번호
preparedStatement.setString(index++, info[info_index++]);//2차책임자직원번호
preparedStatement.setInt(index++, toInt(info[info_index++]));//책임자승인사유건수
preparedStatement.setString(index++, info[info_index++]); //책임자승인사유코드(10) - 80bytes
//내부표준전문 공통부(전행업무공통부, 179bytes)
preparedStatement.setString(index++, info[info_index++]);//마감후여부
preparedStatement.setString(index++, info[info_index++]); //전일자거래여부
//index 140
preparedStatement.setString(index++, info[info_index++]); //카드거래처리년월일
preparedStatement.setString(index++, info[info_index++]); //영업일구분코드(BzoprDdDstcd), add ver.20090128
preparedStatement.setString(index++, info[info_index++]); //SOD영업점유형구분코드
preparedStatement.setString(index++, info[info_index++]); //SOD사용자유형구분코드
preparedStatement.setString(index++, info[info_index++]); //입출가능여부
preparedStatement.setString(index++, info[info_index++]); //무자원대체가능사용자여부
preparedStatement.setString(index++, info[info_index++]); //거래중단요청여부
preparedStatement.setString(index++, info[info_index++]); //호출프로그램명
preparedStatement.setString(index++, info[info_index++]);//수신LU명
preparedStatement.setString(index++, info[info_index++]); //취소구분코드
//index 150
preparedStatement.setString(index++, info[info_index++]); //취소유형구분코드
preparedStatement.setString(index++, info[info_index++]); //거래취소정정사유구분코드
preparedStatement.setString(index++, info[info_index++]);//거래취소정정사유내용
preparedStatement.setString(index++, info[info_index++]); //원거래일시
preparedStatement.setString(index++, info[info_index++]); //취소복원정보내용(CnclRstrInfoCtnt), add ver.20090128
preparedStatement.setString(index++, info[info_index++]);//중단거래구분코드
preparedStatement.setString(index++, info[info_index++]);//개별데이터편집여부
preparedStatement.setString(index++, info[info_index++]); //개설부점코드
preparedStatement.setString(index++, info[info_index++]); //센터컷인터페이스영역주소(CncutIntfacScopAddr), add ver.20090128
//내부표준전문 공통부(출력메시지정보, 29bytes)
preparedStatement.setString(index++, info[info_index++]); //출력데이터유형구분코드
//index 160
preparedStatement.setString(index++, info[info_index++]); //출력메시지유형구분코드
preparedStatement.setString(index++, info[info_index++]); //출력메시지계속여부
preparedStatement.setString(index++, info[info_index++]);//출력메시지일련번호
preparedStatement.setString(index++, info[info_index++]); //출력메시지작성일시
preparedStatement.setString(index++, info[info_index++]); //부점마감여부
//내부표준전문 공통부(에러정보, 17bytes)
preparedStatement.setString(index++, info[info_index++]);//에러코드
preparedStatement.setString(index++, info[info_index++]); //조치코드
preparedStatement.setString(index++, info[info_index++]); //센터컷 중단요구 여부
preparedStatement.setString(index++, info[info_index++]); //프레임워크제어정보영역주소, add 20090824
preparedStatement.setString(index++, info[info_index++]); //인터페이스송신거래코드, add 20090824
//index 170
// TODO DB 필드매핑 20101221
preparedStatement.setString(index++, info[info_index++]); //취소제외여부
preparedStatement.setString(index++, info[info_index++]); //전송요구ID
preparedStatement.setString(index++, info[info_index++]); //취소가능여부
preparedStatement.setString(index++, info[info_index++]); //출력매체편집번호
preparedStatement.setString(index++, info[info_index++]); //자동화기기현금반환구분코드
preparedStatement.setString(index++, info[info_index++]);//송신EAI서비스명
preparedStatement.setString(index++, info[info_index++]); //LU송수신타입구분
preparedStatement.setString(index++, info[info_index++]); //일자전환허용거래여부
preparedStatement.setString(index++, info[info_index++]); //IP주소
preparedStatement.setInt(index++, toInt(info[info_index++]) ); //채널공통부길이
preparedStatement.setString(index++, info[info_index++]); //메시지채널구분코드
preparedStatement.setString(index++, info[info_index++]); //예비 AREA
preparedStatement.setString(index++, info[info_index++]);//테스트사례ID
//내부표준전문 공통부(입력매체부정보, 4bytes)
preparedStatement.setInt(index++, toInt(info[info_index++]) ); //입력매체부길이(InptMdiaCgryLen), add ver.20090128
preparedStatement.setString(index++, info[info_index++]); // 채널공통부
insertResult = preparedStatement.executeUpdate();
insertCount += insertResult;
if ("Y".equals(apndBwkDataYn)) {
addBwkDataSub(conn, info, addBwkData, dayOfWeek); // 업무데이터서브
}
// conn.commit();
}
catch(Exception ex) {
System.out.println("ERROR SKIP INSERT - row : "+ position +", Error : " + ex.toString());
// ex.printStackTrace();
if(!isForce) throw ex;
}
} // for (int i=0; i<list.size(); i++) {
}
}
catch(SQLException se) {
// if(conn != null) conn.rollback();
if(info!=null) {
System.out.println("ERROR : DB 오류 - " + info.toString());
}
else {
System.out.println("ERROR : DB 오류 - " + se.toString());
}
// se.printStackTrace();
throw se;
}
catch(Exception e) {
// if(conn != null) conn.rollback();
System.out.println(e.toString());
// e.printStackTrace();
throw e;
}
finally {
try {
if(preparedStatement != null) preparedStatement.close();
}
catch (SQLException sqle) {
System.out.println("SQLException was thrown: " + sqle.toString());
}
try {
if(conn != null) conn.close();
}
catch (SQLException sqle) {
System.out.println("SQLException was thrown: " + sqle.toString());
}
}
}
public void addBwkDataSub(Connection conn, String[] info, String subBizMsgStr, int dayOfWeek) throws Exception {
String subMsgStr = subBizMsgStr;
int seq = 0; //업무테이터 일련번호
PreparedStatement preparedStatement = null;
try {
String tableName = tableOwner+".TSEAILG2" + dayOfWeek;
String cLogSQL = logSubSQL.replace("#{LOG_SLAVE_TABLE}", tableName);
preparedStatement = conn.prepareStatement(cLogSQL);
do {
String[] subMsgSplit = StringUtil.chunkStringArray(subMsgStr, 4000);
String bwkData = subMsgSplit[0]; //업무데이터
subMsgStr = subMsgSplit[1];
preparedStatement.setString(1, info[0]); //EAI업무구분코드
preparedStatement.setString(2, info[1]); //메시지수신시각
preparedStatement.setString(3, info[2]); //EAI거래일련번호
preparedStatement.setInt(4, ++seq); //업무테이터 일련번호(SMALLINT)
preparedStatement.setString(5, info[3]); //로그처리일련번호
preparedStatement.setString(6, bwkData); //업무데이터내용
preparedStatement.executeUpdate();
} while (!"".equals(subMsgStr) && seq < 99); // TSEAILG02.BzwkDataSerno : NUMBER(2)
} catch(Exception e) {
System.out.println("DB Logging[SLAVE] Failed - " + info[0] + "|" + info[1] + "|" + info[2] +"|seq="+seq);
throw e;
} finally {
if(preparedStatement != null) {
try {
preparedStatement.close();
} catch (SQLException e) {
System.out.println("SQLException was thrown: " + e.toString());
}
}
}
}
private void parse(String filePath) throws Exception {
ArrayList<String[]> list = new ArrayList<String[]>();
int count = 0;
BufferedReader br = new BufferedReader(new FileReader(filePath));
String lineStr = null;
StringBuffer sb = new StringBuffer();
String[] codes = null;
boolean dayChanged = false;
String pDay = null;
String cDay = null;
int multiLine = 0;
try {
while ((lineStr = br.readLine()) != null) {
if(EOL.equals(lineStr)) {
codes = split(sb.toString(), delimeter);
cDay = codes[1].substring(0, 8);
if(pDay != null) {
dayChanged = !pDay.equals(cDay);
}
if(dayChanged) {
loadLog(cDay, list, true);
count = 0;
list.clear();
}
pDay = cDay;
count++;
list.add(codes);
if(count % commitSize == 0) {
loadLog(cDay, list, true);
count = 0;
list.clear();
}
multiLine = 0;
sb.setLength(0);
continue;
}
multiLine++;
if(multiLine > 1) {
sb.append(NEWLINE);
}
sb.append(lineStr);
}
}
catch(Exception e) {
System.out.println(e.toString());
}
finally {
try {
if(br != null) br.close();
}
catch(Exception e) {
System.out.println(e.toString());
}
}
if(count > 0) {
loadLog(cDay, list, true);
}
System.out.println(String.format("## FILE=%s, INSERT ROW COUNTS : (%d/%d)", filePath, insertCount, totalCount));
}
private String[] split(String data, String deli) {
String[] s = data.split(deli);
return s;
}
public void printArrayList(ArrayList list) {
for(int i=0; i<list.size(); i++) {
String[] codes = (String[]) list.get(i);
for(int j=0; j<codes.length; j++) {
System.out.print(codes[j]);
System.out.print(";");
}
System.out.print("\n");
}
}
/**
*
*/
public EAILogFIleLoader() throws Exception {
super();
}
private static String getUsage() {
return "Usage> java " + EAILogFIleLoader.class.getName() + " [Config File Path] [Log File Path]";
}
/**
* @param args
*/
public static void main(String[] args) {
EAILogFIleLoader loader = null;
// Local Test : set false
boolean isReal = false;
String configPath = "C:\\trlog\\EAILogFileLoader.properties"; // args[0];
String filePath = "C:\\trlog\\tran.log"; //args[1];
try {
if(isReal && args.length < 2) {
System.out.println(getUsage());
System.exit(-1);
}
if(isReal) {
configPath = args[0];
filePath = args[1];
}
System.out.println("\n## START LOADING Infomation - " + configPath);
loader = new EAILogFIleLoader();
loader.init(configPath);
loader.parse(filePath);
} catch (Exception e) {
System.out.println("ERROR MAIN");
System.out.println(e.toString());
System.exit(-2);
}
System.exit(0);
}
}
@@ -0,0 +1,24 @@
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 ATSRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(CodeConversion.seToAsc(message), 40, 8);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [40,8]";
}
}
@@ -0,0 +1,27 @@
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 AppCodeRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
byte[] appCode = new byte[3];
System.arraycopy(message, 0, appCode, 0, appCode.length);
keys[0] = new String( CodeConversion.seToAsc(appCode) );
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [0,3]";
}
}
@@ -0,0 +1,66 @@
package com.kbstar.eai.flowcontrol.action;
import java.io.ByteArrayInputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.eactive.eai.flowcontrol.action.RouteActionException;
import com.eactive.eai.flowcontrol.action.RouteActionSupport;
public class CMBSRouteAction extends RouteActionSupport {
// 2009.02.13 정길영과장 요청사항
// CMBS용 라우팅 Action
// <InData ... mode="$Key" ... />
// mode 값을 추출한다.
//
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
// int keyIndex = 0;
String xml = "<?xml version=\"1.0\" encoding=\"EUC-KR\"?><Message>"+new String(message)+"</Message>";
DocumentBuilder builder = null;
try {
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
ByteArrayInputStream bis = new ByteArrayInputStream(xml.getBytes());
Document doc = builder.parse(bis);
Element root = doc.getDocumentElement();
NodeList lst = root.getChildNodes();
Node n = null;
String nodeName = "";
for(int i=0;i<lst.getLength();i++) {
n = lst.item(i);
nodeName = n.getNodeName();
if( "InData".equals(nodeName) ) {
if(n.hasAttributes()) {
Node aNode = ((Element)n).getAttributeNode("mode");
if(aNode != null && aNode.getNodeType() == Node.ATTRIBUTE_NODE) {
keys[0] = ((Attr)aNode).getValue();
}
}
}
}
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key : " +xml +" - " +e.getMessage());
}
if(keys[0] == null || keys[0].length() == 0) {
throw new RouteActionException(this.getClass().getName() +" GCMS mode not found Error : value ["+keys[0]+"]");
}
return keys;
}
public String getDescription() {
return "키추출방식 : <InData ... mode=\"$Key\" ... />";
}
}
@@ -0,0 +1,23 @@
package com.kbstar.eai.flowcontrol.action;
import com.eactive.eai.flowcontrol.action.RouteActionException;
import com.eactive.eai.flowcontrol.action.RouteActionSupport;
public class GCMSRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(message, 0, 8);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [0,8]";
}
}
@@ -0,0 +1,23 @@
package com.kbstar.eai.flowcontrol.action;
import com.eactive.eai.flowcontrol.action.RouteActionException;
import com.eactive.eai.flowcontrol.action.RouteActionSupport;
public class JKBULRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(message, 0, 3) + strncpy(message, 66, 2);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [0,3]+[66,2]";
}
}
@@ -0,0 +1,20 @@
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 KEDRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(CodeConversion.seToAsc(message), 9, 6);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
}
@@ -0,0 +1,27 @@
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.util.IConv;
public class KUKAdapterRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
//
String[] keys = new String[1];
int keyIndex = 0;
try {
//keys[0] = strncpy(message, 0, 1) + strncpy(message, 53, 2);
byte[] resBytes = new byte[2];
System.arraycopy(message, 1, resBytes, 0, resBytes.length );
keys[0] = IConv.ebcdicToASCII(resBytes);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [1,2]";
}
}
@@ -0,0 +1,18 @@
package com.kbstar.eai.flowcontrol.action;
import com.eactive.eai.flowcontrol.action.RouteActionSupport;
public class OTPRouteAction extends RouteActionSupport {
// OTP 통지응답거래를 위한 RouteAction으로 고정값(OTP)를 리턴한다.
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
keys[0] = "OTP";
return keys;
}
public String getDescription() {
return "키추출방식 : FIXED:OTP";
}
}
@@ -0,0 +1,24 @@
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 RCM1RouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(CodeConversion.seToAsc(message), 150, 8);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [150,8]";
}
}
@@ -0,0 +1,24 @@
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 RCM5RouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(CodeConversion.seToAsc(message), 9, 8);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [9,8]";
}
}
@@ -0,0 +1,24 @@
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 RCM8RouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(CodeConversion.seToAsc(message), 159, 8);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [159,8]";
}
}
@@ -0,0 +1,24 @@
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 RCMDANRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(CodeConversion.seToAsc(message), 52, 4);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [52,4]";
}
}
@@ -0,0 +1,24 @@
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 RCMKMBRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(CodeConversion.seToAsc(message), 4, 4);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [4,4]";
}
}
@@ -0,0 +1,24 @@
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 RCMSDSRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(CodeConversion.seToAsc(message), 9, 4);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [9,4]";
}
}
@@ -0,0 +1,25 @@
package com.kbstar.eai.flowcontrol.action;
import com.eactive.eai.flowcontrol.action.RouteActionException;
import com.eactive.eai.flowcontrol.action.RouteActionSupport;
public class SGWRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[2];
int keyIndex = 0;
try {
keys[0] = strncpy(message, 105, 2);
keyIndex++;
keys[1] = strncpy(message, 21, 1) + strncpy(message, 104, 3);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [105,2], 전문 [104,3]";
}
}
@@ -0,0 +1,30 @@
package com.kbstar.eai.flowcontrol.action;
//package com.eactive.eai.flowcontrol.action;
//
//import weblogic.wtc.jatmi.FldTbl;
//import weblogic.wtc.jatmi.TypedFML32;
//
//public class SYBFMLRouteAction extends RouteActionSupport {
//
// public String[] getRouteKeys(TypedFML32 fml) throws Exception {
// //-------------------------------
// // 2009.03.24 정길영과장 요청
// //-------------------------------
// // FML32의 STRING1 의 값을 추출
// // 앞의 6자리만 잘라서 사용 :
//
//
// String[] keys = new String[1];
// int keyIndex = 0;
// try {
// Class cl = Class.forName("com.eactive.eai.adapter.wtc.CrmFmlTable");
// FldTbl fldTable = (FldTbl)cl.newInstance();
// String str = (String)fml.Fget(fldTable.name_to_Fldid("STRING1"), 0);
//
// keys[0] = strncpy(str.getBytes(), 0, 6);
// } catch(Exception e) {
// throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
// }
// return keys;
// }
//}
@@ -0,0 +1,23 @@
package com.kbstar.eai.flowcontrol.action;
import com.eactive.eai.flowcontrol.action.RouteActionException;
import com.eactive.eai.flowcontrol.action.RouteActionSupport;
public class SYBRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
// 앞의 6자리만 잘라서 사용 : 2009.03.18 정길영과장 요청
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(message, 0, 6);
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [0,6]";
}
}
@@ -0,0 +1,71 @@
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 YGSHRouteAction extends RouteActionSupport {
public String[] getRouteKeys(byte[] message) throws Exception {
String[] keys = new String[1];
int keyIndex = 0;
try {
keys[0] = strncpy(CodeConversion.seToAsc(message), 177, 8);
// 2009.09.07 정길영과장 요청 - ASIS, TOBE // 2010.01.15 권세환대리 요청으로 주석처리
// if("50500323".equals(keys[0])) { // 동양증권 자동결재
// byte[] keyBytes = new byte[4];
// System.arraycopy(message, 158, keyBytes, 0, keyBytes.length);
// String keyStr = new String(CodeConversion.seToAsc(keyBytes));
//
// if("9613".equals(keyStr)) {
// keys[0] = keys[0] + "9";
// }
// }
// else
if("50500325".equals(keys[0])) { // 미래에셋증권 자동결재
byte[] keyBytes = new byte[4];
System.arraycopy(message, 158, keyBytes, 0, keyBytes.length);
String keyStr = new String(CodeConversion.seToAsc(keyBytes));
if("9613".equals(keyStr) ||
"9617".equals(keyStr)) {
// keys[0] = keys[0] + "9";
keys[0] = keys[0].substring(0,3) + "A" + keys[0].substring(4, keys[0].length());
}
}
// else if("50500312".equals(keys[0])) { // HMC증권 자동결재
// byte[] keyBytes = new byte[4];
// System.arraycopy(message, 158, keyBytes, 0, keyBytes.length);
// String keyStr = new String(CodeConversion.seToAsc(keyBytes));
// if("9613".equals(keyStr)) {
// keys[0] = keys[0] + "9";
// }
// }
} catch(Exception e) {
throw new RouteActionException(this.getClass().getName() +" Error Extract Key("+keyIndex+"): " +e.getMessage());
}
return keys;
}
public String getDescription() {
return "키추출방식 : 전문 [117,8] -> 미래에셋증권자동결재 확인(4번째자리 값을 A로 치환)";
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// String msg = "12345678";
// msg = msg.substring(0,3) + "A" + msg.substring(4, msg.length());
// System.out.println(msg);
//
// YGSHRouteAction action = new YGSHRouteAction();
// System.out.println(action.getDescription());
// }
}
@@ -0,0 +1,30 @@
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]";
}
}
@@ -0,0 +1,151 @@
package com.kbstar.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.agent.firstaccount.ShareMemory;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageKeyExtractor;
import com.eactive.eai.inbound.action.ActionException;
import com.eactive.eai.inbound.action.RequestActionSupport;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class CDSFirstAccountRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String eaiBizCode = null;
if(adptGrpVO != null) {
eaiBizCode = adptGrpVO.getEaiBizCode();
}
else {
eaiBizCode = getEaiBizCodeFromAdapterName(adapterGroupName);
}
if(message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
tmp = (byte[])message;
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ new String(tmp));
} else {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ message);
}
//집중계좌번호 호출 로직
ShareMemory sm = ShareMemory.getInstance();
String accNum = sm.getAccoutName();
for(int i=0; i<key.length; i++) {
//집중계좌 관련 추가 로직
//기본값 0000 이거나 null이면 아래로직 Pass
if(!"0000".equals(accNum) && accNum != null){
String[] parseAccount = accNum.split(";");
if( "0200310126".equals(key[i]) ) {
byte[] resCode = new byte[14];
System.arraycopy(message, 193, resCode, 0, 14);
for (int k = 0; k < parseAccount.length; k++) {
if(parseAccount[k].equals(new String(resCode).trim())){
key[i] = key[i] + "F";
}
}
}else if( "0200400120".equals(key[i]) ) {
byte[] resCode = new byte[14];
System.arraycopy(message, 193, resCode, 0, 14);
for (int k = 0; k < parseAccount.length; k++) {
if(parseAccount[k].equals(new String(resCode).trim())){
key[i] = key[i] + "F";
}
}
}else if( "0201400120".equals(key[i]) ) {
byte[] resCode = new byte[14];
System.arraycopy(message, 193, resCode, 0, 14);
for (int k = 0; k < parseAccount.length; k++) {
if(parseAccount[k].equals(new String(resCode).trim())){
key[i] = key[i] + "F";
}
}
}else if( "0200400100".equals(key[i]) ) {
byte[] resCode = new byte[14];
System.arraycopy(message, 193, resCode, 0, 14);
for (int k = 0; k < parseAccount.length; k++) {
if(parseAccount[k].equals(new String(resCode).trim())){
key[i] = key[i] + "F";
}
}
}
}
//----------------------------------------
key[i] = eaiBizCode.trim() + key[i];
}
return key;
}
public String getDescription() {
return "키추출방식 : 어댑터업무코드[3]+추출키값+집중계좌로직[F 추가?]";
}
// public static void main(String args[]) throws Exception {
// test(String args[]);
//}
//private static void test(String args[]) throws Exception {
// //byte[] message = "0248HDRELB02104000004000430201002111245423000007420100211004CN300000740040049277060060000060704095823902 0000000000001000공무원연금급여             0701 36013704003051 ".getBytes();
// byte[] message = "0473HDRISO0140000500200B238020148809000000000000380708C310126000000300000091516110627872216110609150010708170992359081=07099101916960700081070953343608170990053003436410 2059004=94450200175424020최성숙        007450991701174740000000020최성숙       70991019169607 1002810186967434000000000000000000000000000000000000000000000000000000000000000000****************************************************************************************************".getBytes();
// byte[] resCode = new byte[14];
// System.arraycopy(message, 193, resCode, 0, 14);
// /*
// String key = "";
// if("430".equals(new String(resCode))) {
// key = key + "430";
// }
// System.out.println(key);
// */
// System.out.println("["+new String(resCode).trim()+"]");
// String dd = "00001";
// if(!"0000".equals(dd) && dd != null){
// String[] parseAccount = dd.split(",");
// System.out.println(parseAccount.length );
// System.out.println(parseAccount[0]);
//
// }else{
// System.out.println("null");
// }
// }
}
@@ -0,0 +1,180 @@
package com.kbstar.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageKeyExtractor;
import com.eactive.eai.inbound.action.ActionException;
import com.eactive.eai.inbound.action.RequestActionSupport;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - 어뎁터의 업무그룹드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* - EBE(타행환)업무로직이 추가됨
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class EBEAdapterRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String eaiBizCode = null;
if(adptGrpVO != null) {
eaiBizCode = adptGrpVO.getEaiBizCode();
}
else {
eaiBizCode = getEaiBizCodeFromAdapterName(adapterGroupName);
}
if(message instanceof byte[]) {
tmp = (byte[])message;
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ new String(tmp));
try {
// 연계확인 로직 후 연계가 아닌 경우 등록한 룰을 통해 메시지키를 추출한다.
/*
tcp_length[4], // 0
tcp_hdr[3], // 4
system_id[2], // 7
bank_code[3], // 9
jeonmun_code[4], // 12
gubun_code[3], // 16
send_rcv_flag, // 19
rsp_code[3], // 20
acquire_bank_code[3], // 23 취급은행코드
acquire_jumpo_code[4], // 26 취급지점코드
acquire_gwanri_no[6], // 30 취급관리번호
acquire_jeonmun_time[12], // 36 취급전문시간
kft_gwanri_no[9], // 48 중계관리번호
kft_jeonmun_time[12], // 57 중계전문시간
issue_bank_code[3], // 69 개설은행코드
issue_jumpo_code[4], // 72 개설지점코드
issue_gwanri_no[6], // 76 개설관리번호
issue_jeonmun_time[12], // 82 개설전문시간
reserve[MAX_TRAN_LEN-92]; // 94
if ((strncmp(text.system_id, "03", 2) == 0) &&
((strncmp(text.jeonmun_code, "0200500", 7) == 0) ||
(strncmp(text.jeonmun_code, "9210500", 7) == 0)))
{
memset(yun_gae, (char)NULL, sizeof(yun_gae));
memcpy(yun_gae, text.reserve+12, 14);
status = Yun_Gae_Chk(yun_gae);
if (status == 0) // 연계계좌
*/
String system_id = new String(tmp, 7, 2);
String jeonmun_code = new String(tmp, 12, 7);
if("03".equals(system_id) &&
( "0200500".equals(jeonmun_code) || "9210500".equals(jeonmun_code)) ) {
int status = Yun_Gae_Chk(tmp);
if (status == 0) {
key = new String[1];
key[0] = jeonmun_code + "CYU";
}
else {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
}
}
else {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
}
} catch(Exception e) {
if (logger.isError()) logger.info(adapterName+"] EBEAdapterRequestAction "+ e.getMessage());
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
} else {
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ message);
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
if (logger.isError()) logger.info(adapterName+"] EBEAdapterRequestAction "+ e.getMessage());
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
}
for(int i=0; i<key.length; i++) {
key[i] = eaiBizCode.trim() + key[i];
}
return key;
}
public int Yun_Gae_Chk(byte[] message) {
int yun_gae_offset = 94 + 13; // 수취조회번호 12 -> 13
if( (bytesncmp(message, yun_gae_offset + 9 , " ")) ||
(bytesncmp(message, yun_gae_offset + 10 , " ")) ||
(bytesncmp(message, yun_gae_offset + 11 , " "))) {
return -1;
}
if( bytesncmp(message, yun_gae_offset + 12, " ")) {
if ((bytesncmp(message, yun_gae_offset + 3, "07")) ||
(bytesncmp(message, yun_gae_offset + 3, "08")) ||
(bytesncmp(message, yun_gae_offset + 3, "26"))) {
return 0; // 연계
}
}
else if ( ( bytesncmp(message, yun_gae_offset + 12, " ") ) == false) {
if (bytesncmp(message, yun_gae_offset + 4, "90")) {
return 0; // 연계
}
}
return -1;
}
public boolean bytesncmp(byte[] src, int startPos, String value) {
if(value == null || value.length() < 1) {
return false;
}
byte[] valueBytes = value.getBytes();
int valueBytesLength = valueBytes.length;
if(src == null || src.length <(startPos + valueBytesLength)) {
return false;
}
byte[] cmpareBytes = new byte[valueBytesLength];
System.arraycopy(src, startPos, cmpareBytes, 0, cmpareBytes.length );
if(value.equals(new String(cmpareBytes))) {
return true;
}
return false;
}
public String getDescription() {
return "키추출방식 : 연계계좌 확인 - 어댑터업무코드[3]+전문번호[7] +CYU , 아닐 경우 어댑터업무코드[3]+추출키값";
}
}
@@ -0,0 +1,147 @@
package com.kbstar.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.agent.firstaccount.ShareMemory;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageKeyExtractor;
import com.eactive.eai.inbound.action.ActionException;
import com.eactive.eai.inbound.action.RequestActionSupport;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class EBEFirstAccountRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String eaiBizCode = null;
if(adptGrpVO != null) {
eaiBizCode = adptGrpVO.getEaiBizCode();
}
else {
eaiBizCode = getEaiBizCodeFromAdapterName(adapterGroupName);
}
if(message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
tmp = (byte[])message;
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ new String(tmp));
} else {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ message);
}
//집중계좌번호 호출 로직
ShareMemory sm = ShareMemory.getInstance();
String accNum = sm.getAccoutName();
for(int i=0; i<key.length; i++) {
//집중계좌 관련 추가 로직
//기본값 0000 이거나 null이면 아래로직 Pass
if(!"0000".equals(accNum) && accNum != null){
String[] parseAccount = accNum.split(";");
if( "0200500".equals(key[i]) ) {
byte[] resCode = new byte[14];
System.arraycopy(message, 107, resCode, 0, 14);
for (int k = 0; k < parseAccount.length; k++) {
if(parseAccount[k].equals(new String(resCode).trim())){
key[i] = key[i] + "F";
}
}
}else if( "0200200".equals(key[i]) ) {
byte[] resCode = new byte[14];
System.arraycopy(message, 94, resCode, 0, 14);
for (int k = 0; k < parseAccount.length; k++) {
if(parseAccount[k].equals(new String(resCode).trim())){
key[i] = key[i] + "F";
}
}
}
}
//불능거래 동일 GUID 채번 문제 해결을 위한 우회 로직 추가
if( "0210200".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 20, resCode, 0, 3);
if(!new String(resCode).equals("000")){
key[i] = key[i] + "X";
}
}
//----------------------------------------
key[i] = eaiBizCode.trim() + key[i];
}
return key;
}
public String getDescription() {
return "키추출방식 : 어댑터업무코드[3]+추출키값+집중계좌로직[F 추가?]";
}
// public static void main(String[] atgs ) {
// byte[] message = "0248HDRELB02104000004000430201002111245423000007420100211004CN300000740040049277060060000060704095823902 0000000000001000공무원연금급여             0701 36013704003051 ".getBytes();
// //byte[] message = "0303HDR0300402102005000004816900000217092811193800400000217092811193905502500000051709281119390190140000 000000000001000000000000000000000000010000홍길동       테스트       00000000000481690000           ".getBytes();
// byte[] resCode = new byte[3];
// System.arraycopy(message, 20, resCode, 0, 3);
//
// if(!new String(resCode).equals("000")){
// System.out.println("not 000");
// }else{
// System.out.println("000");
// }
//
// /*
// String key = "";
// if("430".equals(new String(resCode))) {
// key = key + "430";
// }
// System.out.println(key);
// */
// System.out.println("["+new String(resCode).trim()+"]");
// String dd = "0000";
// if(!"0000".equals(dd) && dd != null){
// String[] parseAccount = dd.split(",");
// System.out.println(parseAccount[0]);
//
// }else{
// System.out.println("null");
// }
//
//
// }
}
@@ -0,0 +1,136 @@
package com.kbstar.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageKeyExtractor;
import com.eactive.eai.inbound.action.ActionException;
import com.eactive.eai.inbound.action.RequestActionSupport;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class EKHAdapterRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String eaiBizCode = null;
if(adptGrpVO != null) {
eaiBizCode = adptGrpVO.getEaiBizCode();
}
else {
eaiBizCode = getEaiBizCodeFromAdapterName(adapterGroupName);
}
if(message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
tmp = (byte[])message;
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ new String(tmp));
} else {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ message);
}
for(int i=0; i<key.length; i++) {
//----------------------------------------
// 2016.09.05 권세환
// 예외로직 추가
if( "0210400000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 23, resCode, 0, 3);
if("400".equals(new String(resCode))) {
key[i] = key[i] + "400";
}
}else if( "0210410000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 23, resCode, 0, 3);
if("400".equals(new String(resCode))) {
key[i] = key[i] + "400";
}
}else if( "0210420000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 23, resCode, 0, 3);
if("400".equals(new String(resCode))) {
key[i] = key[i] + "400";
}
}else if( "0410400000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 23, resCode, 0, 3);
if("311".equals(new String(resCode))) {
key[i] = key[i] + "311";
}
}else if( "0410410000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 23, resCode, 0, 3);
if("311".equals(new String(resCode))) {
key[i] = key[i] + "311";
}
}else if( "0410420000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 23, resCode, 0, 3);
if("311".equals(new String(resCode))) {
key[i] = key[i] + "311";
}
}
//----------------------------------------
key[i] = eaiBizCode.trim() + key[i];
}
return key;
}
public String getDescription() {
return "키추출방식 : 어댑터업무코드[3]+추출키값+예외처리코드[3]";
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// //byte[] message = "0248HDRELB02104000004000430201002111245423000007420100211004CN300000740040049277060060000060704095823902 0000000000001000공무원연금급여             0701 36013704003051 ".getBytes();
// byte[] message = "0248HDRVAT004021040000040004002016090622054700000105 2016090622052500420160906000105000                                                  004004001508108158682018191141고용린권병문윤여표원00153704001729 1128138910엄광만지(유)   58691000653604 01000011050000000000403000000003000000000000030000000000033000000000003000000000000030002016090600000000000000000000000000000000000000000000000000000000000000000000000000000000 ".getBytes();
// byte[] resCode = new byte[3];
// System.arraycopy(message, 27, resCode, 0, 3);
// System.out.println(new String(resCode));
// String key = "";
// if("400".equals(new String(resCode))) {
// key = key + "400";
// }
// System.out.println(key);
// }
}
@@ -0,0 +1,135 @@
package com.kbstar.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageKeyExtractor;
import com.eactive.eai.inbound.action.ActionException;
import com.eactive.eai.inbound.action.RequestActionSupport;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class ELBAdapterRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String eaiBizCode = null;
if(adptGrpVO != null) {
eaiBizCode = adptGrpVO.getEaiBizCode();
}
else {
eaiBizCode = getEaiBizCodeFromAdapterName(adapterGroupName);
}
if(message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
tmp = (byte[])message;
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ new String(tmp));
} else {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ message);
}
for(int i=0; i<key.length; i++) {
//----------------------------------------
// 2010.02.11 강길수 차장
// 전자 예외로직 추가
if( "0210400000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 24, resCode, 0, 3);
if("430".equals(new String(resCode))) {
key[i] = key[i] + "430";
}
}
// ----------------------------------------
// 2015.11.17 강길수 차장
// 전자 예외로직 추가
else if( "0210450000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 24, resCode, 0, 3);
if("430".equals(new String(resCode))) {
key[i] = key[i] + "430";
}else if("470".equals(new String(resCode))) {
key[i] = key[i] + "470";
}else if("480".equals(new String(resCode))) {
key[i] = key[i] + "480";
}
}else if( "0210451000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 24, resCode, 0, 3);
if("430".equals(new String(resCode))) {
key[i] = key[i] + "430";
}else if("470".equals(new String(resCode))) {
key[i] = key[i] + "470";
}else if("480".equals(new String(resCode))) {
key[i] = key[i] + "480";
}
}
//----------------------------------------
key[i] = eaiBizCode.trim() + key[i];
}
return key;
}
public String getDescription() {
return "키추출방식 : 어댑터업무코드[3]+추출키값+전자예외로직[3]";
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// byte[] message = "0248HDRELB02104000004000430201002111245423000007420100211004CN300000740040049277060060000060704095823902 0000000000001000공무원연금급여             0701 36013704003051 ".getBytes();
//
// byte[] resCode = new byte[3];
// System.arraycopy(message, 24, resCode, 0, 3);
//
// String key = "";
// if("430".equals(new String(resCode))) {
// key = key + "430";
// }
// System.out.println(key);
// }
}
@@ -0,0 +1,176 @@
package com.kbstar.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.agent.firstaccount.ShareMemory;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageKeyExtractor;
import com.eactive.eai.inbound.action.ActionException;
import com.eactive.eai.inbound.action.RequestActionSupport;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class ELBFirstAccountRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String eaiBizCode = null;
if(adptGrpVO != null) {
eaiBizCode = adptGrpVO.getEaiBizCode();
}
else {
eaiBizCode = getEaiBizCodeFromAdapterName(adapterGroupName);
}
if(message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
tmp = (byte[])message;
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ new String(tmp));
} else {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ message);
}
//집중계좌번호 호출 로직
ShareMemory sm = ShareMemory.getInstance();
String accNum = sm.getAccoutName();
for(int i=0; i<key.length; i++) {
//----------------------------------------
// 기존 ELB 예외로직
if( "0210400000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 24, resCode, 0, 3);
if("430".equals(new String(resCode))) {
key[i] = key[i] + "430";
}
}
else if( "0210450000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 24, resCode, 0, 3);
if("430".equals(new String(resCode))) {
key[i] = key[i] + "430";
}else if("470".equals(new String(resCode))) {
key[i] = key[i] + "470";
}else if("480".equals(new String(resCode))) {
key[i] = key[i] + "480";
}
}else if( "0210451000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 24, resCode, 0, 3);
if("430".equals(new String(resCode))) {
key[i] = key[i] + "430";
}else if("470".equals(new String(resCode))) {
key[i] = key[i] + "470";
}else if("480".equals(new String(resCode))) {
key[i] = key[i] + "480";
}
}
//집중계좌 관련 추가 로직
//기본값 0000 이거나 null이면 아래로직 Pass
if(!"0000".equals(accNum) && accNum != null){
String[] parseAccount = accNum.split(";");
if( "0200300000".equals(key[i]) ) {
byte[] resCode = new byte[14];
System.arraycopy(message, 90, resCode, 0, 14);
for (int k = 0; k < parseAccount.length; k++) {
if(parseAccount[k].equals(new String(resCode).trim())){
key[i] = key[i] + "F";
}
}
}else if( "0200400000".equals(key[i]) ) {
byte[] resCode = new byte[14];
System.arraycopy(message, 90, resCode, 0, 14);
for (int k = 0; k < parseAccount.length; k++) {
if(parseAccount[k].equals(new String(resCode).trim())){
key[i] = key[i] + "F";
}
}
}else if( "0201400000".equals(key[i]) ) {
byte[] resCode = new byte[14];
System.arraycopy(message, 90, resCode, 0, 14);
for (int k = 0; k < parseAccount.length; k++) {
if(parseAccount[k].equals(new String(resCode).trim())){
key[i] = key[i] + "F";
}
}
}
}
//----------------------------------------
key[i] = eaiBizCode.trim() + key[i];
}
return key;
}
public String getDescription() {
return "키추출방식 : 어댑터업무코드[3]+추출키값+전자예외로직[3]+집중계좌로직[F 추가?]";
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// //byte[] message = "0248HDRELB02104000004000430201002111245423000007420100211004CN300000740040049277060060000060704095823902 0000000000001000공무원연금급여             0701 36013704003051 ".getBytes();
// byte[] message = "0403HDRELB02003000002000 201708291637350133585920170829020IBG33155820200209000004000000023270104006666 0000000010000000이용익                 0200 1002843482936            ".getBytes();
// byte[] resCode = new byte[16];
// System.arraycopy(message, 90, resCode, 0, 16);
// /*
// String key = "";
// if("430".equals(new String(resCode))) {
// key = key + "430";
// }
// System.out.println(key);
// */
// System.out.println("["+new String(resCode).trim()+"]");
// String dd = "0000";
// if(!"0000".equals(dd) && dd != null){
// String[] parseAccount = dd.split(",");
// System.out.println(parseAccount[0]);
//
// }else{
// System.out.println("null");
// }
// }
}
@@ -0,0 +1,116 @@
package com.kbstar.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageKeyExtractor;
import com.eactive.eai.inbound.action.ActionException;
import com.eactive.eai.inbound.action.RequestActionSupport;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class EREAdapterRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 KESA를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String eaiBizCode = null;
if(adptGrpVO != null) {
eaiBizCode = adptGrpVO.getEaiBizCode();
}
else {
eaiBizCode = getEaiBizCodeFromAdapterName(adapterGroupName);
}
if(message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
tmp = (byte[])message;
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ new String(tmp));
} else {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ message);
}
for(int i=0; i<key.length; i++) {
//----------------------------------------
// 2016.08.30
// 전자 예외로직 추가
if( "0210300000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 24, resCode, 0, 3);
if("430".equals(new String(resCode))) {
key[i] = key[i] + "430";
}
}else if( "0210400000".equals(key[i]) ) {
byte[] resCode = new byte[3];
System.arraycopy(message, 24, resCode, 0, 3);
if("430".equals(new String(resCode))) {
key[i] = key[i] + "430";
}
}
key[i] = eaiBizCode.trim() + key[i];
}
return key;
}
public String getDescription() {
return "키추출방식 : 어댑터업무코드[3]+추출키값+전자예외로직[3]";
}
// public static void main(String args[]) throws Exception {
// test();
//}
// private static void test() throws Exception {
// byte[] message = "0248HDRELB02104000004000430201002111245423000007420100211004CN300000740040049277060060000060704095823902 0000000000001000공무원연금급여             0701 36013704003051 ".getBytes();
//
// byte[] resCode = new byte[3];
// System.arraycopy(message, 24, resCode, 0, 3);
//
// String key = "";
// if("430".equals(new String(resCode))) {
// key = key + "430";
// }
// System.out.println(key);
// }
}
@@ -0,0 +1,58 @@
package com.kbstar.eai.inbound.action;
import javax.jms.Message;
import com.eactive.eai.inbound.action.ActionException;
import com.eactive.eai.inbound.action.RequestActionSupport;
import com.eactive.eai.transformer.util.HexUtil;
public class MQGCMSRequestAction extends RequestActionSupport
{
public String[] perform(Object message) throws ActionException
{
String[] messageId = new String[1];
if (message instanceof Message) {
Message msg = (Message) message;
try {
String hexMsgId = msg.getJMSMessageID();
// ID:414d5120504149445f514d2020202020454949d720002f03
hexMsgId = hexMsgId.substring(3);
messageId[0] = HexUtil.hex2Ascii2Digit(hexMsgId);
logger.info(adapterName+"] MQ MessageID : " + messageId[0]);
} catch(Exception e) {
logger.error(adapterName+"] perform Exception Occur >> "+ e.getMessage(), e);
throw new ActionException(e.getMessage());
}
} else {
logger.error(adapterName+"] received Message Object >> "+ message.getClass().getName());
throw new ActionException();
}
return messageId;
}
public int getFeedback(Object message) throws ActionException
{
int feedback = -1;
if (message instanceof Message) {
Message msg = (Message) message;
try {
feedback = msg.getIntProperty("JMS_IBM_Feedback");
} catch(Exception e) {
logger.error(adapterName + "] Can not get feedback message >> " + e.getMessage());
//throw new ActionException(e.getMessage());
}
}
return feedback;
}
public String getDescription() {
return "키추출방식 : MQ JMSMessageID";
}
}
@@ -0,0 +1,33 @@
package com.kbstar.eai.inbound.action;
//package com.eactive.eai.inbound.action;
//
//import com.eactive.eai.adapter.wtc.CrmFmlTable;
//import com.eactive.eai.common.util.Logger;
//import weblogic.wtc.jatmi.Ferror;
//import weblogic.wtc.jatmi.TypedFML32;
//
//public class TuxedoCrmRequestAction extends RequestActionSupport
//{
//
// public String[] perform(Object message) throws ActionException
// {
// TypedFML32 inFml = null;
// String[] svcName = null;
// if(message instanceof TypedFML32) {
// if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ inFml.toString());
// try {
// inFml = (TypedFML32)message;
// svcName[0] = (String)inFml.Fget(CrmFmlTable.SVCNAME ,0);
// } catch(Ferror fe) {
// if (logger.isInfo()) logger.info(adapterName+"] perform Exception Occur >> "+ fe.getMessage());
// throw new ActionException(fe.getMessage());
// }
//
// } else {
// if (logger.isInfo()) logger.info(adapterName+"] received Message Object >> "+ message.getClass().getName());
// }
//
//
// return svcName;
// }
//}