[Feature][JsonSplit-api] remove connects of ProcessDefinition (#5920)
* modify viewTree of ProcessDefiniton * modify ut * modify ut * modify viewTree of ProcessDefiniton * export/import of ProcessDefinition api * fix ut * fix ut * fix codeStyle * remove connects of ProcessDefinition Co-authored-by: JinyLeeChina <297062848@qq.com>
This commit is contained in:
parent
93abae94e4
commit
ce73868e2c
|
|
@ -99,7 +99,6 @@ public class ProcessDefinitionController extends BaseController {
|
|||
* @param name process definition name
|
||||
* @param description description
|
||||
* @param globalParams globalParams
|
||||
* @param connects connects for nodes
|
||||
* @param locations locations for nodes
|
||||
* @param timeout timeout
|
||||
* @param tenantCode tenantCode
|
||||
|
|
@ -110,7 +109,6 @@ public class ProcessDefinitionController extends BaseController {
|
|||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"),
|
||||
@ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"),
|
||||
@ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"),
|
||||
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String")
|
||||
})
|
||||
@PostMapping(value = "/save")
|
||||
|
|
@ -122,14 +120,13 @@ public class ProcessDefinitionController extends BaseController {
|
|||
@RequestParam(value = "name", required = true) String name,
|
||||
@RequestParam(value = "description", required = false) String description,
|
||||
@RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams,
|
||||
@RequestParam(value = "connects", required = false) String connects,
|
||||
@RequestParam(value = "locations", required = false) String locations,
|
||||
@RequestParam(value = "timeout", required = false, defaultValue = "0") int timeout,
|
||||
@RequestParam(value = "tenantCode", required = true) String tenantCode,
|
||||
@RequestParam(value = "taskRelationJson", required = true) String taskRelationJson) throws JsonProcessingException {
|
||||
|
||||
Map<String, Object> result = processDefinitionService.createProcessDefinition(loginUser, projectCode, name, description, globalParams,
|
||||
connects, locations, timeout, tenantCode, taskRelationJson);
|
||||
locations, timeout, tenantCode, taskRelationJson);
|
||||
return returnDataList(result);
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +212,6 @@ public class ProcessDefinitionController extends BaseController {
|
|||
* @param code process definition code
|
||||
* @param description description
|
||||
* @param globalParams globalParams
|
||||
* @param connects connects for nodes
|
||||
* @param locations locations for nodes
|
||||
* @param timeout timeout
|
||||
* @param tenantCode tenantCode
|
||||
|
|
@ -228,7 +224,6 @@ public class ProcessDefinitionController extends BaseController {
|
|||
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"),
|
||||
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789"),
|
||||
@ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"),
|
||||
@ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"),
|
||||
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String"),
|
||||
@ApiImplicitParam(name = "releaseState", value = "RELEASE_PROCESS_DEFINITION_NOTES", required = false, dataType = "ReleaseState")
|
||||
})
|
||||
|
|
@ -242,7 +237,6 @@ public class ProcessDefinitionController extends BaseController {
|
|||
@RequestParam(value = "code", required = true) long code,
|
||||
@RequestParam(value = "description", required = false) String description,
|
||||
@RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams,
|
||||
@RequestParam(value = "connects", required = false) String connects,
|
||||
@RequestParam(value = "locations", required = false) String locations,
|
||||
@RequestParam(value = "timeout", required = false, defaultValue = "0") int timeout,
|
||||
@RequestParam(value = "tenantCode", required = true) String tenantCode,
|
||||
|
|
@ -250,7 +244,7 @@ public class ProcessDefinitionController extends BaseController {
|
|||
@RequestParam(value = "releaseState", required = false, defaultValue = "OFFLINE") ReleaseState releaseState) {
|
||||
|
||||
Map<String, Object> result = processDefinitionService.updateProcessDefinition(loginUser, projectCode, name, code, description, globalParams,
|
||||
connects, locations, timeout, tenantCode, taskRelationJson);
|
||||
locations, timeout, tenantCode, taskRelationJson);
|
||||
// If the update fails, the result will be returned directly
|
||||
if (result.get(Constants.STATUS) != Status.SUCCESS) {
|
||||
return returnDataList(result);
|
||||
|
|
@ -357,7 +351,7 @@ public class ProcessDefinitionController extends BaseController {
|
|||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"),
|
||||
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789"),
|
||||
@ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_CONNECTS", required = true, dataType = "ReleaseState"),
|
||||
@ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_RELEASE", required = true, dataType = "ReleaseState"),
|
||||
})
|
||||
@PostMapping(value = "/release")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@ public class ProcessInstanceController extends BaseController {
|
|||
* @param syncDefine sync define
|
||||
* @param flag flag
|
||||
* @param locations locations
|
||||
* @param connects connects
|
||||
* @return update result code
|
||||
*/
|
||||
@ApiOperation(value = "updateProcessInstance", notes = "UPDATE_PROCESS_INSTANCE_NOTES")
|
||||
|
|
@ -180,7 +179,6 @@ public class ProcessInstanceController extends BaseController {
|
|||
@ApiImplicitParam(name = "scheduleTime", value = "SCHEDULE_TIME", type = "String"),
|
||||
@ApiImplicitParam(name = "syncDefine", value = "SYNC_DEFINE", required = true, type = "Boolean"),
|
||||
@ApiImplicitParam(name = "locations", value = "PROCESS_INSTANCE_LOCATIONS", type = "String"),
|
||||
@ApiImplicitParam(name = "connects", value = "PROCESS_INSTANCE_CONNECTS", type = "String"),
|
||||
@ApiImplicitParam(name = "flag", value = "RECOVERY_PROCESS_INSTANCE_FLAG", type = "Flag"),
|
||||
})
|
||||
@PostMapping(value = "/update")
|
||||
|
|
@ -194,11 +192,10 @@ public class ProcessInstanceController extends BaseController {
|
|||
@RequestParam(value = "scheduleTime", required = false) String scheduleTime,
|
||||
@RequestParam(value = "syncDefine", required = true) Boolean syncDefine,
|
||||
@RequestParam(value = "locations", required = false) String locations,
|
||||
@RequestParam(value = "connects", required = false) String connects,
|
||||
@RequestParam(value = "flag", required = false) Flag flag
|
||||
) throws ParseException {
|
||||
Map<String, Object> result = processInstanceService.updateProcessInstance(loginUser, projectName,
|
||||
processInstanceId, processInstanceJson, scheduleTime, syncDefine, flag, locations, connects);
|
||||
processInstanceId, processInstanceJson, scheduleTime, syncDefine, flag, locations);
|
||||
return returnDataList(result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ public interface ProcessDefinitionService {
|
|||
* @param name process definition name
|
||||
* @param description description
|
||||
* @param globalParams global params
|
||||
* @param connects connects for nodes
|
||||
* @param locations locations for nodes
|
||||
* @param timeout timeout
|
||||
* @param tenantCode tenantCode
|
||||
|
|
@ -55,7 +54,6 @@ public interface ProcessDefinitionService {
|
|||
String name,
|
||||
String description,
|
||||
String globalParams,
|
||||
String connects,
|
||||
String locations,
|
||||
int timeout,
|
||||
String tenantCode,
|
||||
|
|
@ -150,7 +148,6 @@ public interface ProcessDefinitionService {
|
|||
* @param code process definition code
|
||||
* @param description description
|
||||
* @param globalParams global params
|
||||
* @param connects connects for nodes
|
||||
* @param locations locations for nodes
|
||||
* @param timeout timeout
|
||||
* @param tenantCode tenantCode
|
||||
|
|
@ -163,7 +160,6 @@ public interface ProcessDefinitionService {
|
|||
long code,
|
||||
String description,
|
||||
String globalParams,
|
||||
String connects,
|
||||
String locations,
|
||||
int timeout,
|
||||
String tenantCode,
|
||||
|
|
|
|||
|
|
@ -104,13 +104,12 @@ public interface ProcessInstanceService {
|
|||
* @param syncDefine sync define
|
||||
* @param flag flag
|
||||
* @param locations locations
|
||||
* @param connects connects
|
||||
* @return update result code
|
||||
* @throws ParseException parse exception for json parse
|
||||
*/
|
||||
Map<String, Object> updateProcessInstance(User loginUser, String projectName, Integer processInstanceId,
|
||||
String processInstanceJson, String scheduleTime, Boolean syncDefine,
|
||||
Flag flag, String locations, String connects) throws ParseException;
|
||||
Flag flag, String locations) throws ParseException;
|
||||
|
||||
/**
|
||||
* query parent process instance detail info by sub process instance id
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|||
* @param name process definition name
|
||||
* @param description description
|
||||
* @param globalParams global params
|
||||
* @param connects connects for nodes
|
||||
* @param locations locations for nodes
|
||||
* @param timeout timeout
|
||||
* @param tenantCode tenantCode
|
||||
|
|
@ -184,7 +183,6 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|||
String name,
|
||||
String description,
|
||||
String globalParams,
|
||||
String connects,
|
||||
String locations,
|
||||
int timeout,
|
||||
String tenantCode,
|
||||
|
|
@ -223,7 +221,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|||
return result;
|
||||
}
|
||||
ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description,
|
||||
globalParams, locations, connects, timeout, loginUser.getId(), tenant.getId());
|
||||
globalParams, locations, timeout, loginUser.getId(), tenant.getId());
|
||||
|
||||
return createProcessDefine(loginUser, result, taskRelationList, processDefinition);
|
||||
}
|
||||
|
|
@ -404,7 +402,6 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|||
* @param code process definition code
|
||||
* @param description description
|
||||
* @param globalParams global params
|
||||
* @param connects connects for nodes
|
||||
* @param locations locations for nodes
|
||||
* @param timeout timeout
|
||||
* @param tenantCode tenantCode
|
||||
|
|
@ -418,7 +415,6 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|||
long code,
|
||||
String description,
|
||||
String globalParams,
|
||||
String connects,
|
||||
String locations,
|
||||
int timeout,
|
||||
String tenantCode,
|
||||
|
|
@ -462,7 +458,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
|||
}
|
||||
}
|
||||
|
||||
processDefinition.set(projectCode, name, description, globalParams, locations, connects, timeout, tenant.getId());
|
||||
processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenant.getId());
|
||||
return updateProcessDefine(loginUser, result, taskRelationList, processDefinition);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,6 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
|
|||
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
|
||||
} else {
|
||||
processInstance.setWarningGroupId(processDefinition.getWarningGroupId());
|
||||
processInstance.setConnects(processDefinition.getConnects());
|
||||
processInstance.setLocations(processDefinition.getLocations());
|
||||
|
||||
ProcessData processData = processService.genProcessData(processDefinition);
|
||||
|
|
@ -421,14 +420,13 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
|
|||
* @param syncDefine sync define
|
||||
* @param flag flag
|
||||
* @param locations locations
|
||||
* @param connects connects
|
||||
* @return update result code
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public Map<String, Object> updateProcessInstance(User loginUser, String projectName, Integer processInstanceId,
|
||||
String processInstanceJson, String scheduleTime, Boolean syncDefine,
|
||||
Flag flag, String locations, String connects) {
|
||||
Flag flag, String locations) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Project project = projectMapper.queryByName(projectName);
|
||||
//check project permission
|
||||
|
|
@ -463,8 +461,7 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
|
|||
int updateDefine = 1;
|
||||
if (Boolean.TRUE.equals(syncDefine)) {
|
||||
processDefinition.setId(processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode()).getId());
|
||||
updateDefine = syncDefinition(loginUser, project, locations, connects,
|
||||
processInstance, processDefinition, processData);
|
||||
updateDefine = syncDefinition(loginUser, project, locations, processInstance, processDefinition, processData);
|
||||
|
||||
processInstance.setProcessDefinitionVersion(processDefinitionLogMapper.
|
||||
queryMaxVersionForDefinition(processInstance.getProcessDefinitionCode()));
|
||||
|
|
@ -482,20 +479,17 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
|
|||
/**
|
||||
* sync definition according process instance
|
||||
*/
|
||||
private int syncDefinition(User loginUser, Project project, String locations, String connects,
|
||||
ProcessInstance processInstance, ProcessDefinition processDefinition,
|
||||
ProcessData processData) {
|
||||
private int syncDefinition(User loginUser, Project project, String locations, ProcessInstance processInstance,
|
||||
ProcessDefinition processDefinition, ProcessData processData) {
|
||||
|
||||
String originDefParams = JSONUtils.toJsonString(processData.getGlobalParams());
|
||||
processDefinition.setGlobalParams(originDefParams);
|
||||
processDefinition.setLocations(locations);
|
||||
processDefinition.setConnects(connects);
|
||||
processDefinition.setTimeout(processInstance.getTimeout());
|
||||
processDefinition.setUpdateTime(new Date());
|
||||
|
||||
return processService.saveProcessDefinition(loginUser, project, processDefinition.getName(),
|
||||
processDefinition.getDescription(), locations, connects,
|
||||
processData, processDefinition, false);
|
||||
processDefinition.getDescription(), locations, processData, processDefinition, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ public class ProcessDefinitionControllerTest {
|
|||
String name = "dag_test";
|
||||
String description = "desc test";
|
||||
String globalParams = "[]";
|
||||
String connects = "[]";
|
||||
String locations = "[]";
|
||||
int timeout = 0;
|
||||
String tenantCode = "root";
|
||||
|
|
@ -89,10 +88,10 @@ public class ProcessDefinitionControllerTest {
|
|||
result.put(Constants.DATA_LIST, 1);
|
||||
|
||||
Mockito.when(processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams,
|
||||
connects, locations, timeout, tenantCode, json)).thenReturn(result);
|
||||
locations, timeout, tenantCode, json)).thenReturn(result);
|
||||
|
||||
Result response = processDefinitionController.createProcessDefinition(user, projectCode, name, description, globalParams,
|
||||
connects, locations, timeout, tenantCode, json);
|
||||
locations, timeout, tenantCode, json);
|
||||
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +126,6 @@ public class ProcessDefinitionControllerTest {
|
|||
long projectCode = 1L;
|
||||
String name = "dag_test";
|
||||
String description = "desc test";
|
||||
String connects = "[]";
|
||||
String globalParams = "[]";
|
||||
int timeout = 0;
|
||||
String tenantCode = "root";
|
||||
|
|
@ -137,10 +135,10 @@ public class ProcessDefinitionControllerTest {
|
|||
result.put("processDefinitionId", 1);
|
||||
|
||||
Mockito.when(processDefinitionService.updateProcessDefinition(user, projectCode, name, code, description, globalParams,
|
||||
connects, locations, timeout, tenantCode, json)).thenReturn(result);
|
||||
locations, timeout, tenantCode, json)).thenReturn(result);
|
||||
|
||||
Result response = processDefinitionController.updateProcessDefinition(user, projectCode, name, code, description, globalParams,
|
||||
connects, locations, timeout, tenantCode, json, ReleaseState.OFFLINE);
|
||||
locations, timeout, tenantCode, json, ReleaseState.OFFLINE);
|
||||
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
|
||||
}
|
||||
|
||||
|
|
@ -162,12 +160,10 @@ public class ProcessDefinitionControllerTest {
|
|||
long projectCode = 1L;
|
||||
String name = "dag_test";
|
||||
String description = "desc test";
|
||||
String connects = "[]";
|
||||
long code = 1L;
|
||||
|
||||
ProcessDefinition processDefinition = new ProcessDefinition();
|
||||
processDefinition.setProjectCode(projectCode);
|
||||
processDefinition.setConnects(connects);
|
||||
processDefinition.setDescription(description);
|
||||
processDefinition.setCode(code);
|
||||
processDefinition.setLocations(locations);
|
||||
|
|
@ -234,12 +230,10 @@ public class ProcessDefinitionControllerTest {
|
|||
String projectName = "test";
|
||||
String name = "dag_test";
|
||||
String description = "desc test";
|
||||
String connects = "[]";
|
||||
int id = 1;
|
||||
|
||||
ProcessDefinition processDefinition = new ProcessDefinition();
|
||||
processDefinition.setProjectName(projectName);
|
||||
processDefinition.setConnects(connects);
|
||||
processDefinition.setDescription(description);
|
||||
processDefinition.setId(id);
|
||||
processDefinition.setLocations(locations);
|
||||
|
|
@ -250,7 +244,6 @@ public class ProcessDefinitionControllerTest {
|
|||
|
||||
ProcessDefinition processDefinition2 = new ProcessDefinition();
|
||||
processDefinition2.setProjectName(projectName);
|
||||
processDefinition2.setConnects(connects);
|
||||
processDefinition2.setDescription(description);
|
||||
processDefinition2.setId(id2);
|
||||
processDefinition2.setLocations(locations);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ public class ProcessInstanceControllerTest extends AbstractControllerTest {
|
|||
paramsMap.add("scheduleTime", "2019-12-15 00:00:00");
|
||||
paramsMap.add("syncDefine", "false");
|
||||
paramsMap.add("locations", locations);
|
||||
paramsMap.add("connects", "[]");
|
||||
|
||||
MvcResult mvcResult = mockMvc.perform(post("/projects/{projectName}/instance/update", "cxc_1113")
|
||||
.header("sessionId", sessionId)
|
||||
|
|
|
|||
|
|
@ -832,7 +832,7 @@ public class ProcessDefinitionServiceTest {
|
|||
+ "\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":{}},{\"name\":\"\",\"preTaskCode\":123456789,"
|
||||
+ "\"preTaskVersion\":1,\"postTaskCode\":123451234,\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":{}}]";
|
||||
Map<String, Object> updateResult = processDefinitionService.updateProcessDefinition(loginUser, projectCode, "test", 1,
|
||||
"", "", "", "", 0, "root", taskRelationJson);
|
||||
"", "", "", 0, "root", taskRelationJson);
|
||||
|
||||
Assert.assertEquals(Status.DATA_IS_NOT_VALID, updateResult.get(Constants.STATUS));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ public class ProcessInstanceServiceTest {
|
|||
when(projectMapper.queryByName(projectName)).thenReturn(null);
|
||||
when(projectService.checkProjectAndAuth(loginUser, null, projectName)).thenReturn(result);
|
||||
Map<String, Object> proejctAuthFailRes = processInstanceService.updateProcessInstance(loginUser, projectName, 1,
|
||||
shellJson, "2020-02-21 00:00:00", true, Flag.YES, "", "");
|
||||
shellJson, "2020-02-21 00:00:00", true, Flag.YES, "");
|
||||
Assert.assertEquals(Status.PROJECT_NOT_FOUNT, proejctAuthFailRes.get(Constants.STATUS));
|
||||
|
||||
//process instance null
|
||||
|
|
@ -375,14 +375,14 @@ public class ProcessInstanceServiceTest {
|
|||
when(projectService.checkProjectAndAuth(loginUser, project, projectName)).thenReturn(result);
|
||||
when(processService.findProcessInstanceDetailById(1)).thenReturn(null);
|
||||
Map<String, Object> processInstanceNullRes = processInstanceService.updateProcessInstance(loginUser, projectName, 1,
|
||||
shellJson, "2020-02-21 00:00:00", true, Flag.YES, "", "");
|
||||
shellJson, "2020-02-21 00:00:00", true, Flag.YES, "");
|
||||
Assert.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceNullRes.get(Constants.STATUS));
|
||||
|
||||
//process instance not finish
|
||||
when(processService.findProcessInstanceDetailById(1)).thenReturn(processInstance);
|
||||
processInstance.setState(ExecutionStatus.RUNNING_EXECUTION);
|
||||
Map<String, Object> processInstanceNotFinishRes = processInstanceService.updateProcessInstance(loginUser, projectName, 1,
|
||||
shellJson, "2020-02-21 00:00:00", true, Flag.YES, "", "");
|
||||
shellJson, "2020-02-21 00:00:00", true, Flag.YES, "");
|
||||
Assert.assertEquals(Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR, processInstanceNotFinishRes.get(Constants.STATUS));
|
||||
|
||||
//process instance finish
|
||||
|
|
@ -405,18 +405,18 @@ public class ProcessInstanceServiceTest {
|
|||
processInstance.getProcessDefinitionVersion())).thenReturn(processDefinition);
|
||||
|
||||
Map<String, Object> processInstanceFinishRes = processInstanceService.updateProcessInstance(loginUser, projectName, 1,
|
||||
shellJson, "2020-02-21 00:00:00", true, Flag.YES, "", "");
|
||||
shellJson, "2020-02-21 00:00:00", true, Flag.YES, "");
|
||||
Assert.assertEquals(Status.UPDATE_PROCESS_INSTANCE_ERROR, processInstanceFinishRes.get(Constants.STATUS));
|
||||
|
||||
//success
|
||||
when(processService.saveProcessDefinition(Mockito.any(), Mockito.any(),
|
||||
Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
|
||||
Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.anyBoolean())).thenReturn(1);
|
||||
Mockito.any(), Mockito.any(), Mockito.anyBoolean())).thenReturn(1);
|
||||
when(processService.findProcessDefinition(46L, 0)).thenReturn(processDefinition);
|
||||
putMsg(result, Status.SUCCESS, projectName);
|
||||
|
||||
Map<String, Object> successRes = processInstanceService.updateProcessInstance(loginUser, projectName, 1,
|
||||
shellJson, "2020-02-21 00:00:00", true, Flag.YES, "", "");
|
||||
shellJson, "2020-02-21 00:00:00", true, Flag.YES, "");
|
||||
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,12 +148,6 @@ public class ProcessDefinition {
|
|||
*/
|
||||
private String locations;
|
||||
|
||||
/**
|
||||
* connects array for web
|
||||
* TODO: delete
|
||||
*/
|
||||
private String connects;
|
||||
|
||||
/**
|
||||
* schedule release state : online/offline
|
||||
*/
|
||||
|
|
@ -196,11 +190,10 @@ public class ProcessDefinition {
|
|||
String description,
|
||||
String globalParams,
|
||||
String locations,
|
||||
String connects,
|
||||
int timeout,
|
||||
int userId,
|
||||
int tenantId) {
|
||||
set(projectCode, name, description, globalParams, connects, locations, timeout, tenantId);
|
||||
set(projectCode, name, description, globalParams, locations, timeout, tenantId);
|
||||
this.code = code;
|
||||
this.userId = userId;
|
||||
Date date = new Date();
|
||||
|
|
@ -212,7 +205,6 @@ public class ProcessDefinition {
|
|||
String name,
|
||||
String description,
|
||||
String globalParams,
|
||||
String connects,
|
||||
String locations,
|
||||
int timeout,
|
||||
int tenantId) {
|
||||
|
|
@ -221,7 +213,6 @@ public class ProcessDefinition {
|
|||
this.description = description;
|
||||
this.globalParams = globalParams;
|
||||
this.locations = locations;
|
||||
this.connects = connects;
|
||||
this.timeout = timeout;
|
||||
this.tenantId = tenantId;
|
||||
this.flag = Flag.YES;
|
||||
|
|
@ -366,14 +357,6 @@ public class ProcessDefinition {
|
|||
this.locations = locations;
|
||||
}
|
||||
|
||||
public String getConnects() {
|
||||
return connects;
|
||||
}
|
||||
|
||||
public void setConnects(String connects) {
|
||||
this.connects = connects;
|
||||
}
|
||||
|
||||
public ReleaseState getScheduleReleaseState() {
|
||||
return scheduleReleaseState;
|
||||
}
|
||||
|
|
@ -468,7 +451,6 @@ public class ProcessDefinition {
|
|||
+ ", userName='" + userName + '\''
|
||||
+ ", projectName='" + projectName + '\''
|
||||
+ ", locations='" + locations + '\''
|
||||
+ ", connects='" + connects + '\''
|
||||
+ ", scheduleReleaseState=" + scheduleReleaseState
|
||||
+ ", timeout=" + timeout
|
||||
+ ", warningGroupId=" + warningGroupId
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ public class ProcessDefinitionLog extends ProcessDefinition {
|
|||
this.setUserName(processDefinition.getUserName());
|
||||
this.setProjectName(processDefinition.getProjectName());
|
||||
this.setLocations(processDefinition.getLocations());
|
||||
this.setConnects(processDefinition.getConnects());
|
||||
this.setScheduleReleaseState(processDefinition.getScheduleReleaseState());
|
||||
this.setTimeout(processDefinition.getTimeout());
|
||||
this.setTenantId(processDefinition.getTenantId());
|
||||
|
|
|
|||
|
|
@ -191,12 +191,6 @@ public class ProcessInstance {
|
|||
@TableField(exist = false)
|
||||
private String locations;
|
||||
|
||||
/**
|
||||
* task connects for web
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String connects;
|
||||
|
||||
/**
|
||||
* history command
|
||||
*/
|
||||
|
|
@ -253,12 +247,12 @@ public class ProcessInstance {
|
|||
public ProcessInstance(ProcessDefinition processDefinition) {
|
||||
this.processDefinition = processDefinition;
|
||||
this.name = processDefinition.getName()
|
||||
+ "-"
|
||||
+
|
||||
processDefinition.getVersion()
|
||||
+ "-"
|
||||
+
|
||||
DateUtils.getCurrentTimeStamp();
|
||||
+ "-"
|
||||
+
|
||||
processDefinition.getVersion()
|
||||
+ "-"
|
||||
+
|
||||
DateUtils.getCurrentTimeStamp();
|
||||
}
|
||||
|
||||
public String getVarPool() {
|
||||
|
|
@ -481,14 +475,6 @@ public class ProcessInstance {
|
|||
this.locations = locations;
|
||||
}
|
||||
|
||||
public String getConnects() {
|
||||
return connects;
|
||||
}
|
||||
|
||||
public void setConnects(String connects) {
|
||||
this.connects = connects;
|
||||
}
|
||||
|
||||
public String getHistoryCmd() {
|
||||
return historyCmd;
|
||||
}
|
||||
|
|
@ -602,81 +588,78 @@ public class ProcessInstance {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "ProcessInstance{"
|
||||
+ "id=" + id
|
||||
+ ", state=" + state
|
||||
+ ", recovery=" + recovery
|
||||
+ ", startTime=" + startTime
|
||||
+ ", endTime=" + endTime
|
||||
+ ", runTimes=" + runTimes
|
||||
+ ", name='" + name + '\''
|
||||
+ ", host='" + host + '\''
|
||||
+ ", processDefinition="
|
||||
+ processDefinition
|
||||
+ ", commandType="
|
||||
+ commandType
|
||||
+ ", commandParam='"
|
||||
+ commandParam
|
||||
+ '\''
|
||||
+ ", taskDependType="
|
||||
+ taskDependType
|
||||
+ ", maxTryTimes="
|
||||
+ maxTryTimes
|
||||
+ ", failureStrategy="
|
||||
+ failureStrategy
|
||||
+ ", warningType="
|
||||
+ warningType
|
||||
+ ", warningGroupId="
|
||||
+ warningGroupId
|
||||
+ ", scheduleTime="
|
||||
+ scheduleTime
|
||||
+ ", commandStartTime="
|
||||
+ commandStartTime
|
||||
+ ", globalParams='"
|
||||
+ globalParams
|
||||
+ '\''
|
||||
+ ", processInstanceJson='"
|
||||
+ processInstanceJson
|
||||
+ '\''
|
||||
+ ", executorId="
|
||||
+ executorId
|
||||
+ ", tenantCode='"
|
||||
+ tenantCode
|
||||
+ '\''
|
||||
+ ", queue='"
|
||||
+ queue
|
||||
+ '\''
|
||||
+ ", isSubProcess="
|
||||
+ isSubProcess
|
||||
+ ", locations='"
|
||||
+ locations
|
||||
+ '\''
|
||||
+ ", connects='"
|
||||
+ connects
|
||||
+ '\''
|
||||
+ ", historyCmd='"
|
||||
+ historyCmd
|
||||
+ '\''
|
||||
+ ", dependenceScheduleTimes='"
|
||||
+ dependenceScheduleTimes
|
||||
+ '\''
|
||||
+ ", duration="
|
||||
+ duration
|
||||
+ ", processInstancePriority="
|
||||
+ processInstancePriority
|
||||
+ ", workerGroup='"
|
||||
+ workerGroup
|
||||
+ '\''
|
||||
+ ", timeout="
|
||||
+ timeout
|
||||
+ ", tenantId="
|
||||
+ tenantId
|
||||
+ ", processDefinitionCode='"
|
||||
+ processDefinitionCode
|
||||
+ '\''
|
||||
+ ", processDefinitionVersion='"
|
||||
+ processDefinitionVersion
|
||||
+ '\''
|
||||
+ '}';
|
||||
+ "id=" + id
|
||||
+ ", state=" + state
|
||||
+ ", recovery=" + recovery
|
||||
+ ", startTime=" + startTime
|
||||
+ ", endTime=" + endTime
|
||||
+ ", runTimes=" + runTimes
|
||||
+ ", name='" + name + '\''
|
||||
+ ", host='" + host + '\''
|
||||
+ ", processDefinition="
|
||||
+ processDefinition
|
||||
+ ", commandType="
|
||||
+ commandType
|
||||
+ ", commandParam='"
|
||||
+ commandParam
|
||||
+ '\''
|
||||
+ ", taskDependType="
|
||||
+ taskDependType
|
||||
+ ", maxTryTimes="
|
||||
+ maxTryTimes
|
||||
+ ", failureStrategy="
|
||||
+ failureStrategy
|
||||
+ ", warningType="
|
||||
+ warningType
|
||||
+ ", warningGroupId="
|
||||
+ warningGroupId
|
||||
+ ", scheduleTime="
|
||||
+ scheduleTime
|
||||
+ ", commandStartTime="
|
||||
+ commandStartTime
|
||||
+ ", globalParams='"
|
||||
+ globalParams
|
||||
+ '\''
|
||||
+ ", processInstanceJson='"
|
||||
+ processInstanceJson
|
||||
+ '\''
|
||||
+ ", executorId="
|
||||
+ executorId
|
||||
+ ", tenantCode='"
|
||||
+ tenantCode
|
||||
+ '\''
|
||||
+ ", queue='"
|
||||
+ queue
|
||||
+ '\''
|
||||
+ ", isSubProcess="
|
||||
+ isSubProcess
|
||||
+ ", locations='"
|
||||
+ locations
|
||||
+ '\''
|
||||
+ ", historyCmd='"
|
||||
+ historyCmd
|
||||
+ '\''
|
||||
+ ", dependenceScheduleTimes='"
|
||||
+ dependenceScheduleTimes
|
||||
+ '\''
|
||||
+ ", duration="
|
||||
+ duration
|
||||
+ ", processInstancePriority="
|
||||
+ processInstancePriority
|
||||
+ ", workerGroup='"
|
||||
+ workerGroup
|
||||
+ '\''
|
||||
+ ", timeout="
|
||||
+ timeout
|
||||
+ ", tenantId="
|
||||
+ tenantId
|
||||
+ ", processDefinitionCode='"
|
||||
+ processDefinitionCode
|
||||
+ '\''
|
||||
+ ", processDefinitionVersion='"
|
||||
+ processDefinitionVersion
|
||||
+ '\''
|
||||
+ '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
<sql id="baseSql">
|
||||
id, code, name, version, description, project_code,
|
||||
release_state, user_id,global_params, flag, locations, connects,
|
||||
release_state, user_id,global_params, flag, locations,
|
||||
warning_group_id, timeout, tenant_id,operator, operate_time, create_time,
|
||||
update_time
|
||||
</sql>
|
||||
<select id="queryByDefinitionName" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog">
|
||||
select pd.id, pd.code, pd.name, pd.version, pd.description, pd.project_code,
|
||||
pd.release_state, pd.user_id,pd.global_params, pd.flag, pd.locations, pd.connects,
|
||||
pd.release_state, pd.user_id,pd.global_params, pd.flag, pd.locations,
|
||||
pd.warning_group_id, pd.timeout, pd.tenant_id,pd.operator, pd.operate_time, pd.create_time,
|
||||
pd.update_time, u.user_name,p.name as project_name
|
||||
from t_ds_process_definition_log pd
|
||||
|
|
|
|||
|
|
@ -20,14 +20,12 @@
|
|||
<mapper namespace="org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper">
|
||||
<sql id="baseSql">
|
||||
id, code, name, version, release_state, project_code, user_id, description,
|
||||
global_params, flag, locations, connects, warning_group_id, create_time, timeout,
|
||||
tenant_id, update_time
|
||||
global_params, flag, locations, warning_group_id, create_time, timeout, tenant_id, update_time
|
||||
</sql>
|
||||
|
||||
<select id="verifyByDefineName" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition">
|
||||
select pd.id, pd.code, pd.name, pd.version, pd.release_state, pd.project_code, pd.user_id, pd.description,
|
||||
pd.global_params, pd.flag, pd.locations, pd.connects, pd.warning_group_id, pd.create_time, pd.timeout,
|
||||
pd.tenant_id, pd.update_time
|
||||
pd.global_params, pd.flag, pd.locations, pd.warning_group_id, pd.create_time, pd.timeout, pd.tenant_id, pd.update_time
|
||||
from t_ds_process_definition pd
|
||||
WHERE pd.project_code = #{projectCode}
|
||||
and pd.name = #{processDefinitionName}
|
||||
|
|
@ -59,8 +57,7 @@
|
|||
|
||||
<select id="queryByDefineName" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition">
|
||||
select pd.id, pd.code, pd.name, pd.version, pd.release_state, pd.project_code, p.id as project_id, pd.user_id, pd.description,
|
||||
pd.global_params, pd.flag, pd.locations, pd.connects, pd.warning_group_id, pd.create_time, pd.timeout,
|
||||
pd.tenant_id, pd.update_time,
|
||||
pd.global_params, pd.flag, pd.locations, pd.warning_group_id, pd.create_time, pd.timeout, pd.tenant_id, pd.update_time,
|
||||
u.user_name,p.name as project_name,t.tenant_code,q.queue,q.queue_name
|
||||
from t_ds_process_definition pd
|
||||
JOIN t_ds_user u ON pd.user_id = u.id
|
||||
|
|
@ -127,7 +124,7 @@
|
|||
<select id="queryByDefineId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessDefinition">
|
||||
SELECT
|
||||
pd.id, pd.code, pd.name, pd.version, pd.release_state, pd.project_code, pd.user_id, pd.description,
|
||||
pd.global_params, pd.flag, pd.locations, pd.connects, pd.warning_group_id, pd.create_time, pd.timeout,
|
||||
pd.global_params, pd.flag, pd.locations, pd.warning_group_id, pd.create_time, pd.timeout,
|
||||
pd.tenant_id, pd.update_time, u.user_name,p.name AS project_name
|
||||
FROM
|
||||
t_ds_process_definition pd,
|
||||
|
|
|
|||
|
|
@ -607,7 +607,6 @@ public class ProcessService {
|
|||
}
|
||||
processInstance.setCommandStartTime(command.getStartTime());
|
||||
processInstance.setLocations(processDefinition.getLocations());
|
||||
processInstance.setConnects(processDefinition.getConnects());
|
||||
|
||||
// reset global params while there are start parameters
|
||||
setGlobalParamIfCommanded(processDefinition, cmdParam);
|
||||
|
|
@ -2238,10 +2237,9 @@ public class ProcessService {
|
|||
*/
|
||||
@Deprecated
|
||||
public int saveProcessDefinition(User operator, Project project, String name, String desc, String locations,
|
||||
String connects, ProcessData processData, ProcessDefinition processDefinition,
|
||||
Boolean isFromProcessDefine) {
|
||||
ProcessData processData, ProcessDefinition processDefinition, Boolean isFromProcessDefine) {
|
||||
ProcessDefinitionLog processDefinitionLog = insertProcessDefinitionLog(operator, processDefinition.getCode(),
|
||||
name, processData, project, desc, locations, connects);
|
||||
name, processData, project, desc, locations);
|
||||
Map<String, TaskDefinition> taskDefinitionMap = handleTaskDefinition(operator, project.getCode(), processData.getTasks(), isFromProcessDefine);
|
||||
if (Constants.DEFINITION_FAILURE == handleTaskRelation(operator, project.getCode(), processDefinitionLog, processData.getTasks(), taskDefinitionMap)) {
|
||||
return Constants.DEFINITION_FAILURE;
|
||||
|
|
@ -2254,8 +2252,7 @@ public class ProcessService {
|
|||
*/
|
||||
@Deprecated
|
||||
public ProcessDefinitionLog insertProcessDefinitionLog(User operator, Long processDefinitionCode, String processDefinitionName,
|
||||
ProcessData processData, Project project,
|
||||
String desc, String locations, String connects) {
|
||||
ProcessData processData, Project project, String desc, String locations) {
|
||||
ProcessDefinitionLog processDefinitionLog = new ProcessDefinitionLog();
|
||||
Integer version = processDefineLogMapper.queryMaxVersionForDefinition(processDefinitionCode);
|
||||
processDefinitionLog.setUserId(operator.getId());
|
||||
|
|
@ -2266,7 +2263,6 @@ public class ProcessService {
|
|||
processDefinitionLog.setProjectCode(project.getCode());
|
||||
processDefinitionLog.setDescription(desc);
|
||||
processDefinitionLog.setLocations(locations);
|
||||
processDefinitionLog.setConnects(connects);
|
||||
processDefinitionLog.setTimeout(processData.getTimeout());
|
||||
processDefinitionLog.setTenantId(processData.getTenantId());
|
||||
processDefinitionLog.setOperator(operator.getId());
|
||||
|
|
|
|||
|
|
@ -351,8 +351,7 @@ public class ProcessServiceTest {
|
|||
processDefinition.setVersion(1);
|
||||
processDefinition.setCode(11L);
|
||||
Assert.assertEquals(-1, processService.saveProcessDefinition(user, project, "name",
|
||||
"desc", "locations", "connects", processData,
|
||||
processDefinition, true));
|
||||
"desc", "locations", processData, processDefinition, true));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue