78 lines
2.3 KiB
Java
78 lines
2.3 KiB
Java
package com.cloudhandson.vpdbackoffice.domain.masking;
|
|
|
|
/**
|
|
* Read-only comparison between the configured masking metadata and the
|
|
* corresponding Oracle Data Redaction policy stored in the database.
|
|
*/
|
|
public record MaskingPolicyStatus(
|
|
String owner,
|
|
String objectName,
|
|
String policyName,
|
|
String enabled,
|
|
int configuredColumnCount,
|
|
int appliedColumnCount,
|
|
int mismatchedColumnCount,
|
|
int legacyVpdColumnPolicyCount
|
|
) {
|
|
|
|
public String targetLabel() {
|
|
return owner + "." + objectName;
|
|
}
|
|
|
|
public boolean policyEnabled() {
|
|
return "YES".equalsIgnoreCase(enabled);
|
|
}
|
|
|
|
/** A policy with no configured active column is correct only while disabled. */
|
|
public boolean inactiveAsExpected() {
|
|
return configuredColumnCount == 0 && !policyEnabled() && legacyVpdColumnPolicyCount == 0;
|
|
}
|
|
|
|
public boolean applied() {
|
|
return configuredColumnCount > 0
|
|
&& policyEnabled()
|
|
&& configuredColumnCount == appliedColumnCount
|
|
&& mismatchedColumnCount == 0
|
|
&& legacyVpdColumnPolicyCount == 0;
|
|
}
|
|
|
|
public String statusLabel() {
|
|
if (applied()) {
|
|
return "적용됨";
|
|
}
|
|
if (inactiveAsExpected()) {
|
|
return "미적용";
|
|
}
|
|
return "설정-DB 불일치";
|
|
}
|
|
|
|
public String badgeClass() {
|
|
if (applied()) {
|
|
return "text-bg-success";
|
|
}
|
|
if (inactiveAsExpected()) {
|
|
return "text-bg-secondary";
|
|
}
|
|
return "text-bg-danger";
|
|
}
|
|
|
|
public String detail() {
|
|
if (applied()) {
|
|
return "활성 규칙과 DB 정책 컬럼이 일치합니다.";
|
|
}
|
|
if (legacyVpdColumnPolicyCount > 0) {
|
|
return "기존 컬럼 NULL 정책(VPD CLS)이 활성입니다. ASO 설정과 별도로 값을 NULL 처리할 수 있습니다.";
|
|
}
|
|
if (inactiveAsExpected()) {
|
|
return "활성 컬럼 기본 규칙이 없어 DB 정책을 중지 상태로 보관합니다.";
|
|
}
|
|
if (configuredColumnCount > 0 && !policyEnabled()) {
|
|
return "활성 규칙이 있으나 DB 정책이 비활성입니다. 동기화가 필요합니다.";
|
|
}
|
|
if (configuredColumnCount == 0) {
|
|
return "활성 규칙이 없는데 DB 정책이 활성입니다. 동기화가 필요합니다.";
|
|
}
|
|
return "설정 컬럼과 DB Redaction 컬럼이 다릅니다. 동기화가 필요합니다.";
|
|
}
|
|
}
|