|
|
@ -70,6 +70,7 @@ import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum; |
|
|
|
import org.apache.dolphinscheduler.common.enums.ReleaseState; |
|
|
|
import org.apache.dolphinscheduler.common.enums.ReleaseState; |
|
|
|
import org.apache.dolphinscheduler.common.enums.TimeoutFlag; |
|
|
|
import org.apache.dolphinscheduler.common.enums.TimeoutFlag; |
|
|
|
import org.apache.dolphinscheduler.common.enums.UserType; |
|
|
|
import org.apache.dolphinscheduler.common.enums.UserType; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus; |
|
|
|
import org.apache.dolphinscheduler.common.graph.DAG; |
|
|
|
import org.apache.dolphinscheduler.common.graph.DAG; |
|
|
|
import org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager; |
|
|
|
import org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager; |
|
|
|
import org.apache.dolphinscheduler.common.model.TaskNodeRelation; |
|
|
|
import org.apache.dolphinscheduler.common.model.TaskNodeRelation; |
|
|
@ -252,14 +253,14 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* create process definition |
|
|
|
* create process definition |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param name process definition name |
|
|
|
* @param name process definition name |
|
|
|
* @param description description |
|
|
|
* @param description description |
|
|
|
* @param globalParams global params |
|
|
|
* @param globalParams global params |
|
|
|
* @param locations locations for nodes |
|
|
|
* @param locations locations for nodes |
|
|
|
* @param timeout timeout |
|
|
|
* @param timeout timeout |
|
|
|
* @param taskRelationJson relation json for nodes |
|
|
|
* @param taskRelationJson relation json for nodes |
|
|
|
* @param taskDefinitionJson taskDefinitionJson |
|
|
|
* @param taskDefinitionJson taskDefinitionJson |
|
|
|
* @return create result code |
|
|
|
* @return create result code |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -346,7 +347,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* create single process definition |
|
|
|
* create single process definition |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param workflowCreateRequest the new workflow object will be created |
|
|
|
* @param workflowCreateRequest the new workflow object will be created |
|
|
|
* @return New ProcessDefinition object created just now |
|
|
|
* @return New ProcessDefinition object created just now |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -495,7 +496,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* query process definition list |
|
|
|
* query process definition list |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @return definition list |
|
|
|
* @return definition list |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -518,7 +519,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* query process definition simple list |
|
|
|
* query process definition simple list |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @return definition simple list |
|
|
|
* @return definition simple list |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -549,12 +550,12 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* query process definition list paging |
|
|
|
* query process definition list paging |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param searchVal search value |
|
|
|
* @param searchVal search value |
|
|
|
* @param userId user id |
|
|
|
* @param userId user id |
|
|
|
* @param pageNo page number |
|
|
|
* @param pageNo page number |
|
|
|
* @param pageSize page size |
|
|
|
* @param pageSize page size |
|
|
|
* @return process definition page |
|
|
|
* @return process definition page |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -604,7 +605,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Filter resource process definitions |
|
|
|
* Filter resource process definitions |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param workflowFilterRequest workflow filter requests |
|
|
|
* @param workflowFilterRequest workflow filter requests |
|
|
|
* @return List process definition |
|
|
|
* @return List process definition |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -644,9 +645,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* query detail of process definition |
|
|
|
* query detail of process definition |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param code process definition code |
|
|
|
* @param code process definition code |
|
|
|
* @return process definition detail |
|
|
|
* @return process definition detail |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -675,7 +676,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
* query detail of process definition |
|
|
|
* query detail of process definition |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param code process definition code |
|
|
|
* @param code process definition code |
|
|
|
* @return process definition detail |
|
|
|
* @return process definition detail |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -736,15 +737,15 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* update process definition |
|
|
|
* update process definition |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param name process definition name |
|
|
|
* @param name process definition name |
|
|
|
* @param code process definition code |
|
|
|
* @param code process definition code |
|
|
|
* @param description description |
|
|
|
* @param description description |
|
|
|
* @param globalParams global params |
|
|
|
* @param globalParams global params |
|
|
|
* @param locations locations for nodes |
|
|
|
* @param locations locations for nodes |
|
|
|
* @param timeout timeout |
|
|
|
* @param timeout timeout |
|
|
|
* @param taskRelationJson relation json for nodes |
|
|
|
* @param taskRelationJson relation json for nodes |
|
|
|
* @param taskDefinitionJson taskDefinitionJson |
|
|
|
* @param taskDefinitionJson taskDefinitionJson |
|
|
|
* @return update result code |
|
|
|
* @return update result code |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -817,11 +818,11 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Task want to delete whether used in other task, should throw exception when have be used. |
|
|
|
* Task want to delete whether used in other task, should throw exception when have be used. |
|
|
|
* |
|
|
|
* <p> |
|
|
|
* This function avoid delete task already dependencies by other tasks by accident. |
|
|
|
* This function avoid delete task already dependencies by other tasks by accident. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param processDefinition ProcessDefinition you change task definition and task relation |
|
|
|
* @param processDefinition ProcessDefinition you change task definition and task relation |
|
|
|
* @param taskRelationList All the latest task relation list from process definition |
|
|
|
* @param taskRelationList All the latest task relation list from process definition |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void taskUsedInOtherTaskValid(ProcessDefinition processDefinition, |
|
|
|
private void taskUsedInOtherTaskValid(ProcessDefinition processDefinition, |
|
|
|
List<ProcessTaskRelationLog> taskRelationList) { |
|
|
|
List<ProcessTaskRelationLog> taskRelationList) { |
|
|
@ -927,9 +928,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* verify process definition name unique |
|
|
|
* verify process definition name unique |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param name name |
|
|
|
* @param name name |
|
|
|
* @return true if process definition name not exists, otherwise false |
|
|
|
* @return true if process definition name not exists, otherwise false |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -999,7 +1000,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Process definition want to delete whether used in other task, should throw exception when have be used. |
|
|
|
* Process definition want to delete whether used in other task, should throw exception when have be used. |
|
|
|
* |
|
|
|
* <p> |
|
|
|
* This function avoid delete process definition already dependencies by other tasks by accident. |
|
|
|
* This function avoid delete process definition already dependencies by other tasks by accident. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param processDefinition ProcessDefinition you change task definition and task relation |
|
|
|
* @param processDefinition ProcessDefinition you change task definition and task relation |
|
|
@ -1166,9 +1167,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* import process definition |
|
|
|
* import process definition |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param file process metadata json file |
|
|
|
* @param file process metadata json file |
|
|
|
* @return import process |
|
|
|
* @return import process |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -1642,9 +1643,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* get task node details based on process definition |
|
|
|
* get task node details based on process definition |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser loginUser |
|
|
|
* @param loginUser loginUser |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param code process definition code |
|
|
|
* @param code process definition code |
|
|
|
* @return task node list |
|
|
|
* @return task node list |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -1671,9 +1672,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* get task node details map based on process definition |
|
|
|
* get task node details map based on process definition |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser loginUser |
|
|
|
* @param loginUser loginUser |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param codes define codes |
|
|
|
* @param codes define codes |
|
|
|
* @return task node list |
|
|
|
* @return task node list |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -1724,7 +1725,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* query process definition all by project code |
|
|
|
* query process definition all by project code |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser loginUser |
|
|
|
* @param loginUser loginUser |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @return process definitions in the project |
|
|
|
* @return process definitions in the project |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -1764,7 +1765,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* query process definition list by process definition code |
|
|
|
* query process definition list by process definition code |
|
|
|
* |
|
|
|
* |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param processDefinitionCode process definition code |
|
|
|
* @param processDefinitionCode process definition code |
|
|
|
* @return task definition list in the process definition |
|
|
|
* @return task definition list in the process definition |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -1800,8 +1801,8 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
* Encapsulates the TreeView structure |
|
|
|
* Encapsulates the TreeView structure |
|
|
|
* |
|
|
|
* |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param code process definition code |
|
|
|
* @param code process definition code |
|
|
|
* @param limit limit |
|
|
|
* @param limit limit |
|
|
|
* @return tree view json data |
|
|
|
* @return tree view json data |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -1963,9 +1964,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* batch copy process definition |
|
|
|
* batch copy process definition |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser loginUser |
|
|
|
* @param loginUser loginUser |
|
|
|
* @param projectCode projectCode |
|
|
|
* @param projectCode projectCode |
|
|
|
* @param codes processDefinitionCodes |
|
|
|
* @param codes processDefinitionCodes |
|
|
|
* @param targetProjectCode targetProjectCode |
|
|
|
* @param targetProjectCode targetProjectCode |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -1987,9 +1988,10 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* batch move process definition |
|
|
|
* batch move process definition |
|
|
|
* Will be deleted |
|
|
|
* Will be deleted |
|
|
|
* @param loginUser loginUser |
|
|
|
* |
|
|
|
* @param projectCode projectCode |
|
|
|
* @param loginUser loginUser |
|
|
|
* @param codes processDefinitionCodes |
|
|
|
* @param projectCode projectCode |
|
|
|
|
|
|
|
* @param codes processDefinitionCodes |
|
|
|
* @param targetProjectCode targetProjectCode |
|
|
|
* @param targetProjectCode targetProjectCode |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -2160,8 +2162,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* get new Task name or Process name when copy or import operate |
|
|
|
* get new Task name or Process name when copy or import operate |
|
|
|
|
|
|
|
* |
|
|
|
* @param originalName Task or Process original name |
|
|
|
* @param originalName Task or Process original name |
|
|
|
* @param suffix "_copy_" or "_import_" |
|
|
|
* @param suffix "_copy_" or "_import_" |
|
|
|
* @return new name |
|
|
|
* @return new name |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public String getNewName(String originalName, String suffix) { |
|
|
|
public String getNewName(String originalName, String suffix) { |
|
|
@ -2183,10 +2186,10 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* switch the defined process definition version |
|
|
|
* switch the defined process definition version |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param code process definition code |
|
|
|
* @param code process definition code |
|
|
|
* @param version the version user want to switch |
|
|
|
* @param version the version user want to switch |
|
|
|
* @return switch process definition version result code |
|
|
|
* @return switch process definition version result code |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -2237,11 +2240,11 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* check batch operate result |
|
|
|
* check batch operate result |
|
|
|
* |
|
|
|
* |
|
|
|
* @param srcProjectCode srcProjectCode |
|
|
|
* @param srcProjectCode srcProjectCode |
|
|
|
* @param targetProjectCode targetProjectCode |
|
|
|
* @param targetProjectCode targetProjectCode |
|
|
|
* @param result result |
|
|
|
* @param result result |
|
|
|
* @param failedProcessList failedProcessList |
|
|
|
* @param failedProcessList failedProcessList |
|
|
|
* @param isCopy isCopy |
|
|
|
* @param isCopy isCopy |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void checkBatchOperateResult(long srcProjectCode, long targetProjectCode, |
|
|
|
private void checkBatchOperateResult(long srcProjectCode, long targetProjectCode, |
|
|
|
Map<String, Object> result, List<String> failedProcessList, boolean isCopy) { |
|
|
|
Map<String, Object> result, List<String> failedProcessList, boolean isCopy) { |
|
|
@ -2268,11 +2271,11 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* query the pagination versions info by one certain process definition code |
|
|
|
* query the pagination versions info by one certain process definition code |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user info to check auth |
|
|
|
* @param loginUser login user info to check auth |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param pageNo page number |
|
|
|
* @param pageNo page number |
|
|
|
* @param pageSize page size |
|
|
|
* @param pageSize page size |
|
|
|
* @param code process definition code |
|
|
|
* @param code process definition code |
|
|
|
* @return the pagination process definition versions info of the certain process definition |
|
|
|
* @return the pagination process definition versions info of the certain process definition |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -2304,52 +2307,42 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* delete one certain process definition by version number and process definition code |
|
|
|
* delete one certain process definition by version number and process definition code |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user info to check auth |
|
|
|
* @param loginUser login user info to check auth |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param code process definition code |
|
|
|
* @param code process definition code |
|
|
|
* @param version version number |
|
|
|
* @param version version number |
|
|
|
* @return delete result code |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
@Transactional |
|
|
|
public Map<String, Object> deleteProcessDefinitionVersion(User loginUser, long projectCode, long code, |
|
|
|
public void deleteProcessDefinitionVersion(User loginUser, |
|
|
|
int version) { |
|
|
|
long projectCode, |
|
|
|
Project project = projectMapper.queryByCode(projectCode); |
|
|
|
long code, |
|
|
|
// check if user have write perm for project
|
|
|
|
int version) { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
projectService.checkHasProjectWritePermissionThrowException(loginUser, projectCode); |
|
|
|
boolean hasProjectAndWritePerm = projectService.hasProjectAndWritePerm(loginUser, project, result); |
|
|
|
|
|
|
|
if (!hasProjectAndWritePerm) { |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); |
|
|
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); |
|
|
|
|
|
|
|
|
|
|
|
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { |
|
|
|
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { |
|
|
|
log.error("Process definition does not exist, code:{}.", code); |
|
|
|
throw new ServiceException(Status.PROCESS_DEFINE_NOT_EXIST, code); |
|
|
|
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (processDefinition.getVersion() == version) { |
|
|
|
|
|
|
|
log.warn( |
|
|
|
|
|
|
|
"Process definition can not be deleted due to version is being used, projectCode:{}, processDefinitionCode:{}, version:{}.", |
|
|
|
|
|
|
|
projectCode, code, version); |
|
|
|
|
|
|
|
putMsg(result, Status.MAIN_TABLE_USING_VERSION); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int deleteLog = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version); |
|
|
|
|
|
|
|
int deleteRelationLog = processTaskRelationLogMapper.deleteByCode(code, version); |
|
|
|
|
|
|
|
if (deleteLog == 0 || deleteRelationLog == 0) { |
|
|
|
|
|
|
|
log.error( |
|
|
|
|
|
|
|
"Delete process definition version error, projectCode:{}, processDefinitionCode:{}, version:{}.", |
|
|
|
|
|
|
|
projectCode, code, version); |
|
|
|
|
|
|
|
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); |
|
|
|
|
|
|
|
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
log.info( |
|
|
|
|
|
|
|
"Delete process definition version complete, projectCode:{}, processDefinitionCode:{}, version:{}.", |
|
|
|
|
|
|
|
projectCode, code, version); |
|
|
|
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
if (processDefinition.getVersion() == version) { |
|
|
|
|
|
|
|
log.warn("This version: {} of workflow: {} is the main version cannot delete by version", code, version); |
|
|
|
|
|
|
|
throw new ServiceException(Status.MAIN_TABLE_USING_VERSION); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// check whether there exist running workflow instance under the process definition
|
|
|
|
|
|
|
|
List<ProcessInstance> workflowInstances = processInstanceService.queryByWorkflowCodeVersionStatus( |
|
|
|
|
|
|
|
code, |
|
|
|
|
|
|
|
version, |
|
|
|
|
|
|
|
WorkflowExecutionStatus.getNotTerminalStatus()); |
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(workflowInstances)) { |
|
|
|
|
|
|
|
throw new ServiceException(Status.DELETE_PROCESS_DEFINITION_EXECUTING_FAIL, workflowInstances.size()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int deleteLog = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version); |
|
|
|
|
|
|
|
int deleteRelationLog = processTaskRelationLogMapper.deleteByCode(code, version); |
|
|
|
|
|
|
|
if (deleteLog == 0 || deleteRelationLog == 0) { |
|
|
|
|
|
|
|
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
log.info("Delete version: {} of workflow: {}, projectCode:{}.", version, code, projectCode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void updateWorkflowValid(User user, ProcessDefinition oldProcessDefinition, |
|
|
|
private void updateWorkflowValid(User user, ProcessDefinition oldProcessDefinition, |
|
|
@ -2380,9 +2373,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
/** |
|
|
|
/** |
|
|
|
* update single resource workflow |
|
|
|
* update single resource workflow |
|
|
|
* |
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param workflowCode workflow resource code want to update |
|
|
|
* @param workflowCode workflow resource code want to update |
|
|
|
* @param workflowUpdateRequest workflow update resource object |
|
|
|
* @param workflowUpdateRequest workflow update resource object |
|
|
|
* @return Process definition |
|
|
|
* @return Process definition |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -2546,7 +2539,8 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* view process variables |
|
|
|
* view process variables |
|
|
|
* @param loginUser login user |
|
|
|
* |
|
|
|
|
|
|
|
* @param loginUser login user |
|
|
|
* @param projectCode project code |
|
|
|
* @param projectCode project code |
|
|
|
* @param code process definition code |
|
|
|
* @param code process definition code |
|
|
|
* @return variables data |
|
|
|
* @return variables data |
|
|
|