SOTR 2012

298 views
231 views

Published on

These are the slides of my SOTR 2012 talk in Brussels about using the ColdFusion ORM feature in mobile applications

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
298
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • SOTR 2012

    1. 1. Database-driven mobile AIR applications The power of ORM
    2. 2. Who Are we?Cyril HanquezMobile and web developer at• Adobe Community Professional• ColdFusion User Group Manager• 13+ years of development experience• Co-author of “HTML5 Solutions: Essential Techniques for HTML5 Developers” Email: cyril@cyrilhanquez.com LinkedIn: www.linkedin.com/in/cyrilh Twitter: @fitzchev Blog: www.cyrilhanquez/blog
    3. 3. Who Are we?Steven PeetersAdobe Certified Instructor / consultant at Silver Lining• Adobe Flex, AIR, Flash Catalyst & ColdFusion Certified Instructor• Adobe Community Professional• ColdFusion User Group Manager• 14+ years of development experience• Flex & AIR since 2004• Author for Friends of ED Email: steven@silver-lining.be LinkedIn: www.linkedin.com/in/stevenpeeters Twitter: @aikisteve Blog: www.flexpert.be Website: www.silver-lining.be
    4. 4. Topics• Database in AIR• Using ColdFusion’s ORM• Synchronising with a remote server• Applying to mobile applications
    5. 5. Database in AIR
    6. 6. Database in AIR• Lightweight database
    7. 7. Database in AIR• Lightweight database• Limited type support
    8. 8. Database in AIR• Lightweight database• Limited type support• Easy to use
    9. 9. Database in AIR• Lightweight database• Limited type support• Easy to use• Available offline
    10. 10. Database in AIR• Lightweight database• Limited type support• Easy to use• Available offline• Synchronous AND asynchronous access
    11. 11. Database encryption
    12. 12. Database encryption• 256-bit AES encryption
    13. 13. Database encryption• 256-bit AES encryption• Use EncryptionKeyGenerator to validate strength of encryption key • as3corelib on code.google.com
    14. 14. Database encryption• 256-bit AES encryption• Use EncryptionKeyGenerator to validate strength of encryption key • as3corelib on code.google.com• Re-ecryption is possible
    15. 15. Using ColdFusion’s ORM
    16. 16. Using ColdFusion’s ORM• Server-side technology on client-side? • cfair.swc • <server root>/CFIDE/Scripts/AIR
    17. 17. Using ColdFusion’s ORM• Server-side technology on client-side? • cfair.swc • <server root>/CFIDE/Scripts/AIR• Works with local database
    18. 18. Using ColdFusion’s ORM• Server-side technology on client-side? • cfair.swc • <server root>/CFIDE/Scripts/AIR• Works with local database• Use SyncManager class
    19. 19. Using ColdFusion’s ORM• Server-side technology on client-side? • cfair.swc • <server root>/CFIDE/Scripts/AIR• Works with local database• Use SyncManager class• Need to adjust DTOs with metadata
    20. 20. Using ColdFusion’s ORM• Server-side technology on client-side? • cfair.swc • <server root>/CFIDE/Scripts/AIR• Works with local database• Use SyncManager class• Need to adjust DTOs with metadata• No BLOB possible :-(
    21. 21. Entity Metadata
    22. 22. Entity Metadata• [Entity]
    23. 23. Entity Metadata• [Entity]• [Table(name=”<name>”)]
    24. 24. Entity Metadata• [Entity]• [Table(name=”<name>”)]• [RemoteClass(alias=”<cfc>”)]
    25. 25. Entity Metadata• [Entity]• [Table(name=”<name>”)]• [RemoteClass(alias=”<cfc>”)]• [Bindable]
    26. 26. Field Metadata
    27. 27. Field Metadata• [Id]
    28. 28. Field Metadata• [Id]• [GeneratedValue(strategy=”INCREMENT”, initialValue=”1”, incrementBy=”1”)]
    29. 29. Field Metadata• [Id]• [GeneratedValue(strategy=”INCREMENT”, initialValue=”1”, incrementBy=”1”)]• [Transient]
    30. 30. Field Metadata• [Id]• [GeneratedValue(strategy=”INCREMENT”, initialValue=”1”, incrementBy=”1”)]• [Transient]• [Column(name=”<name>”, columnDefinition=”TEXT|INTEGER|REAL|DATE”, nullable=”true|false”, unique=”true|false”]
    31. 31. Relationship Metadata
    32. 32. Relationship Metadata
    33. 33. Relationship Metadata• [OneToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]
    34. 34. Relationship Metadata• [OneToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [OneToMany(targetEntity=”<entity>”, mappedBy=”<entity>”, fetchType=”EAGER(default)|LAZY”)]
    35. 35. Relationship Metadata• [OneToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [OneToMany(targetEntity=”<entity>”, mappedBy=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [ManyToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]
    36. 36. Relationship Metadata• [OneToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [OneToMany(targetEntity=”<entity>”, mappedBy=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [ManyToOne(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]• [ManyToMany(targetEntity=”<entity>”, fetchType=”EAGER(default)|LAZY”)]
    37. 37. Relationship Metadata
    38. 38. Relationship Metadata• [JoinTable(name=”<name>”)]
    39. 39. Relationship Metadata• [JoinTable(name=”<name>”)]• [JoinColumn(name=”<name>”, referencedColumnName=”<name>”)]
    40. 40. Relationship Metadata• [JoinTable(name=”<name>”)]• [JoinColumn(name=”<name>”, referencedColumnName=”<name>”)]• [InverseJoinColumn(name=”<name>”, referencedColumnName=”<name>”)]
    41. 41. Synchronising with remote server
    42. 42. Synchronising with remote server• Always asynchronous
    43. 43. Synchronising with remote server• Always asynchronous• Using SyncManager class • port • server • syncCFC • session
    44. 44. Synchronising with remote server
    45. 45. Synchronising with remote server• Fetching remote data • syncManager.fetch(“foo”)
    46. 46. Synchronising with remote server• Fetching remote data • syncManager.fetch(“foo”)• Save remote data in local SQLite database • session.saveUpdateCache(<ArrayCollection>)
    47. 47. Synchronising with remote server
    48. 48. Synchronising with remote server• Reading data from local database
    49. 49. Synchronising with remote server• Reading data from local database • session.load(<valueObject>, <filterObject>)
    50. 50. Synchronising with remote server• Reading data from local database • session.load(<valueObject>, <filterObject>) • session.loadAll(<valueObject>)
    51. 51. Synchronising with remote server• Reading data from local database • session.load(<valueObject>, <filterObject>) • session.loadAll(<valueObject>) • session.loadbyPK(<valueObject>, <PK filter>)
    52. 52. Synchronising with remote server• Reading data from local database • session.load(<valueObject>, <filterObject>) • session.loadAll(<valueObject>) • session.loadbyPK(<valueObject>, <PK filter>) • session.loadByQuery(<valueObject>, <SQL where condition>)
    53. 53. Synchronising with remote server
    54. 54. Synchronising with remote server• Saving data to the local database
    55. 55. Synchronising with remote server• Saving data to the local database • session.saveUpdate(<valueObject>)
    56. 56. Synchronising with remote server• Saving data to the local database • session.saveUpdate(<valueObject>) • session.delete(<valueObject>)
    57. 57. Synchronising with remote server
    58. 58. Synchronising with remote server• Pushing data to the remote database
    59. 59. Synchronising with remote server• Pushing data to the remote database • syncManager.autocommit = true
    60. 60. Synchronising with remote server• Pushing data to the remote database • syncManager.autocommit = true • session.commit()
    61. 61. What can you do with it?• Online/offline synchronisation• Use DB as (temporary) storage• Protect private data (encryption)• Colaborate with other people• ...
    62. 62. ORM on mobile devices
    63. 63. ORM on mobile devices
    64. 64. ORM on mobile devices• What’s available?
    65. 65. ORM on mobile devices• What’s available? • SQLite database
    66. 66. ORM on mobile devices• What’s available? • SQLite database • Disk access
    67. 67. ORM on mobile devices• What’s available? • SQLite database • Disk access • Data contract?
    68. 68. ORM on mobile devices• What’s available? • SQLite database • Disk access • Data contract? • WiFi?
    69. 69. ORM on mobile devices
    70. 70. ORM on mobile devices• What’s different?
    71. 71. ORM on mobile devices• What’s different? • AIR 2.5 minimum
    72. 72. ORM on mobile devices• What’s different? • AIR 2.5 minimum • Specify access rights in app.xml
    73. 73. ORM on mobile devices• What’s different? • AIR 2.5 minimum • Specify access rights in app.xml • not much really...
    74. 74. “It’s like stealing candyfrom a baby!”
    75. 75. Twitter: Blog site: @aikisteve www.flexpert.be Email: Company website:steven@silver-lining.be www.silver-lining.be

    ×