woofyzhao commented on code in PR #5080:
URL: https://github.com/apache/inlong/pull/5080#discussion_r922930978
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/group/GroupCheckService.java:
##########
@@ -37,30 +35,28 @@
@Service
public class GroupCheckService {
- private static final Logger LOGGER =
LoggerFactory.getLogger(GroupCheckService.class);
-
@Autowired
private InlongGroupEntityMapper groupMapper;
/**
* Check whether the inlong group status is temporary
*
- * @param groupId Inlong group id
- * @return Inlong group entity, for caller reuse
+ * @param groupId inlong group id
+ * @return inlong group entity, for caller reuse
*/
public InlongGroupEntity checkGroupStatus(String groupId, String operator)
{
InlongGroupEntity inlongGroupEntity =
groupMapper.selectByGroupId(groupId);
- Preconditions.checkNotNull(inlongGroupEntity, "groupId is invalid");
+ if (inlongGroupEntity == null) {
+ throw new BusinessException(String.format("InlongGroup does not
exist with InlongGroupId=%s", groupId));
+ }
List<String> managers =
Arrays.asList(inlongGroupEntity.getInCharges().split(","));
Preconditions.checkTrue(managers.contains(operator),
String.format(ErrorCodeEnum.USER_IS_NOT_MANAGER.getMessage(),
operator, managers));
- GroupStatus state = GroupStatus.forCode(inlongGroupEntity.getStatus());
- // Add/modify/delete is not allowed under certain group state
- if (GroupStatus.notAllowedUpdate(state)) {
- LOGGER.error("inlong group status was not allowed to
add/update/delete related info");
- throw new
BusinessException(ErrorCodeEnum.OPT_NOT_ALLOWED_BY_STATUS);
+ GroupStatus status =
GroupStatus.forCode(inlongGroupEntity.getStatus());
+ if (GroupStatus.notAllowedUpdate(status)) {
+ throw new
BusinessException(String.format(ErrorCodeEnum.OPT_NOT_ALLOWED_BY_STATUS.getMessage(),
status));
Review Comment:
Does the string constant have place holder for status to format?
--
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]