Give us contact

Do you prefer to ask us directly?

Call us +420 605 203 938 (the Czech Republic)

or use this contacts

AyMINE

Related links


FI - Finance Management

Offline persistent objects

Offline objects management by application

Setup object to be offline

Each object that supports offline mode, should have defined:

about.offline

In the about.offline should be condition which objects are stored offline and which isn't. Condition is evaluated by client and can used only object attributes.

Evaluation is called by details that don't have parameter partialOnly : true. (Partial only is the message to the application that object is not completely loaded and values are not sufficient to be stored as an object).

Bulk offline object load

Objects are mostly stored offline by web worker that request object updates on-demand or periodically. The request reloads only objects that are newer at the server then in the local storage. Application requests data and send data what objects are loaded and how old are they. Server returns completed objects to be stored by application.

Bulk offline reload can be called manually by method go offline – User can use it to be sure that everything is updated.

How server supports offline objects

offline objects are always requested from the server method server.<objectName>.updateOffline.

Server object can implement method by itself but the default functionality implemented by the tskPersistent object should be sufficient in most cases.

Default functionality uses the list view offLine data. The view should contain selection that return data that should be available offline and return dataline that is sent to the client application.

Loaded offline data are compared with information from client and dataline for objects that are not newer at the server are not sent. Client also gets information about objects that are at client but not at server (theses that were deleted or has state with which they are not kept persistent at client device.)

Offline operations

Operations mostly requires server and cannot be started without server connection. However, some operation might be useful even for offline mode – e.g. confirmation the task completion.

Define the offline operation

Operations are available in the offline mode, only iff they have defined condition offline and the condition returns true.

  • Functions that does not have offline defined are never available in the offline mode
  • Functions that have offline defined are not available in the online mode except the case they have online:true

Notes:

  • Operations available both in offline and online mode should have both offline and online attribute defined. Warning: operations could rarely function correctly both in online and offline mode.
  • Functionality that supports offline mode is designed to work in offline – changes might be propagated with delay and be rejected later by server

Server-application communication about operations

Offline operation might store information about operation and operation is started later at the server when user is connected. All commands server…. are stored with the object and started during the synchronisation.

Called server method gets attribute fromOffline:true as the attribute. Developer are responsible to make the server response useful.

Method could be only to the updated object that should manage it correctly. Offline methods can never call functionality of other objects than what they are called from.

Example:
tskObject can call server.modObject.stop method in the offline mode but it cannot call method
server.modObjectOther.start although it can be called in the online. If it make sense, Developer of the modObject should make the wrapper at the server and call modObjectOther.start from the wrapper internally.

Note: The limit is made to make the code more save. Error in the offline operation is much higher and cross-object call would make it very difficult to find the source of the error. In this mode, programme is much more likely in the object-context and manages all time-shift dependencies caused by the offline mode properly.

In a nutshell – summary

To set the object offline, developer should:

  • Objects must have attribute dtLastModif (or object with this name should be in the view used for application)
  • set condition for client to the about.offline
  • build up a list view views.lists.updateOffline that returns data for offline