diff --git a/web/app/dao/LineageDAO.java b/web/app/dao/LineageDAO.java index fc0f1a5677..48190ad443 100644 --- a/web/app/dao/LineageDAO.java +++ b/web/app/dao/LineageDAO.java @@ -148,6 +148,9 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO private final static String GET_OBJECT_NAME_BY_MAPPED_NAME = "SELECT object_name " + "FROM cfg_object_name_map WHERE mapped_object_name = ?"; + private final static String GET_GIT_LOCATION_BY_JOB_ID = "SELECT script_url " + + "FROM job_execution_script WHERE app_id = ? and job_id = ? LIMIT 1"; + public static JsonNode getObjectAdjacnet(String urn, int upLevel, int downLevel, int lookBackTime) { @@ -498,6 +501,22 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO return results; } + public static String getGitLocation(int appId, Long jobId) + { + List> rows = null; + String location = ""; + rows = getJdbcTemplate().queryForList(GET_GIT_LOCATION_BY_JOB_ID, appId, jobId); + if (rows != null) + { + for (Map row : rows) + { + location = (String)row.get("script_url"); + break; + } + } + return location; + } + public static void getNodes( LineagePathInfo pathInfo, int level, @@ -584,7 +603,10 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO node.job_name = (String) row.get("job_name"); node.job_path = (String) row.get("flow_path") + "/" + node.job_name; node.exec_id = jobExecId; + node.application_id = (Integer)row.get("app_id"); + node.job_id = (Long)row.get("job_id"); node.operation = (String) row.get("operation"); + node.git_location = getGitLocation(node.application_id, node.job_id); node.source_target_type = (String) row.get("source_target_type"); node.level = level; node._sort_list.add("cluster"); @@ -594,6 +616,7 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO node._sort_list.add("job_start_time"); node._sort_list.add("job_end_time"); node._sort_list.add("exec_id"); + node._sort_list.add("job_id"); addedJobNodes.put(jobExecId, node); List sourceNodeList = new ArrayList(); List targetNodeList = new ArrayList(); @@ -916,6 +939,7 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO node.pre_jobs = (String)row.get("pre_jobs"); node.post_jobs = (String)row.get("post_jobs"); node.job_id = (Long)row.get("job_id"); + node.git_location = getGitLocation(appID, node.job_id); node.job_start_time = row.get("start_time").toString(); node.job_end_time = row.get("end_time").toString(); node.exec_id = jobExecId; @@ -923,6 +947,7 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO node._sort_list.add("job_path"); node._sort_list.add("job_name"); node._sort_list.add("job_type"); + node._sort_list.add("job_id"); node._sort_list.add("job_start_time"); node._sort_list.add("job_end_time"); Integer id = addedJobNodes.get(jobExecId);