jerryshao commented on code in PR #7796:
URL: https://github.com/apache/gravitino/pull/7796#discussion_r2253513453
##########
core/src/main/java/org/apache/gravitino/SupportsRelationOperations.java:
##########
@@ -76,6 +77,30 @@ <E extends Entity & HasIdentifier> List<E>
listEntitiesByRelation(
Type relType, NameIdentifier nameIdentifier, Entity.EntityType
identType, boolean allFields)
throws IOException;
+ /**
+ * Get a specific entity that is related to a given source entity.
+ *
+ * <p>For example, this can be used to get a specific policy that is
directly associated with a
+ * metadata object.
+ *
+ * @param <E> The type of the entity to be returned.
+ * @param relType The type of relation.
+ * @param srcIdentifier The identifier of the source entity in the relation
(e.g., a metadata
+ * object).
+ * @param srcType The type of the source entity.
+ * @param entityIdent The identifier of the target entity to retrieve (e.g.,
a policy).
+ * @return The specific entity that is related to the source entity.
+ * @throws IOException If a storage-related error occurs.
+ * @throws NoSuchEntityException If the source entity or the target related
entity does not exist,
+ * or if the relation does not exist.
+ */
+ <E extends Entity & HasIdentifier> E getEntityByRelation(
+ Type relType,
+ NameIdentifier srcIdentifier,
+ Entity.EntityType srcType,
+ NameIdentifier entityIdent)
Review Comment:
Maybe we can rename to `destEntityIdent`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]