Search in sources :

Example 1 with ProjectInfoCacheModel

use of io.jpom.model.node.ProjectInfoCacheModel in project Jpom by dromara.

the class ProjectInfoCacheService method exists.

public boolean exists(String workspaceId, String nodeId, String id) {
    ProjectInfoCacheModel projectInfoCacheModel = new ProjectInfoCacheModel();
    projectInfoCacheModel.setWorkspaceId(workspaceId);
    projectInfoCacheModel.setNodeId(nodeId);
    projectInfoCacheModel.setProjectId(id);
    return super.exists(projectInfoCacheModel);
}
Also used : ProjectInfoCacheModel(io.jpom.model.node.ProjectInfoCacheModel)

Example 2 with ProjectInfoCacheModel

use of io.jpom.model.node.ProjectInfoCacheModel in project Jpom by dromara.

the class MonitorItem method notifyMsg.

private void notifyMsg(NodeModel nodeModel, MonitorNotifyLog monitorNotifyLog) {
    List<String> notify = monitorModel.notifyUser();
    // 发送通知
    if (monitorNotifyLog.getTitle() == null) {
        return;
    }
    ProjectInfoCacheModel projectInfoCacheModel = projectInfoCacheService.getData(nodeModel.getId(), monitorNotifyLog.getProjectId());
    // 
    notify.forEach(notifyUser -> this.sendNotifyMsgToUser(monitorNotifyLog, notifyUser));
    // 
    this.sendNotifyMsgToWebhook(monitorNotifyLog, nodeModel, projectInfoCacheModel, monitorModel.getWebhook());
}
Also used : ProjectInfoCacheModel(io.jpom.model.node.ProjectInfoCacheModel)

Example 3 with ProjectInfoCacheModel

use of io.jpom.model.node.ProjectInfoCacheModel in project Jpom by dromara.

the class NodeEditController method del.

/**
 * 删除节点
 *
 * @param id 节点id
 * @return json
 */
@PostMapping(value = "del.json", produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(method = MethodFeature.DEL)
public String del(@ValidatorItem String id) {
    HttpServletRequest request = getRequest();
    this.checkDataBind(id, request);
    // 
    {
        ProjectInfoCacheModel projectInfoCacheModel = new ProjectInfoCacheModel();
        projectInfoCacheModel.setNodeId(id);
        projectInfoCacheModel.setWorkspaceId(projectInfoCacheService.getCheckUserWorkspace(request));
        boolean exists = projectInfoCacheService.exists(projectInfoCacheModel);
        Assert.state(!exists, "该节点下还存在项目,不能删除");
    }
    // 
    {
        ScriptCacheModel scriptCacheModel = new ScriptCacheModel();
        scriptCacheModel.setNodeId(id);
        scriptCacheModel.setWorkspaceId(nodeScriptServer.getCheckUserWorkspace(request));
        boolean exists = nodeScriptServer.exists(scriptCacheModel);
        Assert.state(!exists, "该节点下还存在脚本模版,不能删除");
    }
    // 
    this.delNodeData(id, request);
    return JsonMessage.getString(200, "操作成功");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ProjectInfoCacheModel(io.jpom.model.node.ProjectInfoCacheModel) ScriptCacheModel(io.jpom.model.node.ScriptCacheModel) Feature(io.jpom.permission.Feature) MethodFeature(io.jpom.permission.MethodFeature) ClassFeature(io.jpom.permission.ClassFeature)

Aggregations

ProjectInfoCacheModel (io.jpom.model.node.ProjectInfoCacheModel)3 ScriptCacheModel (io.jpom.model.node.ScriptCacheModel)1 ClassFeature (io.jpom.permission.ClassFeature)1 Feature (io.jpom.permission.Feature)1 MethodFeature (io.jpom.permission.MethodFeature)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1