public class RemoteRecordmActionPack extends Object
com.cultofbits.integrationm.service.properties
file
with the recordm
key;
for example:
action.names=...,<remote-recordm-ap-name> action.<remote-recordm-ap-name>=remote-recordm action.<remote-recordm-ap-name>.remote-recordm.base-url=<url form RecordM service> action.<remote-recordm-ap-name>.remote-recordm.security-token=<valid security token>
With <remote-recordm-ap-name> in the IntegrationM scripts, you can refer to it only by `<remote-recordm-ap-name>.create(...)`
Constructor and Description |
---|
RemoteRecordmActionPack(String url,
String securityToken) |
Modifier and Type | Method and Description |
---|---|
ReusableResponse<String> |
attach(int instanceId,
String field,
String filename,
byte[] base64encodedContent)
Attaches a file to the specified instance and
$file field. |
ReusableResponse<String> |
attach(int instanceId,
String field,
String filename,
File file)
Attaches a file to the specified instance and
$file field. |
ReusableResponse<String> |
attach(int instanceId,
String field,
String filename,
InputStream content)
Attaches a file to the specified instance and
$file field. |
ReusableResponse<RecordmInstance> |
create(String definition,
Map<String,Object> values)
Creates a new instance of a record based on the provided definition and values.
|
ReusableResponse<RecordmInstance> |
create(String definition,
Map<String,Object> values,
Map<String,Object> options)
Creates a new instance of a record based on the provided definition and values.
|
void |
create(String definition,
Map<String,Object> values,
Map<String,Object> options,
Consumer<javax.ws.rs.core.Response> processor)
Creates a new instance of a record based on the provided definition, values, and options, and processes the response
using the specified consumer.
|
ReusableResponse<RecordmStats> |
delete(String definition,
int instanceId)
Deletes an instance of a record with the specified instance ID.
|
ReusableResponse<RecordmStats> |
delete(String definition,
String condition)
Deletes multiple instances of records that match the specified condition.
|
ReusableResponse<RecordmStats> |
delete(String definition,
String condition,
Map<String,Object> options)
Deletes multiple instances of records that match the specified condition.
|
ReusableResponse<RecordmInstance> |
get(int instanceId)
Retrieves the instance of a record with the specified instance ID.
|
ReusableResponse<RecordmInstance> |
get(String instanceId)
Retrieves the instance of a record with the specified instance ID.
|
ReusableResponse<Definition> |
getDefinition(String name)
Retrieves the definition with the specified name.
|
SearchResult<RecordmSearchHit> |
search(String definition,
String query)
Searches for instances of records that match the provided query in the specified definition.
|
void |
search(String definition,
String query,
Consumer<javax.ws.rs.core.Response> processor)
Searches for instances of records that match the provided query in the specified definition and processes
the search response with the specified response processor.
|
SearchResult<RecordmSearchHit> |
search(String definition,
String query,
Map<String,String> options)
Searches for instances of records that match the provided query in the specified definition.
|
void |
search(String definition,
String query,
Map<String,String> options,
Consumer<javax.ws.rs.core.Response> processor)
Searches for instances of records that match the provided query in the specified definition and processes
the search response with the specified response processor and additional options.
|
void |
stream(String definition,
String query,
Consumer<RecordmSearchHit> hitConsumer)
Streams instances of records that match the provided query in the specified definition to the consumer.
|
void |
stream(String definition,
String query,
Map<String,String> options,
Consumer<RecordmSearchHit> hitConsumer)
Streams instances of records that match the provided query in the specified definition to the consumer,
using the provided search options.
|
void |
streamUntil(String definition,
String query,
Map<String,String> options,
Function<RecordmSearchHit,Boolean> hitConsumer)
Streams instances of records that match the provided query in the specified definition to the consumer,
using the provided search options, until the consumer's function returns false.
|
ReusableResponse<RecordmStats> |
update(String definition,
int instanceId,
Map<String,Object> updates)
Updates an instance of a Definition with the specified instance ID using the provided updates.
|
void |
update(String definition,
int instanceId,
Map<String,Object> updates,
Consumer<javax.ws.rs.core.Response> processor)
Updates an instance of a Definition with the specified instance ID using the provided updates and runs the update operation with the specified user context.
|
ReusableResponse<RecordmStats> |
update(String definition,
String condition,
Map<String,Object> updates,
Map<String,Object> options)
Updates multiple instances of records that match the specified condition using the provided updates.
|
void |
update(String definition,
String condition,
Map<String,Object> updates,
Map<String,Object> options,
Consumer<javax.ws.rs.core.Response> processor)
Updates multiple instances of records that match the specified condition using the provided updates and additional options.
|
public ReusableResponse<String> attach(int instanceId, String field, String filename, byte[] base64encodedContent)
Attaches a file to the specified instance and $file
field.
Note: to make the file available in the instance, the field value must be set to the file name. This should be done on a separate update.
instanceId
- The identifier of the instance to which the file will be attached.field
- The field to which the file will be attached. It can be the field name or the field definition ID
to ensure unambiguity when there are multiple fields with the same name.filename
- The name of the file being attached.base64encodedContent
- The content of the file in Base64-encoded format.ReusableResponse
containing a String response representing the result of the attachment operation.public ReusableResponse<String> attach(int instanceId, String field, String filename, File file)
Attaches a file to the specified instance and $file
field.
Note: to make the file available in the instance, the field value must be set to the file name. This should be done on a separate update.
instanceId
- The identifier of the instance to which the file will be attached.field
- The field to which the file will be attached. It can be the field name or the field definition ID
to ensure unambiguity when there are multiple fields with the same name.filename
- The name of the file being attached.file
- The File
object representing the file to be attached.ReusableResponse
containing a String response representing the result of the attachment operation.public ReusableResponse<String> attach(int instanceId, String field, String filename, InputStream content)
Attaches a file to the specified instance and $file
field.
Note: to make the file available in the instance, the field value must be set to the file name. This should be done on a separate update.
instanceId
- The identifier of the instance to which the file will be attached.field
- The field to which the file will be attached. It can be the field name or the field definition ID
to ensure unambiguity when there are multiple fields with the same name.filename
- The name of the file being attached.content
- The InputStream
containing the content of the file to be attached.ReusableResponse
containing a String response representing the result of the attachment operation.public ReusableResponse<RecordmInstance> create(String definition, Map<String,Object> values)
definition
- the definition of the record, specifying its structure and fields.values
- a Map containing the field names and corresponding values for the new instance.ReusableResponse
object containing the result of the instance creation operation. The response
includes information about the success or failure of the operation, any error messages,
and a RecordmInstance
object representing the created instance if the operation was successful.public ReusableResponse<RecordmInstance> create(String definition, Map<String,Object> values, Map<String,Object> options)
definition
- the definition of the record, specifying its structure and fields.values
- a Map containing the field names and corresponding values for the new instance.options
- a Map containing additional options for the instance creation.
The list of options are:
ReusableResponse
object containing the result of the instance creation operation. The response
includes information about the success or failure of the operation, any error messages,
and a RecordmInstance
object representing the created instance if the operation was successful.public void create(String definition, Map<String,Object> values, Map<String,Object> options, Consumer<javax.ws.rs.core.Response> processor)
definition
- the definition of the record, specifying its structure and fields.values
- a Map containing the field names and corresponding values for the new instance.options
- a Map containing additional options for the instance creation.
The list of options are:
processor
- a Consumer that processes the response of the instance creation operation.public ReusableResponse<RecordmStats> delete(String definition, int instanceId)
definition
- the definition of the record to which the instance belongs.instanceId
- the ID of the instance to be deleted.ReusableResponse
object containing the result of the instance delete operation. The response includes
information about the success or failure of the operation, any error messages, and an RecordmStats
object with the statistics associated to the operationpublic ReusableResponse<RecordmStats> delete(String definition, String condition)
definition
- the definition of the record to which the instances belong.condition
- the condition to filter instances that should be deleted. Instances that satisfy this condition
will be deleted.ReusableResponse
object containing the result of the delete operation. The response
includes information about the success or failure of the operation, any error messages, and a RecordmStats
object representing statistics on the delete operation.public ReusableResponse<RecordmStats> delete(String definition, String condition, Map<String,Object> options)
definition
- the definition of the record to which the instances belong.condition
- the condition to filter instances that should be deleted. Instances that satisfy this condition
will be deleted.options
- additional options for customizing the instance update. The options are provided as a map
where the keys represent the option names, and the values contain the corresponding option values.
The available options are:
ignoreRefs
: if true, instances will be deleted even if they have other instances with $ref
fields pointing to them.tz
: a string with the time zone to use for the condition queryReusableResponse
object containing the result of the delete operation. The response
includes information about the success or failure of the operation, any error messages, and a RecordmStats
object representing statistics on the delete operation.public ReusableResponse<RecordmInstance> get(int instanceId)
instanceId
- the ID of the instance to be retrieved.ReusableResponse
object containing the result of the retrieve operation. The response
includes information about the success or failure of the operation, any error messages, and a RecordmInstance
object representing the retrieved instance if the operation was successful.public ReusableResponse<RecordmInstance> get(String instanceId)
instanceId
- the ID of the instance to be retrieved.ReusableResponse
object containing the result of the retrieve operation. The response
includes information about the success or failure of the operation, any error messages, and a RecordmInstance
object representing the retrieved instance if the operation was successful.public ReusableResponse<Definition> getDefinition(String name)
name
- the name of the definition to be retrieved.ReusableResponse
object containing the result of the retrieve operation. The response
includes information about the success or failure of the operation, any error messages, and a Definition
object representing the retrieved record definition if the operation was successful.public SearchResult<RecordmSearchHit> search(String definition, String query)
stream(String, String, Consumer)
definition
- the definition of the record to search.query
- the search query to be used for finding instances.SearchResult
object containing the result of the search operation. The SearchResult
includes a list of RecordmSearchHit
objects that represent the matching instances and additional information
such as the total count of matching instances.public void search(String definition, String query, Consumer<javax.ws.rs.core.Response> processor)
definition
- the definition of the record to search.query
- the search query to be used for finding instances.processor
- a Consumer
to process the Response
of the update operation. This allows
the caller to perform additional actions with the response, such as handling success or failure
scenarios.public SearchResult<RecordmSearchHit> search(String definition, String query, Map<String,String> options)
stream(String, String, Map, Consumer)
definition
- the definition of the record to search.query
- the search query to be used for finding instances.options
- additional options for customizing the search. The options are provided as a map
where the keys represent the option names, and the values contain the corresponding option values.
The available options are:
size
: the number of results to return. Defaults to 30.sort
: a comma-separated list of fields and sort directions. E.g. field1:asc,field2:desc
tz
: a string with the time zone to use for the querySearchResult
object containing the result of the search operation. The SearchResult
includes a list of RecordmSearchHit
objects that represent the matching instances and additional information
such as the total count of matching instances.public void search(String definition, String query, Map<String,String> options, Consumer<javax.ws.rs.core.Response> processor)
definition
- the definition of the record to search.query
- the search query to be used for finding instances.options
- additional options for customizing the search. The options are provided as a map
where the keys represent the option names, and the values contain the corresponding option values.
The available options are:
size
: the number of results to return. Defaults to 30.sort
: a comma-separated list of fields and sort directions. E.g. field1:asc,field2:desc
tz
: a string with the time zone to use for the queryprocessor
- a Consumer
to process the Response
of the update operation. This allows
the caller to perform additional actions with the response, such as handling success or failure
scenarios.public void stream(String definition, String query, Consumer<RecordmSearchHit> hitConsumer)
definition
- the definition of the record to search.query
- the search query to be used for finding instances.hitConsumer
- a Consumer
to consume the matching instances of RecordmSearchHit
as they are streamed. This allows
the caller to process the instances in real-time without loading all of them into memory at once.public void stream(String definition, String query, Map<String,String> options, Consumer<RecordmSearchHit> hitConsumer)
definition
- the definition of the record to search.query
- the search query to be used for finding instances.options
- additional options for customizing the search. The options are provided as a map
where the keys represent the option names, and the values contain the corresponding option values.
The available options are:
size
: the number of results to return. Defaults to 30.sort
: a comma-separated list of fields and sort directions. E.g. field1:asc,field2:desc
tz
: a string with the time zone to use for the queryhitConsumer
- a Consumer
to consume the matching instances of RecordmSearchHit
as they are streamed. This allows
the caller to process the instances in real-time without loading all of them into memory at once.public void streamUntil(String definition, String query, Map<String,String> options, Function<RecordmSearchHit,Boolean> hitConsumer)
definition
- the definition of the record to search.query
- the search query to be used for finding instances.options
- additional options for customizing the search. The options are provided as a map
where the keys represent the option names, and the values contain the corresponding option values.
The available options are:
size
: the number of results to return. Defaults to 30.sort
: a comma-separated list of fields and sort directions. E.g. field1:asc,field2:desc
tz
: a string with the time zone to use for the queryhitConsumer
- a Function
that receives a RecordmSearchHit
and returns a Boolean
that will consume the matching instances as they are streamed.
This allows the caller to process the instances in real-time until the consumer's condition is met.
The function should return true
to continue streaming more instances, or false
to stop
further streaming.public ReusableResponse<RecordmStats> update(String definition, int instanceId, Map<String,Object> updates)
definition
- the definition of the record to which the instance belongs.instanceId
- the ID of the instance to be updated.updates
- a Map
containing the updates to be applied to the instance. The keys represent the name of the fields
to be updated, and the corresponding values contain the new values for those fields.ReusableResponse
object containing the result of the instance update operation. The response includes
information about the success or failure of the operation, any error messages, and an RecordmStats
object with the statistics associated to the operationpublic void update(String definition, int instanceId, Map<String,Object> updates, Consumer<javax.ws.rs.core.Response> processor)
definition
- the definition of the record to which the instance belongs.instanceId
- the ID of the instance to be updated.updates
- a Map
containing the updates to be applied to the instance. The keys represent the name of the fields
to be updated, and the corresponding values contain the new values for those fields.processor
- a Consumer
to process the Response
of the update operation. This allows
the caller to perform additional actions with the response, such as handling success or failure
scenarios.public ReusableResponse<RecordmStats> update(String definition, String condition, Map<String,Object> updates, Map<String,Object> options)
definition
- the definition of the record to which the instance belongs.condition
- the condition (an ES query_string query) to filter instances that should be updated. Instances that satisfy this condition
will be updated with the provided updates.updates
- a Map
containing the updates to be applied to the instance. The keys represent the name of the fields
to be updated, and the corresponding values contain the new values for those fields.options
- additional options for customizing the instance update. The options are provided as a map
where the keys represent the option names, and the values contain the corresponding option values.
The available options are:
tz
: a string with the time zone to use for the condition queryReusableResponse
object containing the result of the instance update operation. The response includes
information about the success or failure of the operation, any error messages, and an RecordmStats
object with the statistics associated to the operationpublic void update(String definition, String condition, Map<String,Object> updates, Map<String,Object> options, Consumer<javax.ws.rs.core.Response> processor)
definition
- the definition of the record to which the instances belong.condition
- the condition to filter instances that should be updated. Instances that satisfy this condition
will be updated with the provided updates.updates
- a Map
containing the updates to be applied to the instance. The keys represent the name of the fields
to be updated, and the corresponding values contain the new values for those fields.options
- additional options for customizing the instance update. The options are provided as a map
where the keys represent the option names, and the values contain the corresponding option values.
The available options are:
tz
: a string with the time zone to use for the condition queryprocessor
- a Consumer
to process the Response
of the update operation. This allows the caller
to perform additional actions with the response, such as handling success or failure scenarios.Copyright © 2021 Cult Of Bits, lda