use of org.apache.inlong.manager.common.pojo.workflow.FilterKey in project incubator-inlong by apache.
the class WorkflowApproverServiceImpl method getApprovers.
@Override
public List<String> getApprovers(String processName, String taskName, WorkflowApproverFilterContext context) {
WorkflowApproverQuery approverQuery = WorkflowApproverQuery.builder().processName(processName).taskName(taskName).build();
List<WorkflowApproverEntity> configs = workflowApproverMapper.selectByQuery(approverQuery);
Map<String, List<WorkflowApproverEntity>> groupByFilterKey = configs.stream().collect(Collectors.groupingBy(WorkflowApproverEntity::getFilterKey));
Map<FilterKey, String> filterKey2ValueMap = context.toFilterKeyMap();
return FilterKey.getFilterKeyByOrder().stream().map(FilterKey::name).map(groupByFilterKey::get).filter(Objects::nonNull).flatMap(List::stream).filter(config -> checkFilterCondition(filterKey2ValueMap, config)).findFirst().map(WorkflowApproverEntity::getApprovers).map(approvers -> Arrays.asList(approvers.split(","))).orElse(null);
}
Aggregations