indexing description: "Provide an interface to comment data." author: "Marco Zietzling " date: "$Date$" revision: "$Revision$" class COMMENT_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 comment_add (a_msg: O_MESSAGE) is -- Add a new comment workitem according to a_msg. require a_msg_ok: a_msg /= Void local l_pc_msg: O_COMMENT_ADD_MESSAGE l_workitem: WORKITEM l_workitem_comment: WORKITEM_COMMENT 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 wiki_add_message: l_pc_msg /= Void end create l_workitem.make user_access.retrieve_user_by_session (l_pc_msg.session) if user_access.is_found then l_user_ret := user_access.last_user project_access.retrieve_project_by_id (l_pc_msg.project) if project_access.is_found then l_project_ret := project_access.last_project l_workitem.set_type_id (6) 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_comment.make l_workitem_comment.set_workitem_id (l_workitem_id) l_workitem_comment.set_title (l_pc_msg.title) l_workitem_comment.set_text (l_pc_msg.text) l_workitem_comment.set_reference_url (l_pc_msg.reference_url) l_workitem_comment.set_is_new (l_pc_msg.is_new.out) l_workitem_comment.set_comment_type (l_pc_msg.comment_type) comment_access.insert_comment_workitem(l_workitem_comment) 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_session_timeout) node.send_message_reply (l_status, a_msg) end end end