Author Topic: Update object  (Read 2197 times)

Offline escarneiro

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Update object
« on: July 12, 2017, 06:32:08 PM »
Hello guys,


Well, I'm following the examples that came with the Genesys Api V. 8.5. There, the following code is provided as example for updating some object:

[code]      ConfObjectDelta hostDelta = new ConfObjectDelta(metadata, CfgObjectType.CFGHost);

      ConfObject obj = (ConfObject) hostDelta.getOrCreatePropertyValue("deltaHost");
      obj.setPropertyValue("DBID", objDbid);              // - required
      obj.setPropertyValue("name", "new-host-name");      // - to rename the host object (if needed)
      obj.setPropertyValue("IPaddress", "21.21.21.21");  // - to change address (if needed)

      RequestUpdateObject reqUpdate = RequestUpdateObject.create();
      reqUpdate.setObjectDelta(hostDelta);

      Message resp = protocol.request(reqUpdate);

      if (resp instanceof EventObjectUpdated) {
          // The object has been updated
      } else if (resp instanceof EventError) {
          log.error("Error on object update: "
                  + CfgUtilities.getErrorCode(((EventError) resp).getErrorCode())
                  + "\tDescription: " + ((EventError) resp).getDescription());
[/code]

Well, I couldn't ran this code. I couldn't see any link between the objects [code]hostDelta [/code] and [code]obj[/code], so I guess there is some missed part in this example.
If you have any overall idea on how this process works, or how we should code instead, please give me a hint.