-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What changes were proposed in this pull request? support list group ### Why are the changes needed? support list group Fix: #4873 ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? UT --------- Co-authored-by: Rory <roryqi@apache.org>
- Loading branch information
Showing
23 changed files
with
837 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
common/src/main/java/org/apache/gravitino/dto/responses/GroupListResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* 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.dto.responses; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.common.base.Preconditions; | ||
import java.util.Arrays; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.gravitino.dto.authorization.GroupDTO; | ||
|
||
/** Represents a response for a list of groups. */ | ||
@Getter | ||
@ToString | ||
@EqualsAndHashCode(callSuper = true) | ||
public class GroupListResponse extends BaseResponse { | ||
|
||
@JsonProperty("groups") | ||
private final GroupDTO[] groups; | ||
|
||
/** | ||
* Constructor for GroupListResponse. | ||
* | ||
* @param groups The array of group DTOs. | ||
*/ | ||
public GroupListResponse(GroupDTO[] groups) { | ||
super(0); | ||
this.groups = groups; | ||
} | ||
|
||
/** Default constructor for GroupListResponse. (Used for Jackson deserialization.) */ | ||
public GroupListResponse() { | ||
super(); | ||
this.groups = null; | ||
} | ||
|
||
/** | ||
* Validates the response data. | ||
* | ||
* @throws IllegalArgumentException if the name or audit is not set. | ||
*/ | ||
@Override | ||
public void validate() throws IllegalArgumentException { | ||
super.validate(); | ||
|
||
Preconditions.checkArgument(groups != null, "groups must not be null"); | ||
Arrays.stream(groups) | ||
.forEach( | ||
group -> { | ||
Preconditions.checkArgument( | ||
StringUtils.isNotBlank(group.name()), "group 'name' must not be blank"); | ||
Preconditions.checkArgument( | ||
group.auditInfo() != null, "group 'auditInfo' must not be null"); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.