RMP_IncludedCollection

Included collections are non visible component used to get/save/remove/update objects from a collection

new RMP_IncludedCollection()

See:

Methods

aggregateCallback(pipelines, options, callbackSuccess, callbackFailure)

Aggregate a collection.
Parameters:
Name Type Description
pipelines object an array of pipelines.
options object options to be used during the call
Properties
Name Type Argument Description
mode string <optional>
execution mode of the collection (TEST or LIVE), defaults to the current execution mode of the application
nb number <optional>
number of objects to be returned (maximum is 100), used to paginate results
first number <optional>
index of the first object to be returned, used to paginate results
orderby array <optional>
array of fields to be used to order the results, e.g [name, lastname], a $sort pipeline will be appended to given pipelines
order array <optional>
array of orders to be used to order the results, there must be one order for each orderby, e.g [asc,desc]
detailed boolean <optional>
true to get a detailed result (includes count limit and skip values)
asynchronous boolean <optional>
false to make a synchronous call, true otherwise (default is true)
callbackSuccess RMP_IncludedCollection~callbackSuccess a callback function called in case of a success
callbackFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

aggregateExt(pipelines, options)

Aggregate a collection.
Parameters:
Name Type Description
pipelines object an array of pipelines.
options object option to be used during the call
Properties
Name Type Argument Description
mode string <optional>
execution mode of the collection (TEST or LIVE), defaults to the current execution mode of the application
nb number <optional>
number of objects to be returned (maximum is 100), used to paginate results
first number <optional>
index of the first object to be returned, used to paginate results
orderby array <optional>
array of fields to be used to order the results, e.g [name, lastname], a $sort pipeline will be appended to given pipelines
order array <optional>
array of orders to be used to order the results, there must be one order for each orderby, e.g [asc,desc]
detailed boolean <optional>
true to get a detailed result (includes count limit and skip values)
asynchronous boolean <optional>
false to make a synchronous call, true otherwise (default is true)
onSuccess RMP_IncludedCollection~callbackSuccess a callback function called in case of a success
onFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

getName() → {String}

This function returns the id as string of the widget
Returns:
Type
String

getType() → {String}

This function returns the type of the widget(RMP_Image, RMP_Html, RMP_Scripter, RMP_StaticTextwidget, RMP_Button, RMP_TextInput, RMP_ListBox, RMP_MultiSelectionCheckBox, RMP_RadioButton, RMP_Array, RMP_FileUpload... )
Returns:
Type
String

list(pattern, options, callbackSuccess, messageFailure)

List objects matching a given pattern
Parameters:
Name Type Description
pattern object pattern to be matched in the collection
options object option to be used during the call. Same fields as #listExt options, except for the callbacks.
callbackSuccess RMP_IncludedCollection~callbackSuccess a callback function called in case of a success
messageFailure String message displayed in case of a failure
See:

listCallback(pattern, options, callbackSuccess, callbackFailure)

List objects matching a given pattern
Parameters:
Name Type Description
pattern object pattern to be matched in the collection
options object option to be used during the call. Same fields as #listExt options, except for the callbacks.
callbackSuccess RMP_IncludedCollection~callbackSuccess a callback function called in case of a success
callbackFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

listExt(pattern, options)

List objects matching a given pattern.
Parameters:
Name Type Description
pattern object pattern to be matched in the collection
options object options to be used during the call
Properties
Name Type Description
fields object array of fields to be retrieved for each found object, e.g [name, lastname]
mode string execution mode of the collection (TEST or LIVE), defaults to the current execution mode of the application
nb number number of objects to be returned (maximum is 100), used to paginate results
first number index of the first object to be returned, used to paginate results
orderby array array of fields to be used to order the results, e.g [name, lastname]
order array array of orders to be used to order the results, there must be one order for each orderby, e.g [asc,desc]
detailed boolean true to get a detailed result (includes count limit and skip values)
asynchronous boolean false to make a synchronous call, true otherwise (default is true)
onSuccess RMP_IncludedCollection~callbackSuccess a callback function called in case of a success
onFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

load(pattern, options, callbackSuccess, messageFailure)

Load the first object of the collection, matching the given pattern
Parameters:
Name Type Description
pattern object object to be retrieved in the collection.
options object options to be used during the call. Same fields as #listExt options, except for the callbacks.
callbackSuccess RMP_IncludedCollection~loadCallbackSuccess callback to be used in case of a success
messageFailure String message displayed in case of a failure
See:

loadCallback(pattern, options, callbackSuccess, callbackFailure)

Load the first object of the collection, matching the given pattern
Parameters:
Name Type Description
pattern object object to be retrieved in the collection.
options object options to be used during the call. Same fields as #listExt options, except for the callbacks.
callbackSuccess RMP_IncludedCollection~loadCallbackSuccess callback to be used in case of a success
callbackFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

loadExt(pattern, options)

Load the first object of the collection, matching the given pattern.
Parameters:
Name Type Description
pattern object object to be retrieved in the collection.
options object options to be used during the call. Same fields as #listExt options. options.nb will be set to 1 and options.first will be set to 0.
See:

