Home > API > Services Usage Guide

Introduction

This document contains information about API's which are available in services/batch.All the input parameters for methods in this document are listed in a table in the order the method expects them to be passed in.

IDataTypeDelegate

This is an interface for referencing DataType operations by the object name from the scripting language interfaces.

The attributes of IDataTypeDelegate are,

  1. name - name of the Object.
  2. id - The primary key field which will uniquely identify each Objects.
  3. queryParams – This is the map,which contains the object data in key value pair form.
  4. formParameters - field names which are required for any create and update operation.
The following are the methods which are provided in IDataTypeDelegate

1) IDataTypeDelegate: create

This method is used to create a Specific Object. This method will create a new Object on the HaloMEM server with the data provided as input to the method. Following are the input parameters for this method along with the object name:

Field Type Description
clientObjectName String Name of the Client Object whose related objects are needed.
formParameters HashMap The data of the Object.

Syntax:- object.create('clientObjectName',formParameters)

2)IDataTypeDelegate: search/update/delete

This method is used to obtain a filtered list of data for the given Client Object Type. This method is used to search using the Query By Example paradigm. Using QBE, you specify an object containing the fields that you wish to match as an input to a search query. Wildcards using ‘*’ are support if the datasource allows it. For example: for retrieving all Accounts that match city with substring York - city=’*York’. The method then returns all the objects that match this criteria on the HaloMEM server. The client can specify the order of the data returned from the server (ASCENDING/DESCENDING). The client can use a more sophisticated querying technique using a collection of filter statements based on the mapped fields of the Client Object Type using logical operators like NULL, NOTNULL, NE (Not Equal), GE (Greater than Equal), GT (Greater than), LE (Less than Equal), LT (Less than). It is also possible to perform group operations on the HaloMEM server (if the data source supports - currently only the Database type data source) using the group Fields. If the ignoreCache value isn’t set to true, the SDK will fetch a cached result set if it is found either on the client or the server. Following are the input parameters for this method:

Field Type Description
clientObjectName String Name of the Client Object whose related objects are needed.
queryParams HashMap Contains all the required data in form of key value pair.
ignoreCache Boolean Whether to check with cache or not.
formParameters HashMap(Map) This contains the filter data in the key value pair

The fields which are specified in the below table should be part of queryParams

Field Type Description
startIndex Int Index of Client Object from where we need to get the list from.
size Int The total number of client Objects we want to get from HaloMEM.
orderFields Ascending or descending Whether to order it in ascending or descending way.
orderDirective Boolean Whether to check with cache or not.
fields String array Array of the fields which are required
filterParams String array It’s an associative array containing key value pairs for performing search criteria using QBE
filterStatements Map It's a key value pair which retrieves a filtered result on the columns
groupFields String The parameters on which the list should be grouped.

Syntax:-
object.search("clientObjectName",queryParams,ignoreCache) object.update("clientObjectName",formParameters,queryParams) object.delete("clientObjectName",formParameters)

3)IDataTypeDelegate: get

This method will get the particular Client Object from HaloMEM whose id matches the ObjectID parameter. This is used to retrieve a given Client Object given its id. If the ignoreCache value isn’t set to true, the data will be fetched from cached result set if it is found either on the client or the server. Following are the input parameters to this method:

Field Type Description
clientObjectName String Name of the Client Object whose related objects are needed.
objectID String Id the of the Client Object.
queryParams HashMap Contains all the required data in form of key value pair.
ignoreCache Boolean Whether to check with cache or not.

4)IDataTypeDelegate: getAll

This method will get the complete data from HaloMEM whose name matches the Object name. This is used to retrieve all Objects based on the clinetObjectName. If the ignoreCache value isn’t set to true, the data will be fetched from a cached result set if it is found either on the client or the server. Following are the input parameters to this method:

Field Type Description
clientObjectName String StringName of the Client Object whose related objects are needed.
ignoreCache Boolean Whether to check with cache or not.

5)IDataTypeDelegate: createRelatedObject

This method is used to create a related Client Object. This method creates a new object instance for a given parent object that exists on the HaloMEM server. Following are the input parameters for this method:

Field Type Description
objectName String Name of the Object .
objectID Int The id of the parent Client Object
relationName String This denotes the relationship to create for the above parent object
parameters HashMap The data for the new related object being created.

6)IDataTypeDelegate: getRelatedObjects

