use of com.qlangtech.tis.git.GitUtils.JoinRule in project tis by qlangtech.
the class OfflineManager method editWorkflow.
public void editWorkflow(WorkflowPojo pojo, BasicModule action, Context context) throws Exception {
String name = pojo.getName();
WorkFlowCriteria criteria = new WorkFlowCriteria();
criteria.createCriteria().andNameEqualTo(name);
List<WorkFlow> workflowList = workflowDAOFacade.getWorkFlowDAO().selectByExample(criteria);
// 1、检测是否存在
if (CollectionUtils.isEmpty(workflowList)) {
action.addErrorMessage(context, "没有名字为" + name + "的工作流");
return;
}
WorkFlow workFlow = workflowList.get(0);
if (workFlow.getInChange().intValue() == 0) {
action.addErrorMessage(context, "工作流不在变更中");
return;
}
// 2、检测xml是否正确
JoinRule task = pojo.getTask();
if (task == null || StringUtils.isBlank(task.getContent())) {
action.addErrorMessage(context, "脚本内容不能为空");
return;
}
if (!isXmlValid(task)) {
action.addErrorMessage(context, "XML解析失败,请检测XML格式");
return;
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("name", name);
// jsonObject.put("tables", StringUtils.join(pojo.getDependTableIds(), ","));
jsonObject.put("task", pojo.getTask());
try {
GitUtils.$().updateWorkflowFile(name, name, jsonObject.toString(1), "update workflow " + name);
} catch (Exception e) {
action.addErrorMessage(context, "git配置文件修改失败");
action.addErrorMessage(context, e.getMessage());
}
}
use of com.qlangtech.tis.git.GitUtils.JoinRule in project tis by qlangtech.
the class OfflineDatasourceAction method getWorkflowPojo.
private WorkflowPojo getWorkflowPojo(Context context) {
String name = this.getString("workflowName");
if (StringUtils.isBlank(name)) {
this.addErrorMessage(context, "工作流名不能为空");
return null;
}
if (!isWordCharacter(name)) {
this.addErrorMessage(context, "工作流名必须由英文字符,数字和下划线组成");
return null;
}
String taskScript = this.getString("taskScript");
if (StringUtils.isBlank(taskScript)) {
this.addErrorMessage(context, "脚本内容不能为空");
return null;
}
return new WorkflowPojo(name, new JoinRule(taskScript));
}
Aggregations