indexing description: "Workitem retrieve reply message." author: "Peter Wyss " date: "$Date: 2007-05-12 19:57:51 +0200 (Sat, 12 May 2007) $" revision: "$Revision: 257 $" class O_WORKITEM_RETRIEVE_REPLY_MESSAGE inherit O_MESSAGE rename make as make_message redefine make_from_generic end O_WORKITEM_CONSTANTS undefine out end create make create {O_MESSAGE_FACTORY} make_from_generic feature {NONE} -- Initialization make (a_workitem_type: like workitem_type; a_creation_time: like creation_time; a_project_id: like project_id; a_project: like project; a_user: like user; a_data: like data) is -- Create. require a_workitem_type_ok: a_workitem_type > 0 a_creation_time_ok: a_creation_time > 0 a_project_id_ok: a_project_id > 0 a_project_ok: a_project /= Void and then not a_project.is_empty a_user_ok: a_user /= Void and then not a_user.is_empty a_data_ok: a_data /= Void do make_message workitem_type := a_workitem_type creation_time := a_creation_time project_id := a_project_id project := a_project user := a_user data := a_data ensure workitem_type_set: workitem_type = a_workitem_type creation_time_set: creation_time = a_creation_time project_id_set: project_id = a_project_id project_set: project = a_project user_set: user = a_user data_set: data = a_data end make_from_generic (a_msg: O_GENERIC_MESSAGE) is -- Create from a generic message. local l_args: HASH_TABLE [STRING, STRING] i: INTEGER do Precursor (a_msg) l_args := a_msg.arguments workitem_type := l_args.item (workitem_type_argument).to_integer creation_time := l_args.item (creation_time_argument).to_integer project_id := l_args.item (project_id_argument).to_integer project := l_args.item (project_argument) user := l_args.item (user_argument) from i := 1 create data.make (((l_args.count - 5) / 2).rounded) until i > ((l_args.count - 5) / 2).rounded loop data.force (l_args.item (data_argument + "i" + i.out), l_args.item (data_argument + "k" + i.out)) i := i + 1 end end feature -- Access namespace: STRING is -- Namespace of the message type. once Result := workitem_namespace end type: STRING is -- Type of the message. once Result := workitem_retrieve_reply_type end workitem_type: INTEGER -- Workitem type creation_time: INTEGER -- Creation time project_id: INTEGER -- Project id project: STRING -- project name user: STRING -- user name data: DS_HASH_TABLE [ANY, STRING] -- workitem type specific data arguments: HASH_TABLE [STRING, STRING] is -- Named arguments. local i: INTEGER do create Result.make (5) Result.force (workitem_type.out, workitem_type_argument) Result.force (creation_time.out, creation_time_argument) Result.force (project_id.out, project_id_argument) Result.force (project, project_argument) Result.force (user, user_argument) from data.start i := 1 until data.after loop Result.force (data.key_for_iteration, data_argument + "k" + i.out) Result.force (data.item_for_iteration.out, data_argument + "i" + i.out) data.forth i := i + 1 end end feature {NONE} -- Implementation workitem_type_argument: STRING is "workitem_type" creation_time_argument: STRING is "creation_time" project_id_argument: STRING is "project_id" project_argument: STRING is "project" user_argument: STRING is "user" data_argument: STRING is "data" invariant workitem_type_ok: workitem_type > 0 creation_time_ok: creation_time > 0 project_id_ok: project_id > 0 project_ok: project /= Void and then not project.is_empty user_ok: user /= Void and then not user.is_empty data_ok: data /= Void end