refactor: apply Glow standard to dap-tool-core (usecase, javadoc, etc)
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled
This commit is contained in:
@@ -15,6 +15,21 @@ import org.springframework.stereotype.Component;
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.lib.integration.eai.component
|
||||
* @className AxhubEaiComponent
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 0986406
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 0986406 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class AxhubEaiComponent {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
||||
@@ -22,6 +22,21 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.lib.integration.mci.component
|
||||
* @className AxhubMciComponent
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 0986406
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 0986406 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class AxhubMciComponent {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
||||
@@ -9,6 +9,21 @@ import org.springframework.context.annotation.Configuration;
|
||||
* ComponentScan에 잡히게 되면 이 설정 클래스는 삭제하세요.
|
||||
*/
|
||||
@Configuration
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.lib.integration.mci.config
|
||||
* @className GlowMockConfig
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 0986406
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 0986406 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class GlowMockConfig {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -5,6 +5,21 @@ import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.lib.integration.mci.enums
|
||||
* @className IndvCtinRoleTyp
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 0986406
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 0986406 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public enum IndvCtinRoleTyp {
|
||||
CD_Z99("Z99");
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.shinhanlife.dap.lib.session.domain.service;
|
||||
package io.shinhanlife.dap.lib.session.domain.usecase;
|
||||
|
||||
import io.shinhanlife.dap.lib.session.dto.ZtUsacInDto;
|
||||
import io.shinhanlife.dap.lib.session.dto.ZtUsacOutDto;
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.lib.session.domain.service
|
||||
* @className ZtUsacService
|
||||
* @className ZtUsacUseCase
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 0986406
|
||||
* @create 2026.09.01
|
||||
@@ -17,7 +17,7 @@ import io.shinhanlife.dap.lib.session.dto.ZtUsacOutDto;
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public interface ZtUsacService {
|
||||
public interface ZtUsacUseCase {
|
||||
|
||||
/**
|
||||
* 사용자 조회 (단건)
|
||||
@@ -1,15 +1,15 @@
|
||||
package io.shinhanlife.dap.lib.session.domain.service.impl;
|
||||
package io.shinhanlife.dap.lib.session.domain.usecase.impl;
|
||||
|
||||
import io.shinhanlife.dap.lib.session.domain.repository.ZtUsacRepository;
|
||||
import io.shinhanlife.dap.lib.session.domain.service.ZtUsacService;
|
||||
import io.shinhanlife.dap.lib.session.domain.usecase.ZtUsacUseCase;
|
||||
import io.shinhanlife.dap.lib.session.dto.ZtUsacInDto;
|
||||
import io.shinhanlife.dap.lib.session.dto.ZtUsacOutDto;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.lib.session.domain.service.impl
|
||||
* @className ZtUsacServiceImpl
|
||||
* @package io.shinhanlife.dap.lib.session.domain.usecase.impl
|
||||
* @className ZtUsacUseCaseImpl
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 0986406
|
||||
* @create 2026.09.01
|
||||
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ZtUsacServiceImpl implements ZtUsacService {
|
||||
public class ZtUsacUseCaseImpl implements ZtUsacUseCase {
|
||||
|
||||
private final ZtUsacRepository ztUsacRepository;
|
||||
|
||||
@@ -6,7 +6,7 @@ import io.shinhanlife.glow.BizException;
|
||||
import io.shinhanlife.glow.GlowControllerId;
|
||||
import io.shinhanlife.glow.ResponseUtil;
|
||||
import io.shinhanlife.dap.lib.session.converter.ZtUsacConverter;
|
||||
import io.shinhanlife.dap.lib.session.domain.service.ZtUsacService;
|
||||
import io.shinhanlife.dap.lib.session.domain.usecase.ZtUsacUseCase;
|
||||
import io.shinhanlife.dap.lib.session.dto.SessionDto;
|
||||
import io.shinhanlife.dap.lib.session.dto.ZtUsacInDto;
|
||||
import io.shinhanlife.dap.lib.session.dto.ZtUsacOutDto;
|
||||
@@ -46,7 +46,7 @@ import java.util.Objects;
|
||||
public class SsoRestController {
|
||||
|
||||
private static final String NLS_LOGIN_URL = "";
|
||||
private final ZtUsacService ztUsacService;
|
||||
private final ZtUsacUseCase ztUsacService;
|
||||
private final ZtUsacConverter ztUsacConverter;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,68 +1,83 @@
|
||||
package io.shinhanlife.dap.lib.util;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
|
||||
import io.shinhanlife.dap.lib.annotation.McpParameter;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class JsonSchemaGenerator {
|
||||
|
||||
/**
|
||||
* Java DTO 클래스를 분석하여 MCP 규격의 완전한 JSON Schema를 생성합니다.
|
||||
*/
|
||||
public static Map<String, Object> generateSchema(Class<?> clazz) {
|
||||
Map<String, Object> schema = new HashMap<>();
|
||||
schema.put("type", "object");
|
||||
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
List<String> requiredList = new ArrayList<>();
|
||||
|
||||
for (Field field : clazz.getDeclaredFields()) {
|
||||
Map<String, Object> fieldSchema = new HashMap<>();
|
||||
|
||||
// 1. 타입 매핑
|
||||
fieldSchema.put("type", mapJavaTypeToJsonType(field.getType()));
|
||||
|
||||
// 2. 어노테이션 기반 설명 추출
|
||||
McpParameter paramAnnotation = field.getAnnotation(McpParameter.class);
|
||||
JsonPropertyDescription descAnnotation = field.getAnnotation(JsonPropertyDescription.class);
|
||||
if (paramAnnotation != null && !paramAnnotation.description().isEmpty()) {
|
||||
fieldSchema.put("description", paramAnnotation.description());
|
||||
} else if (descAnnotation != null && !descAnnotation.value().isEmpty()) {
|
||||
fieldSchema.put("description", descAnnotation.value());
|
||||
} else {
|
||||
fieldSchema.put("description", field.getName()); // 기본값
|
||||
}
|
||||
|
||||
// 3. 필수 여부 판단
|
||||
JsonProperty jsonProp = field.getAnnotation(JsonProperty.class);
|
||||
if ((jsonProp != null && jsonProp.required()) || (paramAnnotation != null && paramAnnotation.required())) {
|
||||
requiredList.add(field.getName());
|
||||
}
|
||||
|
||||
properties.put(field.getName(), fieldSchema);
|
||||
}
|
||||
|
||||
schema.put("properties", properties);
|
||||
if (!requiredList.isEmpty()) {
|
||||
schema.put("required", requiredList);
|
||||
}
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
private static String mapJavaTypeToJsonType(Class<?> clazz) {
|
||||
if (clazz == String.class) return "string";
|
||||
if (clazz == Integer.class || clazz == int.class) return "integer";
|
||||
if (clazz == Long.class || clazz == long.class) return "integer";
|
||||
if (clazz == Double.class || clazz == double.class) return "number";
|
||||
if (clazz == Float.class || clazz == float.class) return "number";
|
||||
if (clazz == Boolean.class || clazz == boolean.class) return "boolean";
|
||||
if (List.class.isAssignableFrom(clazz)) return "array";
|
||||
return "object";
|
||||
}
|
||||
}
|
||||
package io.shinhanlife.dap.lib.util;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
|
||||
import io.shinhanlife.dap.lib.annotation.McpParameter;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.lib.util
|
||||
* @className JsonSchemaGenerator
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 0986406
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 0986406 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class JsonSchemaGenerator {
|
||||
|
||||
/**
|
||||
* Java DTO 클래스를 분석하여 MCP 규격의 완전한 JSON Schema를 생성합니다.
|
||||
*/
|
||||
public static Map<String, Object> generateSchema(Class<?> clazz) {
|
||||
Map<String, Object> schema = new HashMap<>();
|
||||
schema.put("type", "object");
|
||||
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
List<String> requiredList = new ArrayList<>();
|
||||
|
||||
for (Field field : clazz.getDeclaredFields()) {
|
||||
Map<String, Object> fieldSchema = new HashMap<>();
|
||||
|
||||
// 1. 타입 매핑
|
||||
fieldSchema.put("type", mapJavaTypeToJsonType(field.getType()));
|
||||
|
||||
// 2. 어노테이션 기반 설명 추출
|
||||
McpParameter paramAnnotation = field.getAnnotation(McpParameter.class);
|
||||
JsonPropertyDescription descAnnotation = field.getAnnotation(JsonPropertyDescription.class);
|
||||
if (paramAnnotation != null && !paramAnnotation.description().isEmpty()) {
|
||||
fieldSchema.put("description", paramAnnotation.description());
|
||||
} else if (descAnnotation != null && !descAnnotation.value().isEmpty()) {
|
||||
fieldSchema.put("description", descAnnotation.value());
|
||||
} else {
|
||||
fieldSchema.put("description", field.getName()); // 기본값
|
||||
}
|
||||
|
||||
// 3. 필수 여부 판단
|
||||
JsonProperty jsonProp = field.getAnnotation(JsonProperty.class);
|
||||
if ((jsonProp != null && jsonProp.required()) || (paramAnnotation != null && paramAnnotation.required())) {
|
||||
requiredList.add(field.getName());
|
||||
}
|
||||
|
||||
properties.put(field.getName(), fieldSchema);
|
||||
}
|
||||
|
||||
schema.put("properties", properties);
|
||||
if (!requiredList.isEmpty()) {
|
||||
schema.put("required", requiredList);
|
||||
}
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
private static String mapJavaTypeToJsonType(Class<?> clazz) {
|
||||
if (clazz == String.class) return "string";
|
||||
if (clazz == Integer.class || clazz == int.class) return "integer";
|
||||
if (clazz == Long.class || clazz == long.class) return "integer";
|
||||
if (clazz == Double.class || clazz == double.class) return "number";
|
||||
if (clazz == Float.class || clazz == float.class) return "number";
|
||||
if (clazz == Boolean.class || clazz == boolean.class) return "boolean";
|
||||
if (List.class.isAssignableFrom(clazz)) return "array";
|
||||
return "object";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ public class ToolScaffolder {
|
||||
String toolName = baseName.isEmpty() ? baseName : Character.toLowerCase(baseName.charAt(0)) + baseName.substring(1);
|
||||
|
||||
String serviceInterfaceContent = """
|
||||
package %s.service;
|
||||
package %s.usecase;
|
||||
|
||||
import %s.dto.%sRequest;
|
||||
|
||||
@@ -191,13 +191,13 @@ public class ToolScaffolder {
|
||||
|
||||
if (isMci) {
|
||||
serviceImplContent = """
|
||||
package %s.service.impl;
|
||||
package %s.usecase.impl;
|
||||
|
||||
import %s.annotation.McpFunction;
|
||||
import %s.annotation.McpTool;
|
||||
import %s.dto.%sRequest;
|
||||
import %s.dto.%sResponse;
|
||||
import %s.service.%sService;
|
||||
import %s.usecase.%sService;
|
||||
import io.shinhanlife.dap.lib.integration.mci.component.AxhubMciComponent;
|
||||
import io.shinhanlife.glow.communication.dto.Transfer;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -208,7 +208,7 @@ public class ToolScaffolder {
|
||||
import %s.infra.itrf.mci.%s.io.%s_I;
|
||||
|
||||
/**
|
||||
* @package %s.service.impl
|
||||
* @package %s.usecase.impl
|
||||
* @className %sServiceImpl
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author %s
|
||||
@@ -286,21 +286,21 @@ public class ToolScaffolder {
|
||||
);
|
||||
} else {
|
||||
serviceImplContent = """
|
||||
package %s.service.impl;
|
||||
package %s.usecase.impl;
|
||||
|
||||
import %s.annotation.McpFunction;
|
||||
import %s.annotation.McpTool;
|
||||
import %s.dto.%sRequest;
|
||||
import %s.dto.%sResponse;
|
||||
import %s.service.%sService;
|
||||
import %s.service.AbstractMcpToolService;
|
||||
import %s.usecase.%sService;
|
||||
import %s.usecase.AbstractMcpToolUseCase;
|
||||
import %s.converter.%sLegacyConverter;
|
||||
import org.springframework.stereotype.Service;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @package %s.service.impl
|
||||
* @package %s.usecase.impl
|
||||
* @className %sServiceImpl
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author %s
|
||||
@@ -320,7 +320,7 @@ public class ToolScaffolder {
|
||||
routingType = "%s",
|
||||
categoryKey = "%s"
|
||||
)
|
||||
public class %sServiceImpl extends AbstractMcpToolService implements %sService {
|
||||
public class %sServiceImpl extends AbstractMcpToolUseCase implements %sService {
|
||||
|
||||
private final %sLegacyConverter converter;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import io.shinhanlife.dap.lib.annotation.McpFunction;
|
||||
import io.shinhanlife.dap.lib.annotation.McpTool;
|
||||
import io.shinhanlife.dap.lib.config.McpProperties;
|
||||
import io.shinhanlife.dap.mcc.dto.ToolMetadata;
|
||||
import io.shinhanlife.dap.mcc.service.ToolRegistryHeartbeatSender;
|
||||
import io.shinhanlife.dap.mcc.usecase.ToolRegistryHeartbeatSender;
|
||||
import io.shinhanlife.dap.lib.util.JsonSchemaGenerator;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.shinhanlife.dap.mcc.service;
|
||||
package io.shinhanlife.dap.mcc.usecase;
|
||||
|
||||
import io.shinhanlife.dap.lib.adapter.connector.LegacyEimsConnector;
|
||||
import io.shinhanlife.dap.lib.adapter.util.PiiMaskingUtils;
|
||||
@@ -14,7 +14,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.mcc.service
|
||||
* @className AbstractMcpToolService
|
||||
* @className AbstractMcpToolUseCase
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 0986406
|
||||
* @create 2026.09.01
|
||||
@@ -27,7 +27,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class AbstractMcpToolService {
|
||||
public abstract class AbstractMcpToolUseCase {
|
||||
|
||||
@Autowired
|
||||
protected LegacyEimsConnector legacyEimsConnector;
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.shinhanlife.dap.mcc.service;
|
||||
package io.shinhanlife.dap.mcc.usecase;
|
||||
|
||||
|
||||
/**
|
||||
Reference in New Issue
Block a user