This page last changed on Nov 08, 2013 by digitaldan.

This is in regards to my HAI onmilink integration. In my version of the designer, users enter their systems ip, port and keys in a import window form and the server will pull down all of the devices on the remote system. This part works great. Once the devices are all loaded in the system, my forms onSuccess callback gets called (in gwt land).

The behavior I want is for the designer to reload the devices from the database and then hide the import window. Right now neither of these things are happening. I have a rather anemic callback implementation below, I don't really understand what the correct impl should be.

  public void onSuccess(CreateOmnilinkDeviceResult result) {
            	wrapper.fireEvent(new DeviceUpdatedEvent(null));
              hide();
            }            
          });

Can someone point me in the right direction?

Thanks!

Is your code already committed in SVN ? It would help if I can take a look at the whole thing, to understand the flow and better help you.

In a nutshell, you should not pass null to the DeviceUpdatedEvent. The event should reference the device that has been updated, otherwise nothing will update.
It might very well be that passing null there results in a null pointer exception in some listener on the event bus and that's why the hide() code is not executed.

Posted by ebariaux at Nov 12, 2013 13:00

https://svn.code.sf.net/p/openremote/code/workspace/digitaldan/Designer_2_14_0_SNAPSHOT-2013-05-11-HAI

I figured that was not the correct behavior. I have tried a few things, but its an area of the code base that I am the least familiar with. My desired result would be when that callback gets called i can do something that completely refreshes devices from the server.

Thanks.

Posted by digitaldan at Nov 24, 2013 16:29

So I have changed my code to return back a valid array of DeviceDTO. My callback looks like this:

 @Override
            public void onSuccess(CreateOmnilinkDeviceResult result) {
              wrapper.fireEvent(SubmitEvent.SUBMIT, new SubmitEvent(result.getDevices()));
            }            

I have logged that the result contains non null device dtos that are created on the backend, but the window, which extends CommonForm, never hides and the devices are never refreshed. As a workaround I am just reloading the browser after an import to get the gui back in a proper state. I used the RussoundWizardForm as a template since it was fairly simple, so I'm at a loss of what to do. Once I create the devices and return back those DTO's, what should I be doing in my callback to close the window (hide() is not working) and refresh the device list.

Thanks.

Posted by digitaldan at Dec 29, 2013 17:18

Sorry, I have it on my todo list to take a look at your branch but did not get to it yet.
I'll do that in the coming days and will post back here.

Posted by ebariaux at Jan 02, 2014 10:33

Did you have a chance to look at this yet?

I have one more issue as well. In my action handler I have an instance of the device service, I would like to load all devices for a user with the call deviceService.loadAll(account). I was getting a hibernate error the something was not initialized (I don't have the exact error anymore, I can reproduce it if you need me to). So for now I'm using deviceService.loadAll() and iterating all devices that match the user's OID. On a large public system i could see this being a issue. Does this type of error sound familiar?

Thanks!

Posted by digitaldan at Jan 22, 2014 03:34

Apologies but no. This is not just a 5 minute thing and I've just too many things to work on. I'll see what I can do.

I've seen Hibernate errors on deviceAttrs IIRC, but never tracked them down.

Posted by ebariaux at Jan 22, 2014 09:58
Document generated by Confluence on Jun 05, 2016 09:30