Entry points specific to Web Service plugins

Web Service plugins have a wide reach. Their aim is to encapsulate everything about your web service: loading data, updating items, creating new items, as well as login.

However your plugin doesn't have to implement everything. It's perfectly reasonable to make a web service plugin that only implements loading items into a data sheet, or perhaps only sending data to a service (e.g. if the plugin is only used to save the data collected from a form).

publishedInteractActions

See discussion of equivalent for Element plugins.

appDataKeysInExportedProject

Called to create any additional data keys to the exported project. Must return an object containing key names and other attributes as values.

Example:

this.appDataKeysInExportedProject = {
  "serviceUrl": {
    'type': 'string'
  }
};

pluginAllowsMultipleInstances

See discussion of equivalent for Service plugins.

sheetEditorServicePathValues

Called for showing predefined "service path" setting values in Data Sheet Editor (will show the setting as a popup button instead of a text field).

Example:

this.sheetEditorServicePathValues = [
  "/example"
];

readDataSheetFromServiceAsync(httpClient, sheetOptions, readDataCallback)

Called to fill out a data sheet using the plugin. HttpClient is described in Utility classes / HttpClient.

'sheetOptions' parameter contains the following fields:

  • path: URL path specified for a data sheet using the plugin
  • preferredImageWidth: image size recommended by the host application
  • dataSheetName: name of a data sheet using the plugin

See the GenericJSONSource plugin's source code for usage example.

dataSheetUpdateInterval_iOS

Specifies the interval how frequently the data will be updated.

Example:

this.dataSheetUpdateInterval_iOS = 60.0;

getIOSInfoPlistProperties

See discussion of equivalent for Service plugins.

getIOSEntitlementsProperties

See discussion of equivalent for Service plugins.

getIOSImports(exporter, sheetOptions)

Used to specify additional header files used by the plugin. Must be an array.

'sheetOptions' parameter is contextual and might not exist in all occasions the getIOSImports method is called thus it should be null checked before using it as seen in the example below. 'sheetOptions' parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.getIOSImports = function(exporter, sheetOptions) {
  if (sheetOptions != null) {
    // sheetOptions can be now used safely
  }
  return [
    "<CommonCrypto/CommonDigest.h>"
  ];
}

writeIOSClasses(exporter)

See discussion of equivalent for Service plugins.

writeIOSCodeForPublishedInteractAction(actionId, exporter, varName, arg)

See discussion for Element plugins.

writeIOSCodeForDataSheetLoad(methodDecl, exporter, sheetVar, loadCompleteCode)

Called to write an implementation for updating data sheet content from a web service.

See the GenericJSONSource plugin's source code for usage example.

writeIOSDataSheetClassProperties(exporter, sheetOptions)

Called to write any additional properties to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeIOSDataSheetClassProperties = function(exporter, sheetOptions) {
  return ""
    +"@property (nonatomic) NSString *someProperty;\n";
}

writeIOSCodeForDataSheetInit(exporter, sheetOptions)

Called to write any additional initialization code to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeIOSCodeForDataSheetInit = function(exporter, sheetOptions) {
  return ""
    +"_someProperty = @\"\";\n";
}

writeIOSCodeForDataSheetFinish(exporter, sheetOptions)

Called to write any additional finishing code to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeIOSCodeForDataSheetFinish = function(exporter, sheetOptions) {
  return ""
    +"// do something\n";
}

writeIOSCodeForDataSheetSave(exporter, servicePath, sheetOptions)

Called to write an implementation for sending data sheet content to a web service. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example (note - you could just as well use the backtick ES6 template string style rather than + to build the returned string):

this.writeIOSCodeForDataSheetSave = function(exporter, servicePath, sheetOptions) {
  return ""
    + "- (void)saveRowWithValues:(NSDictionary *)values\n"
    + "{\n"
    + "    [super saveRowWithValues:values];\n"
    + "    \n"
    + "    // code for sending values to web service\n"
    + "}\n"
    + "\n"
    + "- (void)updateRow:(NSInteger)row withValues:(NSDictionary *)values\n"
    + "{\n"
    + "    [super updateRow:row withValues:values];\n"
    + "    \n"
    + "    // code for updating values in web service\n"
    + "}\n"
    + "\n"
    + "- (void)replaceRow:(NSInteger)row with:(NSDictionary *)rowDesc\n"
    + "{\n"
    + "    [super replaceRow:row with:rowDesc];\n"
    + "    \n"
    + "    // code for updating values in web service\n"
    + "}\n"
    + "\n"
    + "- (void)deleteRow:(NSInteger)row\n"
    + "{\n"
    + "    [super deleteRow:row];\n"
    + "    \n"
    + "    // code for updating values in web service\n"
    + "}\n";
}

