FANNG1 commented on code in PR #5944:
URL: https://github.com/apache/gravitino/pull/5944#discussion_r1898338425


##########
core/src/main/java/org/apache/gravitino/listener/api/event/AlterTagFailureEvent.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.annotation.DeveloperApi;
+import org.apache.gravitino.tag.TagChange;
+import org.apache.gravitino.tag.TagManager;
+
+/**
+ * Represents an event triggered when an attempt to alter a tag in the 
database fails due to an
+ * exception.
+ */
+@DeveloperApi
+public class AlterTagFailureEvent extends TagFailureEvent {
+  private final String metalake;
+  private final String name;
+  private final TagChange[] changes;
+
+  /**
+   * Constructs a new AlterTagFailureEvent.
+   *
+   * @param user the user who attempted to alter the tag
+   * @param metalake the metalake identifier
+   * @param name the name of the tag
+   * @param changes the changes attempted to be made to the tag
+   * @param exception the exception that caused the failure
+   */
+  public AlterTagFailureEvent(
+      String user, String metalake, String name, TagChange[] changes, 
Exception exception) {
+    super(user, TagManager.ofTagIdent(metalake, name), exception);

Review Comment:
   It's odd to refer `TagManager` here, how about move `ofTagIdent` to 
`NameIdentifierUtil`?



##########
core/src/main/java/org/apache/gravitino/listener/api/event/AlterTagFailureEvent.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.annotation.DeveloperApi;
+import org.apache.gravitino.tag.TagChange;
+import org.apache.gravitino.tag.TagManager;
+
+/**
+ * Represents an event triggered when an attempt to alter a tag in the 
database fails due to an
+ * exception.
+ */
+@DeveloperApi
+public class AlterTagFailureEvent extends TagFailureEvent {
+  private final String metalake;
+  private final String name;
+  private final TagChange[] changes;
+
+  /**
+   * Constructs a new AlterTagFailureEvent.
+   *
+   * @param user the user who attempted to alter the tag
+   * @param metalake the metalake identifier
+   * @param name the name of the tag
+   * @param changes the changes attempted to be made to the tag
+   * @param exception the exception that caused the failure
+   */
+  public AlterTagFailureEvent(
+      String user, String metalake, String name, TagChange[] changes, 
Exception exception) {
+    super(user, TagManager.ofTagIdent(metalake, name), exception);
+    this.name = name;
+    this.metalake = metalake;
+    this.changes = changes;
+  }
+
+  /**
+   * Returns the name of the tag.
+   *
+   * @return the name of the tag
+   */
+  public String name() {

Review Comment:
   please remove `name()` and `metalake()`, because they are not temp variables 
to generate tag identifier



##########
core/src/main/java/org/apache/gravitino/listener/api/event/AssociateTagsForMetadataObjectFailureEvent.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.MetadataObject;
+import org.apache.gravitino.annotation.DeveloperApi;
+import org.apache.gravitino.utils.MetadataObjectUtil;
+
+/**
+ * Represents an event triggered when an attempt to associate tags for a 
metadata object fails due
+ * to an exception.
+ */
+@DeveloperApi
+public class AssociateTagsForMetadataObjectFailureEvent extends 
TagFailureEvent {
+  private final String metalake;
+  private final MetadataObject metadataObject;
+  private final String[] tagsToAdd;
+  private final String[] tagsToRemove;
+
+  /**
+   * Constructs a new {@code AssociateTagsForMetadataObjectFailureEvent} 
instance.
+   *
+   * @param user The user who initiated the operation.
+   * @param metalake The metalake name where the metadata object resides.
+   * @param metadataObject The metadata object for which tags are being 
associated.
+   * @param tagsToAdd The tags to add.
+   * @param tagsToRemove The tags to remove.
+   * @param exception The exception encountered during the operation, 
providing insights into the
+   *     reasons behind the failure.
+   */
+  public AssociateTagsForMetadataObjectFailureEvent(
+      String user,
+      String metalake,
+      MetadataObject metadataObject,
+      String[] tagsToAdd,
+      String[] tagsToRemove,
+      Exception exception) {
+    super(user, MetadataObjectUtil.toEntityIdent(metalake, metadataObject), 
exception);
+    this.metalake = metalake;
+    this.metadataObject = metadataObject;
+    this.tagsToAdd = tagsToAdd;
+    this.tagsToRemove = tagsToRemove;
+  }
+
+  /**
+   * Returns the metalake name where the metadata object resides.
+   *
+   * @return The metalake name.
+   */
+  public String metalake() {
+    return metalake;
+  }
+
+  /**
+   * Returns the metadata object for which tags are being associated.
+   *
+   * @return The metadata object.
+   */
+  public MetadataObject metadataObject() {

Review Comment:
   remove `metadataObject ` and `metalake ` too



##########
core/src/main/java/org/apache/gravitino/listener/api/event/AssociateTagsForMetadataObjectFailureEvent.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.gravitino.listener.api.event;
+
+import org.apache.gravitino.MetadataObject;
+import org.apache.gravitino.annotation.DeveloperApi;
+import org.apache.gravitino.utils.MetadataObjectUtil;
+
+/**
+ * Represents an event triggered when an attempt to associate tags for a 
metadata object fails due
+ * to an exception.
+ */
+@DeveloperApi
+public class AssociateTagsForMetadataObjectFailureEvent extends 
TagFailureEvent {
+  private final String metalake;
+  private final MetadataObject metadataObject;
+  private final String[] tagsToAdd;
+  private final String[] tagsToRemove;
+
+  /**
+   * Constructs a new {@code AssociateTagsForMetadataObjectFailureEvent} 
instance.
+   *
+   * @param user The user who initiated the operation.
+   * @param metalake The metalake name where the metadata object resides.
+   * @param metadataObject The metadata object for which tags are being 
associated.
+   * @param tagsToAdd The tags to add.
+   * @param tagsToRemove The tags to remove.
+   * @param exception The exception encountered during the operation, 
providing insights into the
+   *     reasons behind the failure.
+   */
+  public AssociateTagsForMetadataObjectFailureEvent(
+      String user,
+      String metalake,
+      MetadataObject metadataObject,
+      String[] tagsToAdd,
+      String[] tagsToRemove,
+      Exception exception) {
+    super(user, MetadataObjectUtil.toEntityIdent(metalake, metadataObject), 
exception);
+    this.metalake = metalake;
+    this.metadataObject = metadataObject;
+    this.tagsToAdd = tagsToAdd;
+    this.tagsToRemove = tagsToRemove;
+  }
+
+  /**
+   * Returns the metalake name where the metadata object resides.
+   *
+   * @return The metalake name.
+   */
+  public String metalake() {
+    return metalake;
+  }
+
+  /**
+   * Returns the metadata object for which tags are being associated.
+   *
+   * @return The metadata object.
+   */
+  public MetadataObject metadataObject() {

Review Comment:
   please check other events



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