note description: "Provide an interface to comment data." author: "Marco Zietzling " date: "$Date$" revision: "$Revision$" class COMMENT_INTERFACE inherit BASE_INTERFACE O_WORKITEM_CONSTANTS create make feature -- Commands comment_add (a_msg: A_MESSAGE) -- 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_status: A_GENERAL_STATUS_MESSAGE l_user_ret: USER l_project_ret: PROJECT l_workitem_add_reply: O_COMMENT_ADD_REPLY_MESSAGE l_comment_workitem: WI_FULL_COMMENT 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.value) if user_access.is_found then l_user_ret := user_access.last_user project_access.retrieve_project_by_id (l_pc_msg.project.value.to_integer) if project_access.is_found then l_project_ret := project_access.last_project create l_comment_workitem.make ( l_project_ret.project_id, l_project_ret.name, l_user_ret.user_id, l_user_ret.name, l_pc_msg.reference_url, l_pc_msg.title, l_pc_msg.text, l_pc_msg.is_new, l_pc_msg.is_private, comment_access.comment_type_id_from_string (l_pc_msg.comment_type)) workitem_access.store_wi (l_comment_workitem) create l_workitem_add_reply.make (workitem_access.last_insert_id) 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