writeIOSCodeForPresentLogin(actionMethod, exporter, completionCode)

Called to write a custom logic for showing a login screen for a web service.

Example:

this.writeIOSCodeForPresentLogin(actionMethod, exporter, completionCode) {
  return ""
    + "- (void)"+actionMethod+"\n"
    + "    "+completionCode+"\n"
    + "}\n";
}

writeIOSPrivatePropertiesForLogin

Called to write private properties used by login implementation written in a writeIOSCodeForLogin function.

Example:

this.writeIOSPrivatePropertiesForLogin = function() {
  var props = "\n";
  props += "@property (nonatomic) NSInteger someProperty;\n";
  return props;
}

writeIOSCodeForLogin(actionMethod, exporter, sendSuccessCode, sendFailedCode, disableUICode, enableUICode, collectDataCode, servicePath)

Called to write a custom implementation for logging in to a web service.

Example:

this.writeIOSCodeForLogin = function(actionMethodName, exporter,
                                     postSendSuccessCode, postSendFailedCode,
                                     disableUICode, enableUICode,
                                     collectDataCode,
                                     servicePath) {
  return ""
    + "- (void)"+actionMethodName+"\n
    + "{\n"
    + "}\n"
}

writeIOSPrivatePropertiesForSend

Called to write private properties used by data sending implementation written in a writeIOSCodeForSend function.

Example:

this.writeIOSPrivatePropertiesForSend = function() {
  var props = "\n";
  props += "@property (nonatomic) NSInteger someProperty;\n";
  return props;
}

writeIOSCodeForSend(actionMethod, exporter, sendSuccessCode, sendFailedCode, disableUICode, enableUICode, collectDataCode, servicePath)

Called to write a custom implementation for sending data to a web service.

Example:

this.writeIOSCodeForSend = function(actionMethodName, exporter,
                                    postSendSuccessCode, postSendFailedCode,
                                    disableUICode, enableUICode,
                                    collectDataCode,
                                    servicePath) {
  return ""
    + "- (void)"+actionMethodName+"\n
    + "{\n"
    + "}\n";
}

writeIOSCodeForStoredLoginCheck(exporter, applyValuesToUIFuncName)

Called to write an implementation for pre-filling login screen input fields.

Example:

this.writeIOSCodeForStoredLoginCheck = function(exporter, applyValuesToUIFuncName) {
  return ""
    + "NSDictionary *values = @{};\n"
    + applyValuesToUIFuncName+"(values);\n";
}

writeIOSCodeForLogout(actionMethod, exporter, returnToLoginCode)

Called to write an implementation for logging out from a web service.

Example:

this.writeIOSCodeForLogout = function(actionMethodName, exporter, returnToLoginCode) {
  return ""
    + "- (void)"+actionMethodName+"\n
    + "{\n"
    + "    "+returnToLoginCode+"\n"
    + "}\n";
}

getIOSAppDelegateImports

See discussion of equivalent for Service plugins.

getIOSAppDelegateProtocols

See discussion of equivalent for Service plugins.

getIOSCustomAppDelegateMethodDeclarations(exporter)

See discussion of equivalent for Service plugins.

writeIOSCodeForAppDelegateMethod(methodName, exporter)

See discussion of equivalent for Service plugins.

writeIOSCustomAppDelegateInterfaceCode(exporter)

See discussion of equivalent for Service plugins.

writeIOSCustomAppDelegateImplementationCode(exporter)

See discussion of equivalent for Service plugins.

libraryDependenciesInExportedProject_iOS

See discussion of equivalent for Element plugins.

getIOSEmbeddedBinaries

See discussion of equivalent for Element plugins.

