IndustriesContext Class

Contains methods to create, query, persist, or delete a context. Also, query a record’s status, query a context based on tags, or update context attributes by using the available methods.

Context

Learn more about the available methods with the IndustriesContext class.

The IndustriesContext class includes these methods.

Adds one or more records at a user-defined level in the hierarchy of the context.

public Map<String,Object> addRecordsToContext(Map<String,Object> input)

input

Type: Map<String,Object>

Map of values used to add records to the context. The map can include these keys.

contextId

Type: String

ID of the Context to which record described in inputData is added.

overWriteExistingRecords

Type: Boolean

Indicates if an already existing record with same ID as being added through inputData must be overriden.

inputData

Type: String

Record data to be added to the context, hierarchical data in stringified format.

isTaggedData

Type: Boolean

Describes if the inputData structure is using the taggedData Format.

Type: Map<String,Object>

Creates a context.

public Map<String,Object> buildContext(Map<String,Object> input)

input

Type: Map<String,Object>

Metadata about the context and payload data required to create a context.

Type: Map<String,Object>

Details containing the context ID that’s created.

Deletes a context.

public void deleteContext(Map<String,Object> input)

input

Type: Map<String,Object>

Details containing the ID of the context to be deleted.

Type: void

Deletes one or more records from a context session identified by data paths.

public Map<String,Object> deleteRecords(Map<String,Object> input)

input

Type: Map<String,Object>

Map of values used to delete records from the context. The map can include these keys.

contextId

Type: String

Required. ID of the context session from which records are deleted.

dataPaths

Type: List<Map<String,Object>>

Required. List of data path objects that identify records for deletion. Each object contains a dataPath key with record IDs that define the hierarchical path between the root and target record in the context.

isPermanentDelete

Type: Boolean

Optional. Indicates whether the deletion is permanent (true) or not (false). If false, records are soft-deleted and marked as deleted within the context. If true, records are permanently removed from the context. The default value is false.

Type: Map<String,Object>

isSuccess

Type: Boolean

Returns true if the delete operation completed successfully.

Removes the details of the context definition from cache.

public void evictContextDefinition(Map<String,ANY> input)

input

Type: Map<String,ANY>

API name of the context definition to remove the details of the context definition from cache.

Type: void

Builds or queries a context based on a filter criteria.

public Map<String, Object> industriesContexts.filteringContext(buildWithFilter);

Type: BUILD

Type: QUERYRECORDANDCHILDREN or QUERYRECORDS

input

Type: Enum

Object defining the type of operation. Operation Metadata along with filter criteria to be applied on the operation. Valid values are: BUILD,QUERYRECORDANDCHILDREN and QUERYRECORDS

filter

Type: String

Metadata about the filter object.

build

Type: Map<String,Object>

Metadata to build the context. Only for type with value BUILD.

query

Type: Map<String,Object>

Metadata to query records in the context. Only for type with value QUERYRECORDANDCHILDREN and QUERYRECORDS.

Type: Map<String,Object>

Mapping of the contextId or queryResults with the requested operation type.

Retrieves context details.

public Map<String,Object> getContext(Map<String,Object> input)

input

Type: Map<String,Object>

Details containing the ID of the context to be retrieved.

Type: Map<String,Object>

Details of the retrieved context.

Retrieves context mappings based on a target mapping ID.

public Map<String,Object> getContextTranslation(Map<String,Object> input)

input

Type: Map<String,Object>

Details of the request parameters to retrieve context mappings. The details include list of persisted attributes and settings to indicate whether any dependencies are established or restricted fields are removed.

Type: Map<String,Object>

Details of the retrieved context mappings.

Queries context tags and returns an optimized, leaner result set compared to the standard queryTags.

public Map<String,Object> leanerQueryTags(Map<String,Object> input)

Use the leanerQueryTags method to retrieve tag values from a context instance with optimized performance. This method returns a leaner result set.

Before calling this method, you must first create a context instance using the buildContext method and obtain the contextId.

input

Type: Map<String,Object>

Input map that contains the parameters required to query the tags. Valid keys are:

  • contextId: (String) — ID of the context to query[cite: 223].
  • tags: (List<String>) — List of tag names to query from the context instance. Tags serve as aliases for nodes and attributes in the context structure.

Type: Map<String,Object>

Returns a map that contains the query results. The map includes these keys:

  • contextId (String) — ID of the context instance.
  • recordIds (List<String>) — List of record IDs associated with the queried tags.
  • leanerQueryTagResult (Map<String,Object>) — Map that contains the query results. Each key represents a tag name, and its value contains the associated tag data with attribute information.

Persists the current data or state of context to the database.

public Map<String,Object> persistContext(Map<String,Object> input)

input

Type: Map<String,Object>

Details to persist context such as context ID and target mapping ID.

Type: Map<String,Object>

Reference ID for the persisted context.

Queries Context records and children based on the dataPath instead of tags.

Map<String, Object> industriesContexts.queryContextRecordsAndChildren(input: Map<String, Object>);

input

Type: Map<String,Object>

Map of values used to query context records and children.

contextId

Type: String

ID of the context to be queried.

queryPaths

Type: Map<String,Object>

List of dataPath to be queried.

queryResults: Map<String,Object>

Result containing the record data.

Queries the status of a record.

public Map<String,Object> queryRecordStatus(Map<String,Object> input)

input

Type: Map<String,Object>

Details containing the context ID and list of record paths for context data to query the status for.

Type: Map<String,Object>

Details containing the results of the query.

Queries a context by using tags.

public Map<String,Object> queryTags(Map<String,Object> input)

The method works on the tagNames of the attribute or node.

input

Type: Map<String,Object>

Details containing the context ID and tags to be queried.

Type: Map<String,Object>

Details containing the results of the query.

Updates the attributes of a context.

public Map<String,Object> updateContextAttributes(Map<String,Object> input)

Use this method to update the attributes of a context.

  • This method works only with the names of the canonical structure, and not with tags.
  • The dataType of the values must match the dataType in the canonical structure. Also, it must match the dataType of the field if persistence is expected later.
  • The method supports attribute updates at different level. Pass an attributeMap corresponding to the given dataPath.
  • The API works at the per-record level.
input

Type: Map<String,Object>

Details containing the context ID and node path. The node path contains the path of the context record and list of attributes to be updated with their values.

Type: Map<String,Object>

Details containing the updated attribute list.