feat: align DDS with common permission and vector flow

This commit is contained in:
devmrko
2026-06-29 23:50:42 +09:00
parent ad9a2b7dd4
commit 2e4bcef44f
21 changed files with 1207 additions and 25 deletions

View File

@@ -5,6 +5,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Pattern;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.bind.ConstructorBinding;
@ConfigurationProperties(prefix = "dds")
public record DdsProperties(
@@ -12,6 +13,7 @@ public record DdsProperties(
Duration queryTimeout,
String pgObject,
String myObject,
String vectorObject,
Map<String, User> users
) {
@@ -19,11 +21,13 @@ public record DdsProperties(
"[A-Za-z][A-Za-z0-9_$#]*(\\.[A-Za-z][A-Za-z0-9_$#]*)*"
);
@ConstructorBinding
public DdsProperties {
dbUrl = dbUrl == null ? "" : dbUrl.trim();
queryTimeout = queryTimeout == null ? Duration.ofSeconds(10) : queryTimeout;
pgObject = normalizeObject(pgObject, "ADMIN.V_DDS_CUSTOMERS_PG");
myObject = normalizeObject(myObject, "ADMIN.V_DDS_CUSTOMERS_MY");
vectorObject = normalizeObject(vectorObject, "ADMIN.CB_DDS_VECTOR_SEARCH_DOCUMENTS");
var normalizedUsers = new LinkedHashMap<String, User>();
if (users != null) {
users.forEach((key, value) -> {
@@ -35,6 +39,22 @@ public record DdsProperties(
users = Map.copyOf(normalizedUsers);
}
/**
* Compatibility constructor for small unit tests and older local configs.
* The DDS vector view has a safe default and can still be overridden by
* {@code DDS_BACKOFFICE_VECTOR_OBJECT}.
*/
public DdsProperties(
String dbUrl,
Duration queryTimeout,
String pgObject,
String myObject,
Map<String, User> users
) {
this(dbUrl, queryTimeout, pgObject, myObject,
"ADMIN.CB_DDS_VECTOR_SEARCH_DOCUMENTS", users);
}
public String objectFor(String sourceKey) {
if ("PG".equalsIgnoreCase(sourceKey)) {
return pgObject;