note description: "Provide an interface to statistics data." author: "Patrick Ruckstuhl " date: "$Date$" revision: "$Revision$" class STATISTICS_INTERFACE inherit BASE_INTERFACE A_CONFIG_CONSTANTS create make feature -- Commands retrieve_workitem (a_msg: A_MESSAGE) -- Retrieve workitem statistics. require a_msg_ok: a_msg /= Void local l_msg: O_STATISTICS_RETRIEVE_WORKITEM_MESSAGE l_rep: O_STATISTICS_RETRIEVE_WORKITEM_REPLY_MESSAGE l_workitem_stat_item: TUPLE [total: INTEGER; issue: INTEGER; release: INTEGER; commit: INTEGER; wiki: INTEGER; blog: INTEGER; comment: INTEGER] l_workitem_stats: DS_HASH_TABLE [TUPLE [total: INTEGER; issue: INTEGER; release: INTEGER; commit: INTEGER; wiki: INTEGER; blog: INTEGER; comment: INTEGER], STRING] l_stat: O_STATISTICS_WORKITEM_STAT_MESSAGE l_stats_map: DS_HASH_TABLE [O_STATISTICS_WORKITEM_STAT_MESSAGE, A_STRING_VALUE] do l_msg ?= a_msg check valid_message: l_msg /= Void end l_workitem_stats := workitem_access.retrieve_workitem_statistics create l_stats_map.make (l_workitem_stats.count) from l_workitem_stats.start until l_workitem_stats.after loop l_workitem_stat_item := l_workitem_stats.item_for_iteration create l_stat.make ( create {A_INTEGER_VALUE}.make (l_workitem_stat_item.total), create {A_INTEGER_VALUE}.make (l_workitem_stat_item.issue), create {A_INTEGER_VALUE}.make (l_workitem_stat_item.release), create {A_INTEGER_VALUE}.make (l_workitem_stat_item.commit), create {A_INTEGER_VALUE}.make (l_workitem_stat_item.wiki), create {A_INTEGER_VALUE}.make (l_workitem_stat_item.blog), create {A_INTEGER_VALUE}.make (l_workitem_stat_item.comment)) l_stats_map.force (l_stat, create {A_STRING_VALUE}.make (l_workitem_stats.key_for_iteration)) -- Increment l_workitem_stats.forth end create l_rep.make (create {A_MAP_VALUE [O_STATISTICS_WORKITEM_STAT_MESSAGE]}.make (l_stats_map)) node.send_message_reply (l_rep, a_msg) end retrieve_issue (a_msg: A_MESSAGE) -- Retrieve issue statistics. require a_msg_ok: a_msg /= Void local l_msg: O_STATISTICS_RETRIEVE_ISSUE_MESSAGE l_rep: O_STATISTICS_RETRIEVE_ISSUE_REPLY_MESSAGE l_issue_stats: DS_HASH_TABLE [TUPLE [open: INTEGER; closed: INTEGER], STRING] l_issue_stat_item: TUPLE [open: INTEGER; closed: INTEGER] l_issue_map: DS_HASH_TABLE [O_STATISTICS_ISSUE_STAT_MESSAGE, A_STRING_VALUE] l_stat: O_STATISTICS_ISSUE_STAT_MESSAGE do l_msg ?= a_msg check valid_message: l_msg /= Void end l_issue_stats := issue_access.retrieve_issue_statistics create l_issue_map.make (l_issue_stats.count) from l_issue_stats.start until l_issue_stats.after loop l_issue_stat_item := l_issue_stats.item_for_iteration create l_stat.make ( create {A_INTEGER_VALUE}.make (l_issue_stat_item.open), create {A_INTEGER_VALUE}.make (l_issue_stat_item.closed)) l_issue_map.force (l_stat, create {A_STRING_VALUE}.make (l_issue_stats.key_for_iteration)) -- Increment l_issue_stats.forth end create l_rep.make (create {A_MAP_VALUE [O_STATISTICS_ISSUE_STAT_MESSAGE]}.make (l_issue_map)) node.send_message_reply (l_rep, a_msg) end end