getIOSModuleImports(exporter)

See discussion of equivalent for Element plugins.

dataSheetUpdateInterval_Android

Specifies the interval how frequently the data will be updated.

Example:

this.dataSheetUpdateInterval_Android = 60.0;

getAndroidImports

Used to specify additional libraries used by the plugin. Must be an array.

Example:

this.getAndroidImports = function() {
  return [
    "java.net.URL"
  ];
}

writeAndroidCodeForResumeAndPause(exporter, methodPrefix)

Called to write any additional code when the app resumes and pauses. Must return an object which can contain the following entries: onResume, onPause, vars.

Example:

this.writeAndroidCodeForResumeAndPause = function(exporter, methodPrefix) {
  return {
    onResume: "m_resumeT = new Date().getTime();\n",
    onPause: "m_resumeT = -1;\n",
    vars: "private long m_resumeT = null;\n"
  };
}

writeAndroidCodeForDataSheetLoad(methodDecl, exporter, sheetVar, loadCompleteCode)

Called to write an implementation for updating data sheet content from a web service.

See the GenericJSONSource plugin's source code for usage example.

writeAndroidDataSheetClassVariables(exporter, sheetOptions)

Called to write any additional variables to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeAndroidDataSheetClassVariables = function(exporter, sheetOptions) {
  return ""
    +"private String m_someVar;\n";
}

writeAndroidCodeForDataSheetInit(exporter, sheetOptions)

Called to write any additional initialization code to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeAndroidCodeForDataSheetInit = function(exporter, sheetOptions) {
  return ""
    +"m_someVar = \"\";\n";
}

writeAndroidCodeForDataSheetFinish(exporter, sheetOptions)

Called to write any additional finishing code to the data sheet class using the plugin. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeAndroidCodeForDataSheetFinish = function(exporter, sheetOptions) {
  return ""
    +"// do something\n";
}

writeAndroidCodeForDataSheetSave(exporter, servicePath, sheetOptions)

Called to write an implementation for sending data sheet content to a web service. sheetOptions-parameter was described in the documentation of the readDataSheetFromServiceAsync method.

Example:

this.writeAndroidCodeForDataSheetSave = function(exporter, servicePath, sheetOptions) {
  return ""
    + "@Override\n"
    + "public void saveRowWithValues(HashMap<String, Object> values) {\n"
    + "    super.saveRowWithValues(values);\n"
    + "    \n"
    + "    // code for sending values to web service\n"
    + "}\n"
    + "\n"
    + "@Override\n"
    + "public void updateRow(int rowIndex, HashMap<String, Object> values) {\n"
    + "    super.updateRow(rowIndex, values);\n"
    + "    \n"
    + "    // code for updating values in web service\n"
    + "}\n"
    + "\n"    
    + "@Override\n"
    + "public void deleteRow(int rowIndex) {\n"
    + "    super.deleteRow(rowIndex);\n"
    + "    \n"
    + "    // code for updating values in web service\n"
    + "}\n";
}

writeAndroidCodeForLogin(actionMethod, exporter, sendSuccessCode, sendFailedCode, disableUICode, enableUICode, collectDataCode, servicePath)

Called to write a custom implementation for logging in to a web service.

Example:

this.writeAndroidCodeForLogin = function(actionMethodName, exporter,
                                         postSendSuccessCode, postSendFailedCode,
                                         disableUICode, enableUICode,
                                         collectDataCode,
                                         servicePath) {
  return ""
    + "    public void "+actionMethodName+"(View v) {\n"
    + "}\n";
}

writeAndroidCodeForSend(actionMethod, exporter, sendSuccessCode, sendFailedCode, disableUICode, enableUICode, collectDataCode, servicePath)

Called to write a custom implementation for sending data to a web service.

Example:

this.writeAndroidCodeForSend = function(actionMethodName, exporter,
                                        postSendSuccessCode, postSendFailedCode,
                                        disableUICode, enableUICode,
                                        collectDataCode,
                                        servicePath) {
  return ""
    + "    public void "+actionMethodName+"(View v) {\n"
    + "}\n";
}

