Skip to content

Commit

Permalink
default flags to false
Browse files Browse the repository at this point in the history
  • Loading branch information
Yingjian Wu committed Jul 7, 2024
1 parent 9bd01c5 commit 17ad8a2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
@Data
@Slf4j
public class ParentChildRelationshipProperties {
private boolean createEnabled = true;
private boolean getEnabled = true;
private boolean renameEnabled = true;
private boolean dropEnabled = true;
private static final String MAX_ALLOW_PER_TABLE_PER_REL_PROPERTY_NAME =
"metacat.parentChildRelationshipProperties.maxAllowPerTablePerRelConfig";
private static final String MAX_ALLOW_PER_DB_PER_REL_PROPERTY_NAME =
"metacat.parentChildRelationshipProperties.maxAllowPerDBPerRelConfig";
private static final String DEFAULT_MAX_ALLOW_PER_REL_PROPERTY_NAME =
"metacat.parentChildRelationshipProperties.defaultMaxAllowPerRelConfig";
private boolean createEnabled;
private boolean getEnabled;
private boolean renameEnabled;
private boolean dropEnabled;
private int maxAllow = 5;
private Map<String, Map<String, Integer>> maxAllowPerTablePerRelType = new HashMap<>();
private Map<String, Map<String, Integer>> maxAllowPerDBPerRelType = new HashMap<>();
private Map<String, Integer> defaultMaxAllowPerRelType = new HashMap<>();
private String maxAllowPerTablePerRelPropertyName =
"metacat.parentChildRelationshipProperties.maxAllowPerTablePerRelConfig";
private String maxAllowPerDBPerRelPropertyName =
"metacat.parentChildRelationshipProperties.maxAllowPerDBPerRelConfig";
private String defaultMaxAllowPerRelPropertyName =
"metacat.parentChildRelationshipProperties.defaultMaxAllowPerRelConfig";

/**
* Constructor.
Expand All @@ -41,13 +41,13 @@ public class ParentChildRelationshipProperties {
public ParentChildRelationshipProperties(@Nullable final Environment env) {
if (env != null) {
setMaxAllowPerTablePerRelType(
env.getProperty(maxAllowPerTablePerRelPropertyName, String.class, "")
env.getProperty(MAX_ALLOW_PER_TABLE_PER_REL_PROPERTY_NAME, String.class, "")
);
setMaxAllowPerDBPerRelType(
env.getProperty(maxAllowPerDBPerRelPropertyName, String.class, "")
env.getProperty(MAX_ALLOW_PER_DB_PER_REL_PROPERTY_NAME, String.class, "")
);
setDefaultMaxAllowPerRelType(
env.getProperty(defaultMaxAllowPerRelPropertyName, String.class, "")
env.getProperty(DEFAULT_MAX_ALLOW_PER_REL_PROPERTY_NAME, String.class, "")
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ services:
-Dmetacat.table.delete.noDeleteOnTags=do_not_drop,iceberg_migration_do_not_modify
-Dmetacat.table.rename.noRenameOnTags=do_not_rename,iceberg_migration_do_not_modify
-Dmetacat.table.update.noUpdateOnTags=iceberg_migration_do_not_modify
-Dmetacat.event.updateIcebergTablePostEventEnabled=true'
-Dmetacat.event.updateIcebergTablePostEventEnabled=true
-Dmetacat.parentChildRelationshipProperties.createEnabled=true
-Dmetacat.parentChildRelationshipProperties.getEnabled=true
-Dmetacat.parentChildRelationshipProperties.renameEnabled=true
-Dmetacat.parentChildRelationshipProperties.dropEnabled=true'
labels:
- "com.netflix.metacat.oss.test"
- "com.netflix.metacat.oss.test.war"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ private void validateMaxAllow(final QualifiedName parentName,

if (getChildrenCountPerType(parentName, type) >= maxAllow) {
final String errorMsg = String.format(
"Parent table: %s is not allow to have more than %s child table",
parentName, maxAllow);
"Parent table: %s is not allow to have more than %s child table for %s relation type",
parentName, maxAllow, type);
throw new ParentChildRelServiceException(errorMsg);
}
}
Expand Down

0 comments on commit 17ad8a2

Please sign in to comment.