* @return
* @see com.sogou.qadev.service.cynthia.service.ScriptAccessSession#queryScripts(com.sogou.qadev.service.cynthia.bean.Data, com.sogou.qadev.service.cynthia.bean.ExecuteTime, com.sogou.qadev.service.cynthia.service.DataAccessSession, com.sogou.qadev.service.cynthia.bean.Template, com.sogou.qadev.service.cynthia.bean.Flow)
*/
@Override
public Script[] queryScripts(Data data, ExecuteTime executeTime, DataAccessSession das , Template template , Flow flow) {
Action action = null;
if(data.getObject("logActionId") != null)
{
action = flow.getAction((UUID)data.getObject("logActionId"));
if(action == null)
return null;
}
StringBuffer sqlStrb = new StringBuffer();
sqlStrb.append("SELECT * FROM script_new WHERE 1=1");
sqlStrb.append(" AND (template_type_ids IS NULL");
sqlStrb.append(" OR template_type_ids LIKE '%").append(template.getTemplateTypeId()).append("%')");
sqlStrb.append(" AND (template_ids IS NULL");
sqlStrb.append(" OR template_ids LIKE '%").append(template.getId()).append("%')");
sqlStrb.append(" AND (flow_ids IS NULL");
sqlStrb.append(" OR flow_ids LIKE '%").append(flow.getId()).append("%')");
sqlStrb.append(" AND (end_stat_ids IS NULL");
sqlStrb.append(" OR end_stat_ids LIKE '%").append(data.getStatusId()).append("%')");
if(action == null)
sqlStrb.append(" AND action_ids IS NULL");
else
{
sqlStrb.append(" AND (action_ids IS NULL");
sqlStrb.append(" OR action_ids LIKE '%").append(action.getId()).append("%')");
}
if(executeTime.equals(ExecuteTime.beforeCommit))
sqlStrb.append(" AND is_before_commit IS TRUE");
if(executeTime.equals(ExecuteTime.afterSuccess))