Commits

Christian Krebs committed 9d53ebf

added a flag to GetMessageMaps.get_maps to only get the command and event interface of the services without messages

Comments (0)

Files changed (1)

templates/js/get_message_maps.js

 {
 
   /* interface */
-  this.get_maps = function(service_descriptions, onsuccess, onerror){};
+  this.get_maps = function(service_descriptions, onsuccess, onerror, get_messages_flag){};
   
   /* constants */
   const 
     if (!status)
     {
       this._service_infos[service]['raw_infos'] = msg;
-      var tag = tagManager.set_callback(this, this._handle_messages, [service]);
-      services["scope"].requestMessageInfo(tag, [service, [], 1, 1]);
+      if (this._get_messages_flag)
+      {
+        var tag = tagManager.set_callback(this, this._handle_messages, [service]);
+        services["scope"].requestMessageInfo(tag, [service, [], 1, 1]);
+      }
+      else
+        this._handle_messages(status, [], service);
+
     }
     else
       this._onerror({message: "failed to get infos for " + service + " in _handle_infos"});
   {
     var 
     map = this._map[service] = {},
-    command_list = this._service_infos[service].raw_infos[COMMAND_LIST]
-    msgs = this._service_infos[service].raw_messages[MSG_LIST]
+    command_list = this._service_infos[service].raw_infos[COMMAND_LIST],
+    msgs = this._service_infos[service].raw_messages &&
+        this._service_infos[service].raw_messages[MSG_LIST] || [],
     enums = this._service_infos[service].raw_enums && 
         this._service_infos[service].raw_enums[MSG_LIST] || [],
     command = '',
       command = command_list[i];
       command_obj = map[command[NUMBER]] = {};
       command_obj.name = command[MSG_NAME];
-      msg = this._get_msg(msgs, command[MESSAGE_ID]);
-      command_obj[MSG_TYPE_COMMAND] = this._parse_msg(msg, msgs, {}, enums, []);
-      msg = this._get_msg(msgs, command[RESPONSE_ID]);
-      command_obj[MSG_TYPE_RESPONSE] = this._parse_msg(msg, msgs, {}, enums, []);
+      if (this._get_messages_flag)
+      {
+        msg = this._get_msg(msgs, command[MESSAGE_ID]);
+        command_obj[MSG_TYPE_COMMAND] = this._parse_msg(msg, msgs, {}, enums, []);
+        msg = this._get_msg(msgs, command[RESPONSE_ID]);
+        command_obj[MSG_TYPE_RESPONSE] = this._parse_msg(msg, msgs, {}, enums, []);
+      }
     };
     if (event_list)
       for (i = 0; i < event_list.length; i++)
         event = event_list[i];
         event_obj = map[event[NUMBER]] = {};
         event_obj.name = event[MSG_NAME];
-        msg = this._get_msg(msgs, event[MESSAGE_ID]);
-        event_obj[MSG_TYPE_EVENT] = this._parse_msg(msg, msgs, {}, enums, []);
+        if (this._get_messages_flag)
+        {
+          msg = this._get_msg(msgs, event[MESSAGE_ID]);
+          event_obj[MSG_TYPE_EVENT] = this._parse_msg(msg, msgs, {}, enums, []);
+        }
       }
   };
 
 
   /* implementation */
   
-  this.get_maps = function(service_descriptions, onsuccess, onerror)
+  this.get_maps = function(service_descriptions, onsuccess, onerror, get_messages_flag)
   {
     if (!onsuccess || !onerror)
     {
     this._onerror = onerror;
     this._service_infos = {};
     this._map = {};
+    this._get_messages_flag = get_messages_flag === false ? false : true;
     for (var service in service_descriptions)
     {
       if (!/^stp-|^core-/.test(service))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.