indexing description: "User workitem subscriptions message." author: "Peter Wyss " date: "$Date$" revision: "$Revision$" class O_USER_WORKITEM_SUBSCRIPTIONS_MESSAGE inherit O_MESSAGE rename make as make_message redefine make_from_generic end O_USER_CONSTANTS undefine out end create make create {O_MESSAGE_FACTORY} make_from_generic feature {NONE} -- Initialization make (a_subscriptions: like subscriptions) is -- Create. require a_subscriptions_ok: a_subscriptions /= Void do make_message subscriptions := a_subscriptions ensure subscriptions_set: subscriptions = a_subscriptions 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[workitem_type: INTEGER; subscription_type: INTEGER] l_elements: LIST[STRING] do Precursor (a_msg) l_args := a_msg.arguments from i := 1 create subscriptions.make (l_args.count) until i > l_args.count loop l_elements := l_args.item (subscriptions_argument + i.out).split ('%N') check l_elements_count_correct: l_elements.count = 2 end create l_tuple l_tuple.workitem_type := l_elements.i_th (1).to_integer l_tuple.subscription_type := l_elements.i_th (2).to_integer subscriptions.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_workitem_subscriptions_type end subscriptions: ARRAYED_LIST [TUPLE [workitem_type: INTEGER; subscription_type: INTEGER]] -- List of settings with [workitem_type, subscription_type] arguments: HASH_TABLE [STRING, STRING] is -- Named arguments. local i: INTEGER do create Result.make (subscriptions.count) from subscriptions.start i := 1 until subscriptions.after loop Result.force (subscriptions.item.workitem_type.out + "%N" + subscriptions.item.subscription_type.out,subscriptions_argument + i.out) subscriptions.forth i := i + 1 end end feature {NONE} -- Implementation subscriptions_argument: STRING is "subscriptions" invariant subscriptions_not_void: subscriptions /= Void end