writeAndroidCodeForStoredLoginCheck(methodName, exporter, storedLoginValidCode, storedLoginMissingCode, disableUICode, enableUICode, collectDataCode, appDataVar)

Called to write an implementation for checking saved login information for a web service.

Example:

this.writeAndroidCodeForStoredLoginCheck = function(methodName, exporter,
                                                    storedLoginValidCode, storedLoginMissingCode,
                                                    disableUICode, enableUICode,
                                                    collectDataCode,
                                                    appDataVar) {
  // don't check for stored login in this implementation;
  // just proceed to the login screen always.
  var code = "";
  code += "public void "+methodName+" {\n";
  code += "    "+storedLoginMissingCode;
  code += "}\n";
  return code;
}

writeAndroidCodeForLogout(methodName, exporter, logoutSuccessCode, logoutFailedCode, disableUICode, enableUICode, collectDataCode, appDataVar)

Called to write an implementation for logging out from a web service.

Example:

this.writeAndroidCodeForLogout = function(methodName, exporter,
                                          logoutSuccessCode, logoutFailedCode,
                                          disableUICode, enableUICode,
                                          collectDataCode,
                                          appDataVar) {    
  return logoutSuccessCode;
}

getAndroidApplicationImports(exporter)

See discussion of equivalent for Service plugins.

getAndroidApplicationInterfaces

See discussion of equivalent for Service plugins.

writeAndroidClasses(exporter)

See discussion of equivalent for Service plugins.

writeAndroidCodeForApplicationMethod(methodName, exporter)

See discussion of equivalent for Service plugins.

writeAndroidCodeForPublishedInteractAction(actionId, exporter, varName, arg)

See discussion of equivalent for Element plugins.

writeAndroidCustomApplicationVariables(exporter)

See discussion of equivalent for Service plugins.

writeAndroidCustomApplicationMethods(exporter)

See discussion of equivalent for Service plugins.

libraryDependenciesInExportedProject_Android

See discussion of equivalent for Element plugins.

dataSheetUpdateInterval_ReactWeb

Specifies the interval how frequently the data will be updated.

Example:

this.dataSheetUpdateInterval_ReactWeb = 60.0;

getReactWebImports()

See discussion of equivalent for Element plugins.

getReactWebPackages(exporter)

See discussion of equivalent for Element plugins.

getReactWebHtmlHeadElements(exporter)

Writes additional HTML head elements to index.html.

Example:

this.getReactWebHtmlHeadElements = function(exporter) {
  return [
    "<link rel=\"stylesheet\" href=\"https://example.com/style.css\">"
  ];
}

writeReactWebCodeForServiceInit(exporter)

Writes initialization code that gets called only once for each plugin.

Example:

this.writeReactWebCodeForServiceInit = function(exporter) {
  return "// initialization code here\n";
}

writeReactWebCodeForDataSheetInit(exporter, sheetId)

Write initialization code that gets called for each data sheet that uses the plugin.

Example:

this.writeReactWebCodeForDataSheetInit = function(exporter, sheetId) {
  return "// initialization code here\n";
}

writeReactWebCodeForDataSheetLoad(exporter, loadCompleteCode, [dataSheetOptions])

Writes code to handle result of data loading.

The returned code will be the body for a function with arguments: (dataSheet, servicePath)

'loadCompleteCode' is a function definition of style: (err) => { ... }. It must be called when the load has completed.

Example:

this.writeReactWebCodeForDataSheetLoad = function(exporter, loadCompleteCode){
  return ""
  +"const loadCompleteFunc = "+loadCompleteCode+"\n"
  +"loadCompleteFunc(null);\n";
}

writeReactWebCodeForDataSheetWriteOverrides(exporter, writeCompleteCode, [dataSheetOptions])

TODO

writeReactWebCodeForLogin(methodName, exporter, servicePath, instanceId)

TODO

writeReactWebCodeForSend(methodName, exporter, servicePath, instanceId)

TODO

writeReactWebCodeForStoredLoginCheck(exporter, instanceId)

TODO

writeReactWebCodeForLogout(methodName, exporter, servicePath, instanceId)

TODO

getLinkedScreenNamesForUIContextInstance(instanceId)

TODO

writeReactWebCSSForEmbeddedContent(exporter)

TODO