Search in sources :

Example 1 with ScriptExecuteLogModel

use of io.jpom.model.script.ScriptExecuteLogModel in project Jpom by dromara.

the class ServerScriptHandler method createLog.

/**
 * 创建执行日志
 *
 * @param attributes 参数属性
 * @return 执行ID
 */
private String createLog(Map<String, Object> attributes, ScriptModel scriptModel) {
    UserModel userModel = (UserModel) attributes.get("userInfo");
    // 
    try {
        BaseServerController.resetInfo(userModel);
        // 
        ScriptModel scriptCacheModel = new ScriptModel();
        scriptCacheModel.setId(scriptModel.getId());
        scriptCacheModel.setLastRunUser(userModel.getId());
        nodeScriptServer.update(scriptCacheModel);
        // 
        ScriptExecuteLogModel scriptExecuteLogCacheModel = logServer.create(scriptModel, 0);
        return scriptExecuteLogCacheModel.getId();
    } finally {
        BaseServerController.removeAll();
    }
}
Also used : UserModel(io.jpom.model.data.UserModel) ScriptModel(io.jpom.model.script.ScriptModel) ScriptExecuteLogModel(io.jpom.model.script.ScriptExecuteLogModel)

Example 2 with ScriptExecuteLogModel

use of io.jpom.model.script.ScriptExecuteLogModel in project Jpom by dromara.

the class ScriptExecuteLogServer method create.

/**
 * 创建执行记录
 *
 * @param scriptModel 脚本
 * @param type        执行类型
 * @return 对象
 */
public ScriptExecuteLogModel create(ScriptModel scriptModel, int type) {
    ScriptExecuteLogModel scriptExecuteLogModel = new ScriptExecuteLogModel();
    scriptExecuteLogModel.setScriptId(scriptModel.getId());
    scriptExecuteLogModel.setScriptName(scriptModel.getName());
    scriptExecuteLogModel.setTriggerExecType(type);
    scriptExecuteLogModel.setWorkspaceId(scriptModel.getWorkspaceId());
    super.insert(scriptExecuteLogModel);
    return scriptExecuteLogModel;
}
Also used : ScriptExecuteLogModel(io.jpom.model.script.ScriptExecuteLogModel)

Aggregations

ScriptExecuteLogModel (io.jpom.model.script.ScriptExecuteLogModel)2 UserModel (io.jpom.model.data.UserModel)1 ScriptModel (io.jpom.model.script.ScriptModel)1