Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.dolphinscheduler.common.enums.AuditOperationType;
import org.apache.dolphinscheduler.dao.entity.AuditLog;
import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
import org.apache.dolphinscheduler.dao.mapper.WorkflowInstanceMapper;
import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao;

import org.apache.commons.lang3.math.NumberUtils;

Expand All @@ -38,7 +38,7 @@
public class WorkflowInstanceAuditOperatorImpl extends BaseAuditOperator {

@Autowired
private WorkflowInstanceMapper workflowInstanceMapper;
private WorkflowInstanceDao workflowInstanceDao;

@Override
public void modifyAuditOperationType(AuditType auditType, Map<String, Object> paramsMap,
Expand All @@ -64,7 +64,7 @@ protected String getObjectNameFromIdentity(Object identity) {
return "";
}

WorkflowInstance obj = workflowInstanceMapper.queryDetailById(objId);
WorkflowInstance obj = workflowInstanceDao.queryDetailById(objId);
return obj == null ? "" : obj.getName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.CommandMapper;
import org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper;
import org.apache.dolphinscheduler.dao.mapper.WorkflowInstanceMapper;
import org.apache.dolphinscheduler.dao.model.TaskInstanceStatusCountDto;
import org.apache.dolphinscheduler.dao.model.WorkflowDefinitionCountDto;
import org.apache.dolphinscheduler.dao.model.WorkflowInstanceStatusCountDto;
import org.apache.dolphinscheduler.dao.repository.ProjectDao;
import org.apache.dolphinscheduler.dao.repository.TaskInstanceDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowDefinitionDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao;

import org.apache.commons.collections4.CollectionUtils;

Expand Down Expand Up @@ -76,7 +76,7 @@ public class DataAnalysisServiceImpl extends BaseServiceImpl implements DataAnal
private ProjectService projectService;

@Autowired
private WorkflowInstanceMapper workflowInstanceMapper;
private WorkflowInstanceDao workflowInstanceDao;

@Autowired
private WorkflowDefinitionDao workflowDefinitionDao;
Expand Down Expand Up @@ -126,7 +126,7 @@ public WorkflowInstanceCountVO getWorkflowInstanceStateCountByProject(User login
projectService.checkProjectAndAuthThrowException(loginUser, projectCode, PROJECT_OVERVIEW);
Date start = startDate == null ? null : transformDate(startDate);
Date end = endDate == null ? null : transformDate(endDate);
List<WorkflowInstanceStatusCountDto> workflowInstanceStatusCountDtos = workflowInstanceMapper
List<WorkflowInstanceStatusCountDto> workflowInstanceStatusCountDtos = workflowInstanceDao
.countWorkflowInstanceStateByProjectCodes(start, end, Lists.newArrayList(projectCode));
return WorkflowInstanceCountVO.of(workflowInstanceStatusCountDtos);
}
Expand All @@ -143,7 +143,7 @@ public WorkflowInstanceCountVO getAllWorkflowInstanceStateCount(User loginUser,
Date end = endDate == null ? null : transformDate(endDate);

List<WorkflowInstanceStatusCountDto> workflowInstanceStatusCountDtos =
workflowInstanceMapper.countWorkflowInstanceStateByProjectCodes(start, end, projectCodes);
workflowInstanceDao.countWorkflowInstanceStateByProjectCodes(start, end, projectCodes);
return WorkflowInstanceCountVO.of(workflowInstanceStatusCountDtos);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
import org.apache.dolphinscheduler.dao.mapper.WorkflowInstanceMapper;
import org.apache.dolphinscheduler.dao.repository.ScheduleDao;
import org.apache.dolphinscheduler.dao.repository.TenantDao;
import org.apache.dolphinscheduler.dao.repository.UserDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -67,7 +67,7 @@ public class TenantServiceImpl extends BaseServiceImpl implements TenantService
private TenantDao tenantDao;

@Autowired
private WorkflowInstanceMapper workflowInstanceMapper;
private WorkflowInstanceDao workflowInstanceDao;

@Autowired
private ScheduleDao scheduleDao;
Expand Down Expand Up @@ -244,11 +244,11 @@ public void deleteTenantById(User loginUser, int id) throws Exception {
throw new ServiceException(Status.DELETE_TENANT_BY_ID_ERROR);
}

workflowInstanceMapper.updateWorkflowInstanceByTenantCode(tenant.getTenantCode(), Constants.DEFAULT);
workflowInstanceDao.updateWorkflowInstanceByTenantCode(tenant.getTenantCode(), Constants.DEFAULT);
}

private List<WorkflowInstance> getWorkflowInstancesByTenant(Tenant tenant) {
return workflowInstanceMapper.queryByTenantCodeAndStatus(
return workflowInstanceDao.queryByTenantCodeAndStatus(
tenant.getTenantCode(),
WorkflowExecutionStatus.NOT_TERMINAL_STATES);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
import org.apache.dolphinscheduler.dao.mapper.EnvironmentWorkerGroupRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.WorkflowInstanceMapper;
import org.apache.dolphinscheduler.dao.repository.ScheduleDao;
import org.apache.dolphinscheduler.dao.repository.WorkerGroupDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowDefinitionDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao;
import org.apache.dolphinscheduler.extract.base.client.Clients;
import org.apache.dolphinscheduler.extract.master.IMasterContainerService;
import org.apache.dolphinscheduler.registry.api.RegistryClient;
Expand Down Expand Up @@ -81,7 +81,7 @@ public class WorkerGroupServiceImpl extends BaseServiceImpl implements WorkerGro
private WorkerGroupDao workerGroupDao;

@Autowired
private WorkflowInstanceMapper workflowInstanceMapper;
private WorkflowInstanceDao workflowInstanceDao;

@Autowired
private RegistryClient registryClient;
Expand Down Expand Up @@ -322,7 +322,7 @@ public void deleteWorkerGroupById(User loginUser, Integer id) {
log.error("Worker group does not exist, workerGroupId:{}.", id);
throw new ServiceException(Status.DELETE_WORKER_GROUP_NOT_EXIST);
}
List<WorkflowInstance> workflowInstances = workflowInstanceMapper.queryByWorkerGroupNameAndStatus(
List<WorkflowInstance> workflowInstances = workflowInstanceDao.queryByWorkerGroupNameAndStatus(
workerGroup.getName(),
WorkflowExecutionStatus.NOT_TERMINAL_STATES);
if (CollectionUtils.isNotEmpty(workflowInstances)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.WorkflowDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.WorkflowInstanceMapper;
import org.apache.dolphinscheduler.dao.repository.ProjectDao;
import org.apache.dolphinscheduler.dao.repository.TaskInstanceContextDao;
import org.apache.dolphinscheduler.dao.repository.TaskInstanceDao;
Expand Down Expand Up @@ -134,9 +133,6 @@ public class WorkflowInstanceServiceImpl extends BaseServiceImpl implements Work
@Autowired
private TaskInstanceService taskInstanceService;

@Autowired
WorkflowInstanceMapper workflowInstanceMapper;

@Autowired
WorkflowInstanceDao workflowInstanceDao;

Expand Down Expand Up @@ -198,7 +194,7 @@ public List<WorkflowInstance> queryTopNLongestRunningWorkflowInstance(User login
throw new ServiceException(Status.START_TIME_BIGGER_THAN_END_TIME_ERROR, startTime, endTime);
}

return workflowInstanceMapper.queryTopNWorkflowInstance(size, start, end, WorkflowExecutionStatus.SUCCESS,
return workflowInstanceDao.queryTopNWorkflowInstance(size, start, end, WorkflowExecutionStatus.SUCCESS,
projectCode);
}

Expand Down Expand Up @@ -254,7 +250,7 @@ public Result<PageInfo<WorkflowInstance>> queryWorkflowInstanceList(User loginUs
Page<WorkflowInstance> page = new Page<>(pageNo, pageSize);
PageInfo<WorkflowInstance> pageInfo = new PageInfo<>(pageNo, pageSize);

IPage<WorkflowInstance> workflowInstanceList = workflowInstanceMapper.queryWorkflowInstanceListPaging(
IPage<WorkflowInstance> workflowInstanceList = workflowInstanceDao.queryWorkflowInstanceListPaging(
page,
projectCode,
workflowDefinitionCode,
Expand Down Expand Up @@ -600,7 +596,7 @@ public WorkflowInstanceVariablesDTO viewVariables(User loginUser, long projectCo
// check user access for project
projectService.checkProjectAndAuthThrowException(loginUser, projectCode, WORKFLOW_INSTANCE);

WorkflowInstance workflowInstance = workflowInstanceMapper.queryDetailById(workflowInstanceId);
WorkflowInstance workflowInstance = workflowInstanceDao.queryDetailById(workflowInstanceId);

if (workflowInstance == null) {
log.error("workflow instance does not exist, projectCode:{}, workflowInstanceId:{}.", projectCode,
Expand Down Expand Up @@ -705,7 +701,7 @@ private Map<String, Map<String, Object>> processLocalParams(WorkflowInstance wor
public GanttDto viewGantt(User loginUser, long projectCode, Integer workflowInstanceId) throws Exception {
// check user access for project
projectService.checkProjectAndAuthThrowException(loginUser, projectCode, WORKFLOW_INSTANCE);
WorkflowInstance workflowInstance = workflowInstanceMapper.queryDetailById(workflowInstanceId);
WorkflowInstance workflowInstance = workflowInstanceDao.queryDetailById(workflowInstanceId);

if (workflowInstance == null) {
log.error("workflow instance does not exist, projectCode:{}, workflowInstanceId:{}.", projectCode,
Expand Down Expand Up @@ -763,7 +759,7 @@ public GanttDto viewGantt(User loginUser, long projectCode, Integer workflowInst

@Override
public List<WorkflowInstance> queryByWorkflowDefinitionCodeAndStatus(Long workflowDefinitionCode, int[] states) {
return workflowInstanceMapper.queryByWorkflowDefinitionCodeAndStatus(workflowDefinitionCode, states);
return workflowInstanceDao.queryByWorkflowDefinitionCodeAndStatus(workflowDefinitionCode, states);
}

@Override
Expand All @@ -775,7 +771,7 @@ public List<WorkflowInstance> queryByWorkflowCodeVersionStatus(Long workflowDefi

@Override
public List<WorkflowInstance> queryByWorkflowDefinitionCode(Long workflowDefinitionCode, int size) {
return workflowInstanceMapper.queryByWorkflowDefinitionCode(workflowDefinitionCode, size);
return workflowInstanceDao.queryByWorkflowDefinitionCode(workflowDefinitionCode, size);
}

@Override
Expand All @@ -788,14 +784,14 @@ public List<WorkflowInstance> queryByTriggerCode(User loginUser, long projectCod
if (triggerCode == null) {
return Collections.emptyList();
}
return workflowInstanceMapper.queryByTriggerCode(triggerCode);
return workflowInstanceDao.queryByTriggerCode(triggerCode);
}

@Override
public void deleteWorkflowInstanceByWorkflowDefinitionCode(long workflowDefinitionCode) {
while (true) {
List<WorkflowInstance> workflowInstances =
workflowInstanceMapper.queryByWorkflowDefinitionCode(workflowDefinitionCode, 100);
workflowInstanceDao.queryByWorkflowDefinitionCode(workflowDefinitionCode, 100);
if (CollectionUtils.isEmpty(workflowInstances)) {
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.WorkerGroup;
import org.apache.dolphinscheduler.dao.mapper.WorkflowInstanceMapper;
import org.apache.dolphinscheduler.dao.repository.WorkerGroupDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao;
import org.apache.dolphinscheduler.registry.api.RegistryClient;
import org.apache.dolphinscheduler.registry.api.enums.RegistryNodeType;

Expand All @@ -53,8 +53,8 @@ public class WorkerGroupControllerTest extends AbstractControllerTest {
@MockBean(name = "workerGroupDao")
private WorkerGroupDao workerGroupDao;

@MockBean(name = "processInstanceMapper")
private WorkflowInstanceMapper workflowInstanceMapper;
@MockBean
private WorkflowInstanceDao workflowInstanceDao;

@MockBean(name = "registryClient")
private RegistryClient registryClient;
Expand Down Expand Up @@ -131,11 +131,11 @@ public void testDeleteById() throws Exception {
workerGroup.setId(12);
workerGroup.setName("测试");
Mockito.when(workerGroupDao.queryById(12)).thenReturn(workerGroup);
Mockito.when(workflowInstanceMapper.queryByWorkerGroupNameAndStatus("测试",
Mockito.when(workflowInstanceDao.queryByWorkerGroupNameAndStatus("测试",
WorkflowExecutionStatus.NOT_TERMINAL_STATES))
.thenReturn(null);
Mockito.when(workerGroupDao.deleteById(12)).thenReturn(true);
Mockito.when(workflowInstanceMapper.updateWorkflowInstanceByWorkerGroupName("测试", "")).thenReturn(1);
Mockito.when(workflowInstanceDao.updateWorkflowInstanceByWorkerGroupName("测试", "")).thenReturn(1);

MvcResult mvcResult = mockMvc.perform(delete("/worker-groups/{id}", "12")
.header("sessionId", sessionId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.CommandMapper;
import org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper;
import org.apache.dolphinscheduler.dao.mapper.WorkflowInstanceMapper;
import org.apache.dolphinscheduler.dao.repository.ProjectDao;
import org.apache.dolphinscheduler.dao.repository.TaskInstanceDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowDefinitionDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;

import java.text.MessageFormat;
Expand Down Expand Up @@ -92,7 +92,7 @@ public class DataAnalysisServiceTest {
ProjectService projectService;

@Mock
WorkflowInstanceMapper workflowInstanceMapper;
WorkflowInstanceDao workflowInstanceDao;

@Mock
WorkflowDefinitionDao workflowDefinitionDao;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
import org.apache.dolphinscheduler.dao.mapper.WorkflowInstanceMapper;
import org.apache.dolphinscheduler.dao.repository.ScheduleDao;
import org.apache.dolphinscheduler.dao.repository.TenantDao;
import org.apache.dolphinscheduler.dao.repository.UserDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao;

import org.apache.commons.collections4.CollectionUtils;

Expand Down Expand Up @@ -87,7 +87,7 @@ public class TenantServiceTest {
private ScheduleDao scheduleDao;

@Mock
private WorkflowInstanceMapper workflowInstanceMapper;
private WorkflowInstanceDao workflowInstanceDao;

@Mock
private UserDao userDao;
Expand Down Expand Up @@ -188,7 +188,7 @@ public void testDeleteTenantById() {
when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.TENANT, null, 0,
baseServiceLogger)).thenReturn(true);
when(tenantDao.queryDetailById(1)).thenReturn(getTenant());
when(workflowInstanceMapper.queryByTenantCodeAndStatus(tenantCode,
when(workflowInstanceDao.queryByTenantCodeAndStatus(tenantCode,
WorkflowExecutionStatus.NOT_TERMINAL_STATES))
.thenReturn(getInstanceList());
when(scheduleDao.queryScheduleListByTenant(tenantCode)).thenReturn(getScheduleList());
Expand All @@ -202,7 +202,7 @@ public void testDeleteTenantById() {
() -> tenantService.deleteTenantById(getLoginUser(), 1));

// DELETE_TENANT_BY_ID_FAIL_DEFINES
when(workflowInstanceMapper.queryByTenantCodeAndStatus(any(), any())).thenReturn(Collections.emptyList());
when(workflowInstanceDao.queryByTenantCodeAndStatus(any(), any())).thenReturn(Collections.emptyList());
when(tenantDao.queryDetailById(2)).thenReturn(getTenant(2));
assertThrowsServiceException(Status.DELETE_TENANT_BY_ID_FAIL_DEFINES,
() -> tenantService.deleteTenantById(getLoginUser(), 2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
import org.apache.dolphinscheduler.dao.entity.WorkflowInstance;
import org.apache.dolphinscheduler.dao.mapper.EnvironmentWorkerGroupRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.WorkflowInstanceMapper;
import org.apache.dolphinscheduler.dao.repository.ScheduleDao;
import org.apache.dolphinscheduler.dao.repository.WorkerGroupDao;
import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao;
import org.apache.dolphinscheduler.registry.api.RegistryClient;
import org.apache.dolphinscheduler.registry.api.enums.RegistryNodeType;

Expand Down Expand Up @@ -78,7 +78,7 @@ public class WorkerGroupServiceTest {
private WorkerGroupDao workerGroupDao;

@Mock
private WorkflowInstanceMapper workflowInstanceMapper;
private WorkflowInstanceDao workflowInstanceDao;

@Mock
private RegistryClient registryClient;
Expand Down Expand Up @@ -233,7 +233,7 @@ public void giveRunningProcess_whenDeleteWorkerGroupById_expectFailed() {
workflowInstance.setId(1);
List<WorkflowInstance> workflowInstances = new ArrayList<WorkflowInstance>();
workflowInstances.add(workflowInstance);
when(workflowInstanceMapper.queryByWorkerGroupNameAndStatus(workerGroup.getName(),
when(workflowInstanceDao.queryByWorkerGroupNameAndStatus(workerGroup.getName(),
WorkflowExecutionStatus.NOT_TERMINAL_STATES))
.thenReturn(workflowInstances);

Expand All @@ -250,7 +250,7 @@ public void giveValidParams_whenDeleteWorkerGroupById_expectSuccess() {
baseServiceLogger)).thenReturn(true);
WorkerGroup workerGroup = getWorkerGroup(1);
when(workerGroupDao.queryById(1)).thenReturn(workerGroup);
when(workflowInstanceMapper.queryByWorkerGroupNameAndStatus(workerGroup.getName(),
when(workflowInstanceDao.queryByWorkerGroupNameAndStatus(workerGroup.getName(),
WorkflowExecutionStatus.NOT_TERMINAL_STATES)).thenReturn(null);

when(taskDefinitionMapper.selectList(Mockito.any())).thenReturn(null);
Expand Down
Loading
Loading