# # # # update_report_job() # # # Creates a new report_job from an exsiting one but with a different output_format, # it returns a new report_job_id # # # include "templates.statistics.util.get_html_rep_element_exists"; subroutine(update_report_job( string session_id, string profile_name, string report_name, string existing_report_job_id, string output_format), ( string report_jobs_path = "sessions_cache." . session_id . ".profiles." . profile_name . ".report_jobs"; # # # Clone existing report_job to new report_job # # string report_job_id = md5_digest(report_name . now_us()); clone_node(report_jobs_path . "." . existing_report_job_id, report_jobs_path . "." . report_job_id); node report_job = report_jobs_path . "." . report_job_id; # # # # Update the report_job # # # # # KHP-RC, we use a simple approach right now and simply change # the report_element_html_formatting_id without checking the columns display format type. # Though this shouldn't matter much, the only difference is that the html of a report element # which is in command line has a different report_element_html_formatting_id than a report # element send from the reports GUI. node html_formatting = report_job{"html_formatting"}; set_subnode_value(html_formatting, "output_format", output_format); # string html_formatting_checksum = md5_digest(node_as_string(html_formatting)); node report_elements = report_job{"report_elements"}; node report_element; string report_element_html_formatting_id; bool is_ready_report = true; bool create_report_element; string report_element_id; string lai_directory = LOGANALYSISINFO_DIRECTORY; string html_report_element_id; bool html_report_element_exists; foreach report_element report_elements ( report_element_id = @report_element{"report_element_id"}; # # We give the report element simply a new report_element_html_formatting_id! # report_element_html_formatting_id = md5_digest(@report_element{"report_element_html_formatting_id "} . output_format); # # Check if this report element exists # html_report_element_id = get_html_report_element_id(report_element_id, report_element_html_formatting_id); html_report_element_exists = get_html_rep_element_exists(profile_name, html_report_element_id); if (!html_report_element_exists) then ( is_ready_report = false; create_report_element = true; ) else ( create_report_element = false; ); set_subnode_value(report_element, "report_element_html_formatting_id", report_element_html_formatting_id); set_subnode_value(report_element, "create_report_element", create_report_element); ); set_subnode_value(report_job, "is_ready_report", is_ready_report); # # # Save the report job # # save_node(report_job); report_job_id; ));