package com.cloudhandson.vpdbackoffice.domain.masking; import java.util.Arrays; /** * Curated Data Redaction behaviours. A rule selects one template; operators * never enter raw DBMS_REDACT expressions from the backoffice UI. */ public enum MaskingTemplate { NULLIFY( "NULLIFY", "값 숨김 (NULL)", "값을 NULL로 반환합니다. ASO/Data Redaction 컬럼 마스킹에 사용합니다.", "DBMS_REDACT.NULLIFY", "NULL"), FULL( "FULL", "전체 마스킹", "전체 값을 가립니다. Oracle 기본값은 문자형 공백, 숫자형 0입니다.", "DBMS_REDACT.FULL", "문자형은 공백 / 숫자형은 0"), TEXT_PARTIAL( "TEXT_PARTIAL", "문자열 일부 마스킹", "첫 글자만 남기고 나머지를 가리는 사전 정의 문자열 규칙입니다.", "DBMS_REDACT.REGEXP", "A******** (예시)"), RRN_PARTIAL( "RRN_PARTIAL", "주민등록번호 부분 마스킹", "앞 6자리만 표시하고 나머지는 가리는 사전 정의 식별번호 규칙입니다.", "DBMS_REDACT.REGEXP", "900101-******* (예시)"); private final String code; private final String label; private final String description; private final String asoFunction; private final String previewResult; MaskingTemplate(String code, String label, String description, String asoFunction, String previewResult) { this.code = code; this.label = label; this.description = description; this.asoFunction = asoFunction; this.previewResult = previewResult; } public String code() { return code; } public String label() { return label; } public String description() { return description; } public String asoFunction() { return asoFunction; } /** Human-readable result shown before an administrator assigns the rule. */ public String previewResult() { return previewResult; } public static MaskingTemplate from(String code) { return Arrays.stream(values()) .filter(value -> value.code.equalsIgnoreCase(code)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("지원하지 않는 마스킹 템플릿입니다: " + code)); } }