indexing description: "Provide an interface to commit data." author: "Peter Wyss " date: "$Date$" revision: "$Revision$" class COMMIT_INTERFACE inherit BASE_INTERFACE redefine make end O_WORKITEM_CONSTANTS create make feature {NONE} -- Initialization make (a_node: like node; a_db_handler: like db_handler; a_policy_cache: like policy_cache) is -- Initialize. do Precursor (a_node, a_db_handler, a_policy_cache) end feature -- Commands commit_add (a_msg: O_MESSAGE) is -- Add a new commit workitem according to a_msg. require a_msg_ok: a_msg /= Void local l_pc_msg: O_COMMIT_ADD_MESSAGE l_workitem: WORKITEM l_workitem_commit: WORKITEM_COMMIT l_status: O_GENERAL_STATUS_MESSAGE l_user_ret: USER l_project_ret: PROJECT l_workitem_id: INTEGER l_workitem_add_reply: O_GENERIC_MESSAGE do l_pc_msg ?= a_msg check commit_add_message: l_pc_msg /= Void end create l_workitem.make user_access.retrieve_user_by_name (l_pc_msg.user, False) if user_access.is_found then l_user_ret := user_access.last_user project_access.retrieve_project_by_name (l_pc_msg.project) if project_access.is_found then l_project_ret := project_access.last_project l_workitem.set_type_id (3) l_workitem.set_user_id (l_user_ret.user_id) l_workitem.set_project_id (l_project_ret.project_id) workitem_access.insert_workitem (l_workitem) l_workitem_id := workitem_access.last_insert_id create l_workitem_commit.make l_workitem_commit.set_workitem_id (l_workitem_id) l_workitem_commit.set_revision (l_pc_msg.revision) l_workitem_commit.set_log (l_pc_msg.log) l_workitem_commit.set_diff (l_pc_msg.diff) commit_access.insert_commit_workitem(l_workitem_commit) create l_workitem_add_reply.make (workitem_namespace, workitem_add_reply_type) l_workitem_add_reply.add_argument ("workitem_id", l_workitem_id.out) node.send_message_reply (l_workitem_add_reply, a_msg) else create l_status.make (False, err_invalid_project) node.send_message_reply (l_status, a_msg) end else create l_status.make (False, err_invalid_user) node.send_message_reply (l_status, a_msg) end end end