use of io.jpom.model.script.ScriptModel in project Jpom by dromara.
the class ScriptController method unbind.
/**
* 释放脚本关联的节点
*
* @param id 脚本ID
* @return json
*/
@RequestMapping(value = "unbind.json", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(method = MethodFeature.DEL)
public String unbind(@ValidatorItem String id) {
ScriptModel update = new ScriptModel();
update.setId(id);
update.setNodeIds(StrUtil.EMPTY);
scriptServer.updateById(update, getRequest());
return JsonMessage.getString(200, "解绑成功");
}
use of io.jpom.model.script.ScriptModel in project Jpom by dromara.
the class ScriptController method del.
@RequestMapping(value = "del.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(method = MethodFeature.DEL)
public String del(String id) {
HttpServletRequest request = getRequest();
ScriptModel server = scriptServer.getByKey(id, request);
if (server != null) {
File file = server.scriptPath();
boolean del = FileUtil.del(file);
Assert.state(del, "清理脚本文件失败");
// 删除节点中的脚本
String nodeIds = server.getNodeIds();
List<String> delNode = StrUtil.splitTrim(nodeIds, StrUtil.COMMA);
this.syncDelNodeScript(server, getUser(), delNode);
scriptServer.delByKey(id, request);
//
scriptExecuteLogServer.delByWorkspace(request, entity -> entity.set("scriptId", id));
}
return JsonMessage.getString(200, "删除成功");
}
Aggregations