diff --git a/src/main/java/com/eactive/eai/rms/onl/transaction/apim/ApiInterfaceService.java b/src/main/java/com/eactive/eai/rms/onl/transaction/apim/ApiInterfaceService.java index c3c521a..4fecc3f 100644 --- a/src/main/java/com/eactive/eai/rms/onl/transaction/apim/ApiInterfaceService.java +++ b/src/main/java/com/eactive/eai/rms/onl/transaction/apim/ApiInterfaceService.java @@ -1180,17 +1180,54 @@ public class ApiInterfaceService extends OnlBaseService { apiInterfaceUI.setInboundRestPath(newInboundRestPath); if ("Y".equals(apiInterfaceUI.getTransformYn())) { - apiInterfaceUI.setInboundRequestLayout(changeToTargetLayoutUI(layoutManService.getLayoutUiToExport(apiInterfaceUI.getInboundRequestLayout()), newBizCd, newApiInterfaceId)); - apiInterfaceUI.setOutboundRequestLayout(changeToTargetLayoutUI(layoutManService.getLayoutUiToExport(apiInterfaceUI.getOutboundRequestLayout()), newBizCd, newApiInterfaceId)); - apiInterfaceUI.setOutboundResponseLayout(changeToTargetLayoutUI(layoutManService.getLayoutUiToExport(apiInterfaceUI.getOutboundResponseLayout()), newBizCd, newApiInterfaceId)); - apiInterfaceUI.setInboundResponseLayout(changeToTargetLayoutUI(layoutManService.getLayoutUiToExport(apiInterfaceUI.getInboundResponseLayout()), newBizCd, newApiInterfaceId)); - - apiInterfaceUI.setRequestTransform(changeToTargetTransformUI(transform2Service.getTransformUiToExport(apiInterfaceUI.getRequestTransform()), newBizCd, newApiInterfaceId, apiInterfaceUI.getInboundRequestLayout(), apiInterfaceUI.getOutboundRequestLayout())); - apiInterfaceUI.setResponseTransform(changeToTargetTransformUI(transform2Service.getTransformUiToExport(apiInterfaceUI.getResponseTransform()), newBizCd, newApiInterfaceId, apiInterfaceUI.getOutboundResponseLayout(), apiInterfaceUI.getInboundResponseLayout())); + + String newInReq = processLayoutIfExist(apiInterfaceUI.getInboundRequestLayout(), newBizCd, newApiInterfaceId); + String newOutReq = processLayoutIfExist(apiInterfaceUI.getOutboundRequestLayout(), newBizCd, newApiInterfaceId); + String newOutRes = processLayoutIfExist(apiInterfaceUI.getOutboundResponseLayout(), newBizCd, newApiInterfaceId); + String newInRes = processLayoutIfExist(apiInterfaceUI.getInboundResponseLayout(), newBizCd, newApiInterfaceId); + + apiInterfaceUI.setInboundRequestLayout(newInReq); + apiInterfaceUI.setOutboundRequestLayout(newOutReq); + apiInterfaceUI.setOutboundResponseLayout(newOutRes); + apiInterfaceUI.setInboundResponseLayout(newInRes); + + if (newInReq != null && newOutReq != null) { + apiInterfaceUI.setRequestTransform( + changeToTargetTransformUI( + transform2Service.getTransformUiToExport(apiInterfaceUI.getRequestTransform()), + newBizCd, newApiInterfaceId, newInReq, newOutReq + ) + ); + } + + if (newOutRes != null && newInRes != null) { + apiInterfaceUI.setResponseTransform( + changeToTargetTransformUI( + transform2Service.getTransformUiToExport(apiInterfaceUI.getResponseTransform()), + newBizCd, newApiInterfaceId, newOutRes, newInRes + ) + ); + } + } importApiInterfaceUi(apiInterfaceUI, importDupliCheck); return apiInterfaceUI; } + + /* + * 복제시 레이아웃 정보가 있는 경우에만 변환 로직을 수행 + */ + private String processLayoutIfExist(String layoutId, String newBizCd, String newApiInterfaceId) { + + if (layoutId == null || layoutId.isEmpty()) { + return null; + } + + LayoutUI layoutEntity = layoutManService.getLayoutUiToExport(layoutId); + + return changeToTargetLayoutUI(layoutEntity, newBizCd, newApiInterfaceId); + + } }