LiuQhahah commented on code in PR #9004: URL: https://github.com/apache/gravitino/pull/9004#discussion_r2494671803
########## core/src/main/java/org/apache/gravitino/listener/api/event/policy/AlterPolicyEvent.java: ########## @@ -0,0 +1,83 @@ +/* + * 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.NameIdentifier; +import org.apache.gravitino.annotation.DeveloperApi; +import org.apache.gravitino.listener.api.info.PolicyInfo; +import org.apache.gravitino.policy.PolicyChange; + +/** Represents an event triggered upon the successful alteration of a policy. */ +@DeveloperApi +public final class AlterPolicyEvent extends PolicyEvent { Review Comment: done ########## core/src/main/java/org/apache/gravitino/listener/api/event/policy/AssociatePoliciesForMetadataObjectEvent.java: ########## @@ -0,0 +1,93 @@ +/* + * 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 that is triggered upon successfully associating policies with a metadata + * object. + */ +@DeveloperApi +public final class AssociatePoliciesForMetadataObjectEvent extends PolicyEvent { + private final MetadataObject metadataObject; + private final String[] policiesToAdd; + private final String[] policiesToRemove; + + /** + * Constructs an instance of {@code AssociatePoliciesForMetadataObjectEvent}. + * + * @param user The username of the individual who initiated the associate policies operation. + * @param metalake The metalake from which the policies were associated. + * @param metadataObject The metadata object with which the policies were associated. + * @param policiesToAdd The policies that were added. + * @param policiesToRemove The policies that were removed. + */ + public AssociatePoliciesForMetadataObjectEvent( + String user, + String metalake, + MetadataObject metadataObject, + String[] policiesToAdd, + String[] policiesToRemove) { + super(user, MetadataObjectUtil.toEntityIdent(metalake, metadataObject)); + this.metadataObject = metadataObject; + this.policiesToAdd = policiesToAdd != null ? policiesToAdd.clone() : new String[0]; + this.policiesToRemove = policiesToRemove != null ? policiesToRemove.clone() : new String[0]; + } + + /** + * Returns the metadata object with which policies were associated. + * + * @return the metadata object. + */ + public MetadataObject metadataObject() { + return metadataObject; + } + + /** + * Returns the policies that were added. + * + * @return an array of policy names that were added. + */ + public String[] policiesToAdd() { + return policiesToAdd.clone(); Review Comment: done -- 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]
