use of org.apache.inlong.manager.common.pojo.workflow.form.InlongGroupApproveForm in project incubator-inlong by apache.
the class GroupPassTaskListener method listen.
@Override
public ListenerResult listen(WorkflowContext context) throws WorkflowListenerException {
// Save the data format selected at the time of approval and the cluster information of the inlong stream
InlongGroupApproveForm form = (InlongGroupApproveForm) context.getActionContext().getForm();
InlongGroupApproveRequest approveInfo = form.getGroupApproveInfo();
// Only the [Wait approval] status allowed the passing operation
String groupId = approveInfo.getInlongGroupId();
InlongGroupEntity entity = groupMapper.selectByGroupId(groupId);
if (entity == null) {
throw new WorkflowListenerException("inlong group not found with group id=" + groupId);
}
if (!Objects.equals(GroupState.TO_BE_APPROVAL.getCode(), entity.getStatus())) {
throw new WorkflowListenerException("inlong group status is [wait_approval], not allowed to approve again");
}
// Save the inlong group information after approval
groupService.updateAfterApprove(approveInfo, context.getApplicant());
// Save inlong stream information after approval
List<InlongStreamApproveRequest> streamApproveInfoList = form.getStreamApproveInfoList();
streamService.updateAfterApprove(streamApproveInfoList, context.getApplicant());
return ListenerResult.success();
}
Aggregations