OpenEdge Development: Mobile Applications - Product ...
OpenEdge Development: Mobile Applications - Product ...
OpenEdge Development: Mobile Applications - Product ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
JSDO overview<br />
A <strong>Mobile</strong> resource can also support non-built-in invoke operations which can be<br />
implemented by any ABL routines defined for the resource on the AppServer except<br />
routines that already implement built-in <strong>Mobile</strong> operations. Routines that implement<br />
invoke operations can have any signature defined with supported ABL data types. A<br />
JSDO created for a <strong>Mobile</strong> resource with invoke operations has corresponding<br />
non-built-in invocation methods that map to these invoke operations. Calling an<br />
invocation method on the JSDO calls the implementing ABL routine, passing the<br />
required input parameters and returning its output parameters and any return value to<br />
the <strong>Mobile</strong> App with no direct effect on JSDO local storage. The <strong>Mobile</strong> App can do<br />
whatever it needs to do with the results of an invocation method, including merging<br />
them with JSDO local storage, if appropriate.<br />
For more information on coding the implementing ABL routines of <strong>Mobile</strong> operations on<br />
the AppServer, see Chapter 3, “Creating <strong>Mobile</strong> Services.”)<br />
How JSDO local storage works<br />
JSDO local storage stores temp-table records as JavaScript record objects according<br />
to the schema of the data model supported by the <strong>Mobile</strong> resource of the JSDO. If the<br />
data model is for a single temp-table, local storage can contain only record objects for<br />
the specified temp-table.<br />
If the data model is for a ProDataSet, local storage can contain record objects for the<br />
temp-tables defined for the ProDataSet. By default, record objects for a ProDataSet are<br />
maintained in local storage according to any data-relations defined for the ProDataSet.<br />
This means, for example, that when a JSDO method finds a record object of a parent<br />
temp-table, if a method is then called to search through the record objects of a<br />
temp-table that is a child of that parent, the search will find only record objects that are<br />
related to the record object found in the parent; if new record objects are added to the<br />
same child temp-table, they are added with key fields set implicitly in relation to the<br />
parent record object. The JSDO also supports the run-time option (by setting the<br />
useRelationships property) of toggling between honoring these data-relations and<br />
ignoring them when accessing temp-table data in local storage<br />
Table and field references<br />
You can access the data in local storage using table references. A table reference is a<br />
property on the JSDO that references a given JavaScript temp-table object as defined<br />
by the schema of the data model. So, local storage contains one table reference<br />
property for each temp-table referenced in local storage. The name of each property is<br />
the same as the name of a corresponding temp-table defined in the schema selected<br />
to define the <strong>Mobile</strong> resource in Developer Studio (see Chapter 3, “Creating <strong>Mobile</strong><br />
Services”), and it is specified with the same letter case as the temp-table name in the<br />
selected schema.<br />
JSDO methods that operate on local storage operate either on the entire data store, in<br />
which case they are called on the JSDO itself, or on one table reference at a time, in<br />
which case they are called directly on the corresponding table reference property. For<br />
example, given a JSDO referenced by dsOrderEntry whose local storage references<br />
several temp-tables of a ProDataSet, including ttCustomer, two JSDO methods might<br />
be called as follows:<br />
dsOrderEntry.fill( );<br />
dsOrderEntry.ttCustomer.foreach( function ( record-object ) { ... } );<br />
<strong>OpenEdge</strong> ® <strong>Development</strong>: <strong>Mobile</strong> <strong>Applications</strong> 93