jerryshao commented on code in PR #14326:
URL: https://github.com/apache/gravitino/pull/14326#discussion_r4510595120


##########
core/src/main/java/org/apache/gravitino/policy/PolicyManager.java:
##########
@@ -73,6 +78,54 @@ public PolicyManager(IdGenerator idGenerator, EntityStore 
entityStore) {
     this.objectPolicyResolver = new ObjectPolicyResolver(entityStore);
   }
 
+  /**
+   * Applies a policy to an object through its hidden tag using the entity 
store.
+   *
+   * <p>The hidden tag is created with the policy. This method loads that tag 
and submits an
+   * idempotent object assignment. The relation operation validates the object 
endpoint and owns the
+   * transaction.
+   *
+   * <p>This internal method is not exposed through the policy dispatcher or 
client APIs.
+   *
+   * @param metalake The policy and object's metalake.
+   * @param policyName The policy name.
+   * @param object The metadata object to associate.
+   * @param auditInfo The audit information to preserve on newly created 
relations.
+   * @return The policy's hidden tag ID.
+   * @throws IOException If an entity or relation cannot be persisted.
+   * @throws NoSuchEntityException If the policy, hidden tag or target object 
does not exist.
+   * @throws IllegalArgumentException If the object type does not support tag 
assignments.
+   */
+  public long addPolicyToObject(
+      String metalake, String policyName, MetadataObject object, Audit 
auditInfo)
+      throws IOException {
+    Preconditions.checkNotNull(auditInfo, "Policy binding audit information is 
required");

Review Comment:
   Don't use checkNotNull.



-- 
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]

Reply via email to