indexing description: "User set information message" author: "Marco Zietzling " date: "$Date$" revision: "$Revision$" class O_USER_SET_INFORMATION_MESSAGE inherit O_SESSION_MESSAGE rename make as make_session redefine make_from_generic, arguments end O_USER_CONSTANTS undefine out end create make create {O_MESSAGE_FACTORY} make_from_generic feature {NONE} -- Initialization make (a_session: like session; a_informations: like informations) is -- Create. require a_session_ok: a_session /= Void and then not a_session.is_empty a_informations_ok: a_informations /= Void do make_session (a_session) informations := a_informations ensure informations_set: informations = a_informations end make_from_generic (a_msg: O_GENERIC_MESSAGE) is -- Create from a generic message. local l_args: HASH_TABLE [STRING, STRING] i: INTEGER l_tuple: TUPLE[information_type: STRING; information_value: STRING] l_elements: LIST[STRING] l_information_value: STRING do Precursor (a_msg) l_args := a_msg.arguments from i := 1 create informations.make (l_args.count - 1) until i > l_args.count - 1 loop l_elements := l_args.item (informations_argument + i.out).split ('%N') check l_elements_count_correct: l_elements.count >= 2 end -- handle special informations with %N included if l_elements.count > 2 then from l_elements.start l_elements.forth l_information_value := l_elements.item.out l_elements.forth until l_elements.after loop l_information_value.append ("%N") l_information_value.append (l_elements.item.out) l_elements.forth end else l_information_value := l_elements.i_th (2).out end create l_tuple l_tuple.information_type := l_elements.i_th (1).out l_tuple.information_value := l_information_value informations.force (l_tuple) i := i + 1 end end feature -- Access namespace: STRING is -- Namespace of the message type. once Result := user_namespace end type: STRING is -- Type of the message. once Result := user_set_information_type end informations: ARRAYED_LIST [TUPLE [information_type: STRING; information_value: STRING]] -- List of informations with [information_type, information_value] arguments: HASH_TABLE [STRING, STRING] is -- Named arguments. local i: INTEGER do Result := Precursor from informations.start i := 1 until informations.after loop Result.force (informations.item.information_type.out + "%N" + informations.item.information_value.out, informations_argument + i.out) informations.forth i := i + 1 end end feature {NONE} -- Implementation informations_argument: STRING is "informations" invariant informations_ok: informations /= Void end