It is currently 14 May 2025, 10:04 Advanced search

MOB - GetFromDNA does not always include Component Name

Questions and answers on how to best use Instant Developer

MOB - GetFromDNA does not always include Component Name

Postby ljwilson » 15 November 2016, 22:26

Background (using inde 15.0 r5)

I've got a (Java) web and mobile project with the shared Document Classes in a DO Component. I also have My Document Helper class in the DO Component and used by both the Web and Mobile Apps. That all works fine.

In doing Partial Synchronization for iPad and iPhone (using Caravel and Safari simulator, off-line), I was getting a java exception of class not found for these type of calls to resyncClass:

Code: Select all
SyncService.resyncClass(UserSetting.className(false))


Note that I did not get these errors when performing the initial full synchronization.

In debugging I found that GetFromDNA would sometimes return "DODocument$UserSetting", and other times return just "UserSetting". To normalize it I changed the GlobalGetFromDNA in My Document Helper to:

2016-11-15_17-17-30.png
2016-11-15_17-17-30.png (27.15 KiB) Viewed 8575 times


Once I did that then Synchronization works with no errors.

Is this a bug, or is there something I should be doing to not have to override the GetFromDNA method?

Thanks...jack
ljwilson
 
Posts: 784
Joined: 26 November 2013, 14:15

Re: MOB - GetFromDNA does not always include Component Name

Postby g.lanzi » 22 November 2016, 11:51

That's strange, the DNA should contain the component's name if the class' definition is inside a component (and that's pretty obvious).

Can you send me a project which reproduces the issue?
Giuseppe Lanzi
Director of Support services
Pro Gamma S.p.A.
User avatar
g.lanzi
Pro Gamma
Pro Gamma
 
Posts: 3504
Joined: 29 September 2010, 10:24
Location: Bologna

Re: MOB - GetFromDNA does not always include Component Name

Postby ljwilson » 24 November 2016, 3:06

I've attached a sample project which demonstrates this. This is a simple off-line app which can record the time a user spends at a client site.

DO Component Example Express.zip
InDe 15.5 r7 Express
(539.08 KiB) Downloaded 538 times


In preparing it I found the error only occurs when compiling for Java; c# does not have the issue. This example is an Express version (inde 15.5 r7), so if anyone wants to look at it as a Mobile off-line example simply set the two apps and component to compile as c#.

In the zip file is a do_component_mysql.sql file which has sample data. To use:
  1. Unzip the attached DO Component Example Express.zip file.
  2. In mysql create the do_component database.
  3. Run the do_component_mysql.sql file to setup the tables and some sample data.
  4. In the inde ide db connection set the parameters you need to connect to the database.
  5. Compile and run everything (DO Component and both apps). Be sure and set the web app to save its debug information to a file so you can see the synchronization errors generated by the offline app.
  6. In the mobile simulator enter Username: jdoe123, password whatever you want, authentication code 123456, and for the Server url the actual url of the main web app (e.g. http://127.0.0.1:8080/DOComponentWeb/DOComponentWeb.htm) and validate.
  7. If you want to play with other devices/usernames, in the main web app create a new authentication code record, and put whatever username you want. The idea is a user would setup their own user record with the authentication code using the web version, then they can setup their mobile device with that code to validate that device, similar to when you sign up at a website and they send you an email to verify your email address.

When doing a full synchronization from the main menu, you will get this in the log file:

Code: Select all
       2        [INFO]      MainFrm.On Synchronize (jdoe123, , jdoe123, 11/23/2016 18:31, Null)
       2        [INFO]        Domain := Username     [jdoe123]
       2        [INFO]      end
       2        [INFO]      160 - DOComponentDB: Open Connection
      45        [INFO]      My Document Helper.Global Get From DNA (City)
      45        [INFO]      end
      46        [ERR]       (IDDocument.GetFromDNA) Err : java.lang.ClassNotFoundException: City
      46        [INFO]      My Document Helper.Global Get From DNA (OtherClient)
      46        [INFO]      end
      46        [ERR]       (IDDocument.GetFromDNA) Err : java.lang.ClassNotFoundException: OtherClient
      46        [INFO]      My Document Helper.Global Get From DNA (UserSetting)
      46        [INFO]      end
      46        [ERR]       (IDDocument.GetFromDNA) Err : java.lang.ClassNotFoundException: UserSetting
      46        [INFO]      My Document Helper.Global Get From DNA (ClientTime)
      46        [INFO]      end
      47        [ERR]       (IDDocument.GetFromDNA) Err : java.lang.ClassNotFoundException: ClientTime


Now if you uncomment the Global Get From DNA event in the My Document Helper in the DO Component, the error will go away and the synchronization will succeed.

...jack
ljwilson
 
Posts: 784
Joined: 26 November 2013, 14:15

Re: MOB - GetFromDNA does not always include Component Name

Postby g.lanzi » 22 December 2016, 13:56

I've inserted a support ticket to look for a solition.
Best
Giuseppe Lanzi
Director of Support services
Pro Gamma S.p.A.
User avatar
g.lanzi
Pro Gamma
Pro Gamma
 
Posts: 3504
Joined: 29 September 2010, 10:24
Location: Bologna

Re: MOB - GetFromDNA does not always include Component Name

Postby ljwilson » 22 December 2016, 14:30

Great--thanks!

...jack
ljwilson
 
Posts: 784
Joined: 26 November 2013, 14:15


Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 9 guests