# # # get_xml_report.cfv # (Called from actions.get_report.cfg) # # include "templates.util.base_util"; include "templates.util.get_basic_ids"; include "templates.util.database"; include "templates.statistics.util.verify_caches"; include "templates.statistics.util.create_report_info"; include "templates.statistics.util.create_report_job"; include "templates.statistics.build_report_elements"; include "templates.statistics.static_reports.assemble_xml_report"; subroutine(get_xml_report( string profile_name, node simulated_command_line), ( debug_message("\n\n### get_xml_report() \n\n"); debug_message("#### profile_name: " . profile_name . "\n"); debug_message("#### simulated_command_line:\n" . node_as_string(simulated_command_line) . "\n"); bool is_root_admin = true; # ToDo, is this the root_admin? string user_node_name = "root_admin"; # ToDo, is this the root_admin? string current_language = get_current_language(user_node_name); node profile = "profiles." . profile_name; string report_name = @simulated_command_line{"report_name"}; # # Create a session directory # string session_id = "network_api_" . now(); string file_path = LOGANALYSISINFO_DIRECTORY . "sessions_cache/" . session_id . "/placeholder.txt"; write_file(file_path, "I am just a placeholder"); # # # # Check for number of licensed profiles # # # handle_valid_number_of_profiles("profiles"); # # # Get basic IDs # # node basic_ids = get_basic_ids(profile, current_language); # # # # Initial setup # (Checks/creates profile cache, basic data and sessions_cache setup) # # # bool read_extended_profile_dat_from_sessions = false; verify_caches(session_id, read_extended_profile_dat_from_sessions, is_root_admin, profile, profile_name, basic_ids); # # # # Get the database state # # # bool is_real_time_processing = get_is_real_time_processing(profile_name); if (is_real_time_processing) then ( # Pause the database in case that it is building so that we get an up to date database info node # (This pauses any build for the current task) get_database_access(); ); node db_state_node = get_database_info(profile_name, true); # get_date_info must be true! # # # # Create report_info and report_job # # # v.temp_expanded_menu_groups = ""; node expanded_menu_groups = "v.temp_expanded_menu_groups"; # expanded_menu_groups is used for dynamic reports only, so we set an empty node string report_info_id = now_us(); bool is_command_line = true; string user_name = ""; create_report_info( session_id, user_name, is_root_admin, report_info_id, profile_name, report_name, is_command_line, simulated_command_line ); string date_filter = @simulated_command_line{"date_filter"}; string command_line_filter = @simulated_command_line{"filters"}; string command_line_filter_comment = @simulated_command_line{"filters_comment"}; string filter_id = ""; bool is_calendar = false; string output_format = "xml"; string report_job_id = create_report_job( session_id, is_root_admin, basic_ids, current_language, profile_name, date_filter, command_line_filter, command_line_filter_comment, filter_id, report_info_id, is_calendar, output_format, db_state_node, expanded_menu_groups ); string session_profile_path = "sessions_cache." . session_id . ".profiles." . profile_name; node report_job = session_profile_path . ".report_jobs." . report_job_id; # Check for date_filter errors in report_job (invalid date filter syntax or out of range!) # If there is any date filter error the following subroutine will throw an error. # validate_date_filter_in_command_line_report(report_job); bool is_ready_report = @report_job{"is_ready_report"}; if (!is_ready_report) then ( # # Create the report elements # build_report_elements(session_id, profile_name, report_job); ); # # # Assemble XML report # # string xml_report = assemble_xml_report( session_id, is_root_admin, profile_name, report_name, report_job ); # Return xml_report; ));