Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-5229

FIWARE.Question.Tech.Apps.ApplicationMashup.OrionStarterKit.FullAttributeDataFromOrion

    Details

      Description

      Created question in FIWARE Q/A platform on 04-02-2015 at 19:02
      Please, ANSWER this question AT http://stackoverflow.com/questions/28329239/querying-ocb-from-javascript-wirecloud

      Question:
      Querying OCB from JavaScript (WireCloud)

      Description:
      I'm trying to get type fields for each attribute of my entities. Quering Orion and getting entities is not the problem (I do this through NGSI Source widget) but the way getting these parameters.

      From NGSI Source (usual suscription to Orion instance):

      var doInitialSubscription = function doInitialSubscription() {

      this.subscriptionId = null;

      this.ngsi_server = MashupPlatform.prefs.get('ngsi_server');
      this.ngsi_proxy = MashupPlatform.prefs.get('ngsi_proxy');
      this.connection = new NGSI.Connection(this.ngsi_server,

      { ngsi_proxy_url: this.ngsi_proxy }

      );

      var types = MashupPlatform.prefs.get('ngsi_entities').split(new RegExp(',
      s*'));
      var entityIdList = [];
      var entityId;
      for (var i = 0; i < types.length; i++) {
      entityId =

      { id: '.*', type: types[i], isPattern: true }

      ;
      entityIdList.push(entityId);
      }
      var attributeList = null;
      var duration = 'PT3H';
      var throttling = null;
      var notifyConditions = [

      { 'type': 'ONCHANGE', 'condValues': MashupPlatform.prefs.get('ngsi_update_attributes').split(new RegExp(',\\s*')) }

      ];
      var options = {
      flat: true,
      onNotify: handlerReceiveEntity.bind(this),
      onSuccess: function (data) {
      this.subscriptionId = data.subscriptionId;
      this.refresh_interval = setInterval(refreshNGSISubscription.bind(this), 1000 * 60 * 60 * 2); // each 2 hours
      window.addEventListener("beforeunload", function ()

      { this.connection.cancelSubscription(this.subscriptionId); }

      .bind(this));
      }.bind(this)
      };
      this.connection.createSubscription(entityIdList, attributeList, duration, throttling, notifyConditions, options);
      };
      var handlerReceiveEntity = function handlerReceiveEntity(data) {
      for (var entityId in data.elements)

      { MashupPlatform.wiring.pushEvent("entityOutput", JSON.stringify(data.elements[entityId])); }

      };

      To MyWidget:

      MashupPlatform.wiring.registerCallback("entityInput", function (entityString) {
      var entity;
      entity = JSON.parse(entityString);
      id = entity.id;
      type = entity.type;
      for(var attr in entity)

      { attribute = entity[attr]; }

      I'm trying to code something similar to obtain the value of type fields. How can I do that? (I'm sure it's quite easy...)

        Activity

        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        aarranz Álvaro Arranz made changes -
        Summary FIWARE.Question.Tech.Apps.ApplicationMashup.FullAttributeDataFromOrion FIWARE.Question.Tech.Apps.ApplicationMashup.OrionStarterKit.FullAttributeDataFromOrion
        mev Manuel Escriche made changes -
        HD-Enabler Wirecloud [ 10857 ]
        HD-Chapter Apps [ 10836 ]
        aarranz Álvaro Arranz made changes -
        Summary [fiware-stackoverflow] Querying OCB from JavaScript (WireCloud) FIWARE.Question.Tech.Apps.ApplicationMashup.FullAttributeDataFromOrion
        mev Manuel Escriche made changes -
        Assignee Álvaro Arranz [ aarranz ]
        mev Manuel Escriche made changes -
        Resolution Done [ 10000 ]
        Status Answered [ 10104 ] Closed [ 6 ]
        backlogmanager Backlog Manager made changes -
        Status In Progress [ 3 ] Answered [ 10104 ]
        backlogmanager Backlog Manager made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        backlogmanager Backlog Manager made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        backlogmanager Backlog Manager created issue -

          People

          • Assignee:
            aarranz Álvaro Arranz
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: