From a113d765ae882cdf5d2b452b84bfed5cedb0e1c0 Mon Sep 17 00:00:00 2001 From: Yingjian Wu Date: Thu, 6 Jun 2024 09:36:20 -0700 Subject: [PATCH] improve comments --- .../ParentChildRelMetadataConstants.java | 14 ++++++------- .../ParentChildRelMetadataService.java | 20 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/metacat-common-server/src/main/java/com/netflix/metacat/common/server/usermetadata/ParentChildRelMetadataConstants.java b/metacat-common-server/src/main/java/com/netflix/metacat/common/server/usermetadata/ParentChildRelMetadataConstants.java index bb1304ccc..a0c825d35 100644 --- a/metacat-common-server/src/main/java/com/netflix/metacat/common/server/usermetadata/ParentChildRelMetadataConstants.java +++ b/metacat-common-server/src/main/java/com/netflix/metacat/common/server/usermetadata/ParentChildRelMetadataConstants.java @@ -7,35 +7,35 @@ */ public final class ParentChildRelMetadataConstants { /** - * Key specified in DefinitionMetadata that indicate the parent table name. + * During create, top level key specified in DefinitionMetadata that indicate the parent table name. */ public static final String PARENTNAME = "root_table_name"; /** - * During create, the key specified in DefinitionMetadata that indicates the parent table uuid. + * During create, top level key specified in DefinitionMetadata that indicates the parent table uuid. */ public static final String PARENTUUID = "root_table_uuid"; /** - * During create, the key specified in DefinitionMetadata that indicates the child table uuid. + * During create, top level key specified in DefinitionMetadata that indicates the child table uuid. */ public static final String CHILDUUID = "child_table_uuid"; /** - * During create, the key specified in DefinitionMetadata that indicates relationType. + * During create, top level key specified in DefinitionMetadata that indicates relationType. */ public static final String RELATIONTYPE = "relationType"; /** - * During get, the key specified in DefinitionMetadata that indicates the parent child infos. + * During get, top level key specified in DefinitionMetadata that indicates the parent child infos. */ public static final String PARENTCHILDRELINFO = "parentChildRelationInfo"; /** - * During get, the key specified in DefinitionMetadata[PARENTCHILDRELINFO] that indicates parent infos. + * During get, the nested key specified in DefinitionMetadata[PARENTCHILDRELINFO] that indicates parent infos. */ public static final String PARENTINFOS = "parentInfos"; /** - * During get, the key specified in DefinitionMetadata[PARENTCHILDRELINFO] that indicates child infos. + * During get, the nested key specified in DefinitionMetadata[PARENTCHILDRELINFO] that indicates child infos. */ public static final String CHILDINFOS = "childInfos"; diff --git a/metacat-common-server/src/main/java/com/netflix/metacat/common/server/usermetadata/ParentChildRelMetadataService.java b/metacat-common-server/src/main/java/com/netflix/metacat/common/server/usermetadata/ParentChildRelMetadataService.java index e9b60d13e..11b6f5460 100644 --- a/metacat-common-server/src/main/java/com/netflix/metacat/common/server/usermetadata/ParentChildRelMetadataService.java +++ b/metacat-common-server/src/main/java/com/netflix/metacat/common/server/usermetadata/ParentChildRelMetadataService.java @@ -16,7 +16,8 @@ public interface ParentChildRelMetadataService { * Establishes a parent-child relationship with a specified relation type. * Currently, exceptions are thrown in the following cases: * 1. Attempting to create a child table as the parent of another child table. - * 2. A child table having more than one parent. + * 2. Attempting to create a parent table on top of a parent table + * 3. A child table having more than one parent. * * @param parentName the name of the parent entity * @param parentUUID the uuid of the parent @@ -51,12 +52,13 @@ void deleteParentChildRelation( /** * Renames `oldName` to `newName` in the parentChildRelationship store. + * If the uuid is specified, we will only rename that table with the specified uuid + * If the uuid is not specified, we will rename that table * This involves two steps: * 1. Rename all records where the child is `oldName` to `newName` * and if the uuid is present also include it in the sql search string. * 2. Rename all records where the parent is `oldName` to `newName` * and if the uuid is present also include it in the sql search string. - * For now, since a child cannot be a parent of another entity, only one of these actions will need to be performed. * * @param oldName the current name to be renamed * @param newName the new name to rename to @@ -70,12 +72,8 @@ void rename( /** * Removes the entity from the parentChildRelationship store. - * An exception is thrown if an attempt is made to drop a parent table that still has existing child tables. - * Note that only dropping a child table will result in the physical deletion of records. - * When all children of a parent table are dropped, no records remain. - * Consequently, at then time when dropping the parent table, there should not have any database records - * with a parent reference to the dropping parent table. - * + * If the uuid is specified, we will only drop that table with the specified uuid + * If the uuid is not specified, we will drop that table * @param name the name of the entity to drop * @param uuid the uuid of the entity */ @@ -86,7 +84,8 @@ void drop( /** * get the set of parent for the input name. - * + * If the uuid is specified, we will only getParents for that table and the specified uuid + * If the uuid is not specified, we will getParents for that table * @param name name * @param uuid the uuid of the entity * @return parentInfo @@ -98,7 +97,8 @@ Set getParents( /** * get the set of children for the input name. - * + * If the uuid is specified, we will only getChildren for that table and the specified uuid + * If the uuid is not specified, we will getChildren for that table * @param name name * @param uuid the uuid of the entity * @return a set of ChildInfo