init
This commit is contained in:
+78
@@ -0,0 +1,78 @@
|
||||
package com.eactive.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;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Rest Url 추출 용
|
||||
* 2. 처리 개요 :
|
||||
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
|
||||
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author :
|
||||
* @version : v 1.0.0
|
||||
* @see :
|
||||
* @since :
|
||||
*/
|
||||
public class RestDataAdapterGroupParseRequestAction extends RequestActionSupport
|
||||
{
|
||||
/**
|
||||
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 표준메시지를 생성하기 위한 키값을 추출
|
||||
* 2. 처리 개요 :
|
||||
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param message Object 타입의 요청메시지
|
||||
* @return String 비표준메시지의 메시지키값
|
||||
* @exception
|
||||
**/
|
||||
public String[] perform(Object message) throws ActionException
|
||||
{
|
||||
String[] key = null;
|
||||
|
||||
AdapterManager adapterManager = AdapterManager.getInstance();
|
||||
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
|
||||
String adptGrpName = adptGrpVO.getName();
|
||||
if (adptGrpName != null && adptGrpName.length() >= 4) {
|
||||
String chnl = adptGrpName.substring(1, 4);
|
||||
if (adptGrpName.indexOf("{") >= 0 && adptGrpName.indexOf("}") >= 0
|
||||
&& adptGrpName.indexOf("{") < adptGrpName.indexOf("}")) {
|
||||
int start = adptGrpName.indexOf("{") + 1;
|
||||
int end = adptGrpName.indexOf("}");
|
||||
String inst = adptGrpName.substring(start, end);
|
||||
adptGrpName = chnl + inst;
|
||||
} else {
|
||||
adptGrpName = chnl;
|
||||
}
|
||||
}
|
||||
|
||||
if(message instanceof byte[]) {
|
||||
try {
|
||||
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "data", true);
|
||||
} catch(Exception e) {
|
||||
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
|
||||
}
|
||||
if (logger.isDebug()) logger.debug(adapterName+"] received data >> ["+ new String((byte[])message)+"]");
|
||||
} else {
|
||||
try {
|
||||
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "data", true);
|
||||
} catch(Exception e) {
|
||||
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
|
||||
}
|
||||
if (logger.isDebug()) logger.debug(adapterName+"] received data >> ["+ message+"]");
|
||||
}
|
||||
|
||||
|
||||
|
||||
for(int i=0; i<key.length; i++) {
|
||||
key[i] = adptGrpName.trim() + key[i];
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user