This method returns a list a related objects for a given parent Client Object instance. It provides a paginated list from the specified start index and only fetches the specified number of elements given by the size. The page index starts from 0. If the ignoreCache boolean isn’t set to true, the data will be fetched from cached result set if it is found either on the client or the server. Following are the input parameters for this method:

Field Type Description
objectName String Name of the Object .
objectID Int The id of the parent Client Object
related String This denotes the relationship to fetch for the above parent object.
queryParams HashMap Contains all the required data in form of key value pair.
ignoreCache Boolean This is a boolean field that indicates to the SDK if the object(s) sought to be fetched can be retrieved from the local cache

The fields which are specified in the below table should be part of queryParams.

Field Type Description
startIndex Int Index of Client Object from where we need to get the list from.
size Int The total number of client Objects we want to get from HaloMEM.
orderFields Ascending or descending Whether to order it in ascending or descending way.
orderDirective Boolean Whether to check with cache or not.
fields String array Array of the fields which are required
filterParams String array It’s an associative array containing key value pairs for performing search criteria using QBE
filterStatements Map It's a key value pair which retrieves a filtered result on the columns
groupFields String The parameters on which the list should be grouped.

7)IDataTypeDelegate: update

This method simply takes the client Object and performs and update operation on that client Object with the new data in it. It uses the client Object Type and id to update the client object on HaloMEM.Following are the parameters for this method along with the name of the object:

Field Type Description
objectName String Name of the parent Client Object.
objectId String Id the of the parent Client Object
formParameters HashMap The data to be updated.
etag String

7)IDataTypeDelegate: delete

This method simply performs a delete Operation on the Client Object using which this function is called. Calling this method will remove the Client Object from the HaloMEM server.

Field Type Description
objectName String Name of the parent Client Object.
objectId String Id the of the parent Client Object

7)IDataTypeDelegate: getCount

This method will return the total count of the available objects based on the client object name and also the data which is sent as a part of queryParams. If the ignoreCache boolean isn’t set to true, the data will be fetched from cached result set if it is found either on the client or the server

Field Type Description
clientObjectName String Name of the Client Object whose related objects are needed.
queryParams HashMap Contains all the required data in form of key value pair.
ignoreCache Boolean Whether to check with cache or not.

7)IDataTypeDelegate: bulkUploadJson

This method will return the total count of the objects based on the client object name and also the data which is sent as a part of inputStream. Operation param can contain create,delete ,update and read which specifies what operation should be performed on the sent data.

Field Type Description
name String Name of the Client Object whose related objects are updated
inputStream InputStream Contains all the required data in form of json
operation String Contains what operation need to be performed on the sent data.

7)IDataTypeDelegate: bulkUploadCSV

This method will return the total count of the objects based on the client object name and also the data which is sent as a part of inputStream. Operation param can contain create,delete ,update and read which specifies what operation should be performed on the sent data.

Field Type Description
name String Name of the Client Object whose related objects are updated
inputStream InputStream Contains all the required data in form of json
operation String Contains what operation need to be performed on the sent data.

Enums for the bulk operations

  1. create
  2. update
  3. delete
  4. upsert
Executing Service from Service.

For calling service from service we can use the execute method

Field Type Description
blockName String This specifes the name of the service which needs to be called within the existing service
formParameters Map This contains the parameters of the service which is getting called within the existing service.
ignoreCache Boolean This specifies whether to ignore the cache or not.
binaryResponse Boolean This specifies whether the result should be of binaryResponse or not.
Syntax :- service.execute(blockName,formParameters,ignoreCache,binaryResponse);

Executing Function from Service.

For calling function from service we can use the execute method.

Field Type Description
name String This specifes the name of the function which needs to be called within the existing service.
queryParams Map This contains the parameters of the function which is getting called within the existing service.
ignoreCache Boolean This specifies whether to ignore the cache or not.
Syntax :- functions.execute(name,queryParams,ignoreCache);

IDataTypeDelegate: delete by Filter

This method simply performs a delete Operation on the instances of Client Object . Calling this method will remove the Client Object instances based on the filter data which is sent in the filter params ,from the halomem server.This method is preferred over the bulk delete operation .

Field Type Description
name String This specifes the name of the function which needs to be called within the existing service.
filterParams Map This contains the parameters of with the key as column name and value as the value of the column that should be deleted.