indexing description: "Comment add message." author: "Marco Zietzling " date: "$Date$" revision: "$Revision$" class O_COMMENT_ADD_MESSAGE inherit O_SESSION_MESSAGE rename make as make_session redefine make_from_generic, arguments end O_COMMENT_CONSTANTS undefine out end create make create {O_MESSAGE_FACTORY} make_from_generic feature {NONE} -- Initialization make (a_session: like session; a_project: like project; a_title: like title; a_text: like text; a_reference_url: like reference_url; a_is_new: like is_new; a_comment_type: like comment_type) is -- Create. require a_session_ok: a_session /= Void and then not a_session.is_empty a_project_ok: a_project > 0 a_title_ok: a_title /= Void and then not a_title.is_empty a_text_ok: a_text /= Void and then not a_text.is_empty a_reference_url_ok: a_reference_url /= Void and then not a_reference_url.is_empty a_comment_type_ok: a_comment_type /= Void and then not a_comment_type.is_empty do make_session (a_session) project := a_project title := a_title text := a_text reference_url := a_reference_url is_new := a_is_new comment_type := a_comment_type ensure project_set: project = a_project title_set: title = a_title text_set: text = a_text reference_url_set: reference_url = a_reference_url is_new_set: is_new = a_is_new comment_type_set: comment_type = a_comment_type end make_from_generic (a_msg: O_GENERIC_MESSAGE) is -- Create from a generic message. local l_args: HASH_TABLE [STRING, STRING] do Precursor (a_msg) l_args := a_msg.arguments project := l_args.item (project_argument).to_integer title := l_args.item (title_argument) text := l_args.item (text_argument) reference_url := l_args.item (reference_url_argument) is_new := l_args.item (is_new_argument).to_boolean comment_type := l_args.item (comment_type_argument) end feature -- Access namespace: STRING is -- Namespace of the message type. once Result := comment_namespace end type: STRING is -- Type of the message. once Result := comment_add_type end project: INTEGER -- ID of the project. title: STRING -- Title of the comment. text: STRING -- Comment text. reference_url: STRING -- URL to the comment. is_new: BOOLEAN -- Is this a new comment or an edited comment. comment_type: STRING -- Is this a forum topic, a forum post, a wiki comment, a picture comment, ... arguments: HASH_TABLE [STRING, STRING] is -- Named arguments. do Result := Precursor Result.force (project.out, project_argument) Result.force (title, title_argument) Result.force (text, text_argument) Result.force (reference_url, reference_url_argument) Result.force (is_new.out, is_new_argument) Result.force (comment_type, comment_type_argument) end feature {NONE} -- Implementation project_argument: STRING is "project" title_argument: STRING is "title" text_argument: STRING is "text" reference_url_argument: STRING is "reference_url" is_new_argument: STRING is "is_new" comment_type_argument: STRING is "comment_argument" invariant project_ok: project > 0 title_ok: title /= Void and then not title.is_empty text_ok: text /= Void and then not text.is_empty reference_url_ok: reference_url /= Void and then not reference_url.is_empty comment_type_arguments_ok: comment_type /= Void and then not comment_type.is_empty end