remove(pattern, messageSuccess, messageFailure)

Remove objects matching a given pattern
Parameters:
Name Type Description
pattern object pattern to be matched in the collection
messageSuccess String message displayed in case of a success
messageFailure String message displayed in case of a failure
See:

removeCallback(pattern, callbackSuccess, callbackFailure)

Remove objects matching a given pattern
Parameters:
Name Type Description
pattern object pattern to be matched in the collection
callbackSuccess RMP_IncludedCollection~countCallbackSuccess a callback function called in case of a success
callbackFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

removeExt(pattern, options)

Remove objects matching a given pattern
Parameters:
Name Type Description
pattern object pattern to be matched in the collection
options object option to be used during the call
Properties
Name Type Description
mode string execution mode of the collection (TEST or LIVE), defaults to the current execution mode of the application
asynchronous boolean false to make a synchronous call, true otherwise (default is true)
onSuccess RMP_IncludedCollection~countCallbackSuccess a callback function called in case of a success
onFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

save(object, messageSuccess, messageFailure)

Save an object to the collection
Parameters:
Name Type Description
object object the object to be saved
messageSuccess String message displayed in case of a success
messageFailure String message displayed in case of a failure
See:

saveCallback(object, callbackSuccess, callbackFailure)

Save an object to the collection
Parameters:
Name Type Description
object object the object to be saved
callbackSuccess RMP_IncludedCollection~saveCallbackSuccess callback to be used in case of a success
callbackFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

saveExt(object, options)

Save an object to the collection.
Parameters:
Name Type Description
object object the object to be saved
options object options to be used during the call
Properties
Name Type Description
mode string execution mode of the collection (TEST or LIVE), defaults to the current execution mode of the application
asynchronous boolean false to make a synchronous call, true otherwise (default is true)
onSuccess RMP_IncludedCollection~saveCallbackSuccess a callback function called in case of a success
onFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

update(pattern, object, messageSuccess, messageFailure)

Update one object of the collection
Parameters:
Name Type Description
pattern object pattern to be matched in the collection
object object the value to be used to update the matching object
messageSuccess String message displayed in case of a success
messageFailure String message displayed in case of a failure
See:

updateCallback(pattern, object, callbackSuccess, callbackFailure)

Update one object of the collection
Parameters:
Name Type Description
pattern object pattern to be matched in the collection
object object the value to be used to update the matching object
callbackSuccess RMP_IncludedCollection~countCallbackSuccess a callback function called in case of a success
callbackFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

updateExt(pattern, object, options)

Update objects of the collection.
Parameters:
Name Type Description
pattern object the pattern used to find the object to be modified
object object the value to be used to update the matching object
options object options to be used for the call
Properties
Name Type Description
multi boolean true to update all matching objects, false to update only the first matching object. If you set multi to true, you have to use '$' operators in object, otherwise the call will silently fails
mode string execution mode of the collection (TEST or LIVE), defaults to the current execution mode of the application
asynchronous boolean false to make a synchronous call, true otherwise (default is true)
onSuccess RMP_IncludedCollection~countCallbackSuccess a callback function called in case of a success
onFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

updateMulti(pattern, object, messageSuccess, messageFailure)

Update multiple objects of the collection
Parameters:
Name Type Description
pattern object pattern to be matched in the collection
object object operations ('$' operators) to be executed on the matching objects
messageSuccess String message displayed in case of a success
messageFailure String message displayed in case of a failure
See:

updateMultiCallback(pattern, object, callbackSuccess, callbackFailure)

Update multiple objects of the collection
Parameters:
Name Type Description
pattern object pattern to be matched in the collection
object object operations ('$' operators) to be executed on the matching objects
callbackSuccess RMP_IncludedCollection~countCallbackSuccess a callback function called in case of a success
callbackFailure RMP_IncludedCollection~callbackFailure a callback function called in case of a failure
See:

Type Definitions

callbackFailure(response)

Collection operation failure callback
Parameters:
Name Type Description
response object an object with the following properties
Properties
Name Type Description
responseJSON object an object
responses.responseJSON.error string the error message transmitted by the server

callbackSuccess(response)

Collection operation success callback
Parameters:
Name Type Description
response object If detailed is false response is an array containing the results. if detailed is true, response is an object with properties
Properties
Name Type Description
values array an array containing the objects result of the aggregation
count number the length of values array
limit number the max number of items returned as specified in the pipelines
skip number the rank of the first item returned as specified in the pipelines

countCallbackSuccess(response)

Collection operation success callback, when a count is expected
Parameters:
Name Type Description
response object an object with properties
Properties
Name Type Description
P_count number the number of removed/updated objects

loadCallbackSuccess(response)

Collection operation success callback, when an object is expected
Parameters:
Name Type Description
response object the object loaded

saveCallbackSuccess(response)

Collection operation success callback, when a saved object is expected
Parameters:
Name Type Description
response object the new version of the saved object