indexing description: "Provide an interface to blog data." author: "Peter Wyss " date: "$Date$" revision: "$Revision$" class BLOG_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 blog_add (a_msg: O_MESSAGE) is -- Add a new blog workitem according to a_msg. require a_msg_ok: a_msg /= Void local l_pc_msg: O_BLOG_ADD_MESSAGE l_workitem: WORKITEM l_workitem_blog: WORKITEM_BLOG 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 blog_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 (5) 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_blog.make l_workitem_blog.set_workitem_id (l_workitem_id) l_workitem_blog.set_title (l_pc_msg.title) l_workitem_blog.set_diff (l_pc_msg.diff) l_workitem_blog.set_revision (l_pc_msg.revision) l_workitem_blog.set_old_revision (l_pc_msg.old_revision) blog_access.insert_blog_workitem(l_workitem_blog) 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