yunchipang commented on issue #7700:
URL: https://github.com/apache/gravitino/issues/7700#issuecomment-3090216725
proposed solution: extend `BaseEvent` to support multiple identifiers
```java
public abstract class BaseEvent {
@Nullable private final NameIdentifier[] identifiers;
// constructor for multiple identifiers
protected BaseEvent(String user, NameIdentifier[] identifiers) {
this.user = user;
this.identifiers = identifiers;
}
// constructor for single identifier (backward compatibility)
protected BaseEvent(String user, NameIdentifier identifier) {
this.user = user;
this.identifiers = identifier != null ? new NameIdentifier[]{identifier}
: null;
}
// backward compatible accessor - returns single identifier
// new accessor - returns all identifiers
}
```
```java
public final class ListMetadataObjectsForTagsEvent extends TagEvent {
private final String[] tagNames;
public ListMetadataObjectsForTagsEvent(String user, String metalake,
String[] tagNames) {
super(user, createTagIdentifiers(metalake, tagNames));
this.tagNames = tagNames;
}
private static NameIdentifier[] createTagIdentifiers(String metalake,
String[] tagNames) {
// get all tag identifiers using tag names, returns an array of tag
identifieres
}
}
```
This approach should be easier to extend in the future when other events
also need to support multi-identifier. @mchades @FANNG1 wdyt?
--
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]