Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Div
styledisplay:none

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

Div
iddescription



HTML Table
id
classservoy sReturnTypes
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Return Types
Table Row (tr)
Table Cell (td)
Span
classsWordList
OfflineDataDescription



HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
OfflineDataDescription
Table Cell (td)
createOfflineDataDescription()
Create a descriptive model for offline data.
Table Row (tr)
Table Cell (td)
OfflineDataDescription
Table Cell (td)
createOfflineDataDescription(prefix)
Create a descriptive model for offline data.
Table Row (tr)
Table Cell (td)
JSFoundSet
Table Cell (td)
createRemoteSearchFoundSet(data)
This should be called by inside the offline_data.
Table Row (tr)
Table Cell (td)
Array
Table Cell (td)
getRowDescriptions(datasource, pks)
This method returns the description of rows as a json array object.
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
performSync(data, version, authenticateResult)
If all the changes for a mobile client needs to come as once so that they can be in 1 transaction.



HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Col
colspan2
width100%
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Details
Table Body (tbody)
idcreateOfflineDataDescription
Table Row (tr)
idname
Table Cell (td)

createOfflineDataDescription

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
OfflineDataDescription
Span
stylefont-weight: bold;
createOfflineDataDescription
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Create a descriptive model for offline data.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
OfflineDataDescription
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
//plugins.mobile.getOfflineFoundSetData(foundset,null);
var data = plugins.mobileservice.createOfflineDataDescription('data_');
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idcreateOfflineDataDescription-String
Table Row (tr)
idname
Table Cell (td)

createOfflineDataDescription

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
OfflineDataDescription
Span
stylefont-weight: bold;
createOfflineDataDescription
Span
(prefix)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Create a descriptive model for offline data.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} prefix - specified formname prefix used to retrieve row data from REST wise
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
OfflineDataDescription
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
//plugins.mobile.getOfflineFoundSetData(foundset,null);
var data = plugins.mobileservice.createOfflineDataDescription('data_');
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idcreateRemoteSearchFoundSet-Object
Table Row (tr)
idname
Table Cell (td)

createRemoteSearchFoundSet

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSFoundSet
Span
stylefont-weight: bold;
createRemoteSearchFoundSet
Span
(data)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
This should be called by inside the offline_data.ws_create method of a mobile service solution.
That method is called by the the plugins.mobile.remoteSearch(foundset) that can be done on the mobile client.
This will return a FoundSet that is in findmode with the exact same FindStates that the mobile client had when remoteSearch is called.
On this FoundSet search() should be called and then this foundset should be added to a OfflineDataDescription.addFoundSet(fs) and that
OfflineDataDescription object should be returned.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} data - The data that is given into the offline_data.ws_create method
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSFoundSet - The FoundSet that is in find mode or null if no FoundSet could be created.
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
function ws_create(data,version,method,authenticateResult) {
// Test if it is a remoteSearch call
if (method == "search") {
  // Create the FoundSet from the data that is send over from the mobile client
  var fs = plugins.mobileservice.createRemoteSearchFoundSet(data);
  // This FoundSet is in find mode, more stuff could be added to it if you want to filter even more. Then call search()
 fs.search();
  // Create the OfflineDataDescription that will be returned for this remoteSearch
 var retval = plugins.mobileservice.createOfflineDataDescription('data_');
 retval.addFoundSet(fs);
  return retval;
 }
}
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetRowDescriptions-String_ObjectArray
Table Row (tr)
idname
Table Cell (td)

getRowDescriptions

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Array
Span
stylefont-weight: bold;
getRowDescriptions
Span
(datasource, pks)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
This method returns the description of rows as a json array object.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{String} datasource - the pks belong to
{Object[]} pks - the array of pks
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
Array
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
/** @type {Array<Object>} */
var idsArray = new Array(100,200,300);
var json = plugins.mobileservice.getRowDescriptions('db:/example_data/contacts', idsArray)
Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idperformSync-Object_Number_Object
Table Row (tr)
idname
Table Cell (td)

performSync

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
performSync
Span
(data, version, authenticateResult)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
If all the changes for a mobile client needs to come as once so that they can be in 1 transaction. Then the offline_data form should define a ws_update((data,version,authenticateResult)) method.
This method will then get the complete data package which should be give to this function.
This will redispatch all the inserts,updates or deletes to the various data forms that has the real rest methods to handle the actual insert.
If something fails then an Exception will be thrown and you can do a rollback so that everything of this sync is reverted.
Table Row (tr)
idprs
Table Cell (td)

Parameters

Div
classsIndent
{Object} data - The data package that is given to the offline_data form ws_update method.
{Number} version - The version number that is given to the offline_data form ws_update method.
{Object} authenticateResult - The authenticateResult object that is given to the offline_data form ws_update method. (generated by the offline_data.ws_authenticate)
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
void
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
try {
   databaseManager.startTransaction();
   plugins.mobileservice.performSync(data,version,authenticateResult);
   databaseManager.commitTransaction();
} catch (e) {
   databaseManager.rollbackTransaction();
   // log the error and return false to that the mobile client will know the sync did fail.
   application.output(e,LOGGINGLEVEL.ERROR);
   return false;
}
Table Row (tr)
classlastDetailRow
Table Cell (td)