Search in sources :

Example 1 with WorkflowApproverFilterContext

use of org.apache.inlong.manager.common.pojo.workflow.WorkflowApproverFilterContext in project incubator-inlong by apache.

the class NewGroupWorkflowDefinition method getTaskApprovers.

/**
 * Get task approvers by task name
 */
private List<String> getTaskApprovers(String taskName) {
    String processName = this.getProcessName().name();
    WorkflowApproverFilterContext context = new WorkflowApproverFilterContext();
    return workflowApproverService.getApprovers(processName, taskName, context);
}
Also used : WorkflowApproverFilterContext(org.apache.inlong.manager.common.pojo.workflow.WorkflowApproverFilterContext)

Example 2 with WorkflowApproverFilterContext

use of org.apache.inlong.manager.common.pojo.workflow.WorkflowApproverFilterContext 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);
}
Also used : WorkflowApproverQuery(org.apache.inlong.manager.common.pojo.workflow.WorkflowApproverQuery) WorkflowApprover(org.apache.inlong.manager.common.pojo.workflow.WorkflowApprover) Arrays(java.util.Arrays) EntityStatus(org.apache.inlong.manager.common.enums.EntityStatus) WorkflowApproverEntity(org.apache.inlong.manager.dao.entity.WorkflowApproverEntity) Date(java.util.Date) WorkflowApproverService(org.apache.inlong.manager.service.core.WorkflowApproverService) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) Collectors(java.util.stream.Collectors) WorkflowEngine(org.apache.inlong.manager.workflow.core.WorkflowEngine) WorkflowProcess(org.apache.inlong.manager.workflow.definition.WorkflowProcess) Objects(java.util.Objects) WorkflowApproverFilterContext(org.apache.inlong.manager.common.pojo.workflow.WorkflowApproverFilterContext) List(java.util.List) WorkflowTask(org.apache.inlong.manager.workflow.definition.WorkflowTask) Preconditions(org.apache.inlong.manager.common.util.Preconditions) UserTask(org.apache.inlong.manager.workflow.definition.UserTask) Service(org.springframework.stereotype.Service) Map(java.util.Map) WorkflowApproverQuery(org.apache.inlong.manager.common.pojo.workflow.WorkflowApproverQuery) Optional(java.util.Optional) FilterKey(org.apache.inlong.manager.common.pojo.workflow.FilterKey) CommonBeanUtils(org.apache.inlong.manager.common.util.CommonBeanUtils) WorkflowApproverEntityMapper(org.apache.inlong.manager.dao.mapper.WorkflowApproverEntityMapper) Objects(java.util.Objects) List(java.util.List) WorkflowApproverEntity(org.apache.inlong.manager.dao.entity.WorkflowApproverEntity) FilterKey(org.apache.inlong.manager.common.pojo.workflow.FilterKey)

Aggregations

WorkflowApproverFilterContext (org.apache.inlong.manager.common.pojo.workflow.WorkflowApproverFilterContext)2 Arrays (java.util.Arrays)1 Date (java.util.Date)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 StringUtils (org.apache.commons.lang3.StringUtils)1 EntityStatus (org.apache.inlong.manager.common.enums.EntityStatus)1 FilterKey (org.apache.inlong.manager.common.pojo.workflow.FilterKey)1 WorkflowApprover (org.apache.inlong.manager.common.pojo.workflow.WorkflowApprover)1 WorkflowApproverQuery (org.apache.inlong.manager.common.pojo.workflow.WorkflowApproverQuery)1 CommonBeanUtils (org.apache.inlong.manager.common.util.CommonBeanUtils)1 Preconditions (org.apache.inlong.manager.common.util.Preconditions)1 WorkflowApproverEntity (org.apache.inlong.manager.dao.entity.WorkflowApproverEntity)1 WorkflowApproverEntityMapper (org.apache.inlong.manager.dao.mapper.WorkflowApproverEntityMapper)1 WorkflowApproverService (org.apache.inlong.manager.service.core.WorkflowApproverService)1 WorkflowEngine (org.apache.inlong.manager.workflow.core.WorkflowEngine)1 UserTask (org.apache.inlong.manager.workflow.definition.UserTask)1