indexing description: "Issue search message." author: "Dennis Rietmann" date: "$Date$" revision: "$Revision$" class O_ISSUE_SEARCH_MESSAGE inherit O_SESSION_MESSAGE rename make as make_session redefine make_from_generic, arguments end O_ISSUE_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_search_criteria: like search_criteria) is -- Create. require a_session_ok: a_session /= Void and then not a_session.is_empty a_project_ok: a_project > 0 a_search_criteria_ok: a_search_criteria /= Void do make_session (a_session) project := a_project search_criteria := a_search_criteria ensure project_set: project = a_project search_criteria_set: search_criteria = a_search_criteria end make_from_generic (a_msg: O_GENERIC_MESSAGE) is -- Create from a generic message. local l_args: HASH_TABLE [STRING, STRING] l_criterion_key: STRING do Precursor (a_msg) l_args := a_msg.arguments project := l_args.item (project_argument).to_integer -- restore search criteria from create search_criteria.make_default -- make(l_args.count -3) l_args.start until l_args.after loop l_criterion_key := l_args.key_for_iteration if not l_criterion_key.is_equal (project_argument) and not l_criterion_key.is_equal (session_argument) then -- the project id and session must not be added search_criteria.force (l_args.item_for_iteration, l_criterion_key) end l_args.forth end end feature -- Access namespace: STRING is -- Namespace of the message type. once Result := issue_namespace end type: STRING is -- Type of the message. once Result := issue_search_type end project: INTEGER -- id of the project search_criteria: DS_HASH_TABLE [STRING, STRING] -- the search query (maps issue field names to the desired values) arguments: HASH_TABLE [STRING, STRING] is -- Named arguments. do Result := Precursor -- add the project id Result.force (project.out, project_argument) -- add the search criteria from search_criteria.start until search_criteria.after loop Result.force (search_criteria.item_for_iteration, search_criteria.key_for_iteration) search_criteria.forth end end feature {NONE} -- Implementation project_argument: STRING is "project" -- search_criteria_argument: STRING is "search_criteria" invariant project_ok: project > 0 search_criteria_ok: search_criteria /= Void end