Skip to Content
0
Former Member
Nov 06, 2014 at 03:46 PM

Kapsel offline plugin for complex apps

18 Views

Hi,

I have made some simple hybrid apps using offline plugin. I followed the guide at the link: Getting Started with Kapsel - Part 15 -- Offline OData (New in SP05)

AS odata service, I am using service built with Integration Gateway and SQL Server JDBC Driver.

If I would have on offline store more than one entity (for example products, customers, orders, etc....), which syntax I should to use?

For example, for only one entity, Products, the example use:

var properties = {

"name" : "ProductsOfflineStore2",

"host" : smpServerHost,

"port" : smpServerPort,

"https" : false,

"serviceRoot" : getEndPointURL(),

"customHeaders" : {

"X-SMP-APPCID" : appCID

//needed on Android as there is a cookie store for JavaScript which is different from the Java one usd by Offline plugin

},

"definingRequests" : {

"ProductsDR2" : "/Products"

}

};

If I have more entity on my OData Model, how I can download all?

Another question, for read one entity I am using:

var sURL = getEndPointURL() + "/Products?$orderby=Name desc"; //"&milliseconds=" + new Date().getTime();

var oHeaders = {};

oHeaders['Authorization'] = "Basic " + authStr;

oHeaders['X-SMP-APPCID'] = appCID;

var request = {

headers : oHeaders,

requestUri : sURL,

method : "GET"

};

console.log("read using " + sURL);

OData.read(request, readSuccessCallback, errorCallback);

If I would like to read more entity, I have to call ODAta.read method for each entity?

In general, could be helpful to have more complex example or rich documentation about offline Kapsel plugin.

Thanks,

Elia.