Table of Contents

Class DataEnricherApi

Namespace: Casewhere.Runtime.DSL.Api
Assembly: Casewhere.Runtime.dll

public class DataEnricherApi : IDataEnricherApi, IDslApi

Inheritance

objectDataEnricherApi

Implements

IDataEnricherApi, IDslApi

Inherited Members

object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()

Extension Methods

ObjectExtension.ConvertToBsonValue(object), EnumExtensions.DeepClone<DataEnricherApi>(DataEnricherApi)

Constructors

DataEnricherApi(IPriorityJobQueue, ISearchDataEnricher, IDataClassRepository, IDomainRepository, IDataObjectIndexManager)

public DataEnricherApi(IPriorityJobQueue priorityJobQueue, ISearchDataEnricher searchDataEnricher, IDataClassRepository dataClassRepository, IDomainRepository domainRepository, IDataObjectIndexManager dataObjectIndexManager)

Parameters

priorityJobQueue IPriorityJobQueue

searchDataEnricher ISearchDataEnricher

dataClassRepository IDataClassRepository

domainRepository IDomainRepository

dataObjectIndexManager IDataObjectIndexManager

Methods

CreateIndex(string, DslIndexDefinition)

Create an index for attributes of data class.

public void CreateIndex(string dataClassName, DslIndexDefinition indexDefinition)

Parameters

dataClassName string

Data class name by user defined

indexDefinition DslIndexDefinition

Index information

Examples

var dataClassName = "Company";
var indexDefinition = new DslIndexDefinition()
{
    Name= "CompanyName", //User define
    Keys = new List<DslIndexKeyDefinition>()
    {
        new DslIndexKeyDefinition(name: "CompanyName", indexType: 1)
    }
}; 
var dataEnricherApi = ctx.Use<IDataEnricherApi>();
dataEnricherApi.CreateIndex(dataClassName, indexDefinition);

DropIndex(string, string)

Drop an index of data class.

public void DropIndex(string dataClassName, string indexName)

Parameters

dataClassName string

Data class name by user defined.

indexName string

Name of Index.

Examples

var dataClassName = "Company";
var indexName = "CompanyName"; 
var dataEnricherApi = ctx.Use<IDataEnricherApi>();
dataEnricherApi.DropIndex(dataClassName, indexName);

Enrich(string)

Enrich search data for specific data object id

public void Enrich(string dataObjectId)

Parameters

dataObjectId string

GetIndexes(string)

Get list existing indexes of data class.

public List<DslIndexDefinition> GetIndexes(string dataClassName)

Parameters

dataClassName string

Data class name by user defined.

Returns

List<DslIndexDefinition>

List existing indexes of data class

Examples

var dataClassName = "Company";
var dataEnricherApi = ctx.Use<IDataEnricherApi>();
var currentIndexes = dataEnricherApi.GetIndexes(dataClassName);

Queue(string)

Queues a data enriching job for specific data object id

public void Queue(string dataObjectId)

Parameters

dataObjectId string

QueueAll(string, TimeSpan?, int)

Enrich the whole data collection. The workflow will be blocked until all the data enriching jobs are queued.

public void QueueAll(string dataClassName, TimeSpan? timeout = null, int batchSize = 100)

Parameters

dataClassName string

The data class name.

timeout TimeSpan?

The timeout.

batchSize int

The batch size.

Examples

var dataApi = ctx.Use<IDataEnricherApi>();
dataApi.QueueAll("Employee", TimeSpan.FromSeconds(30));

QueueAllAsync(string, TimeSpan?, int)

Enrich the whole data collection asynchronously. The workflow will be continue and finish without waiting all the jobs are queued.

public void QueueAllAsync(string dataClassName, TimeSpan? timeout = null, int batchSize = 100)

Parameters

dataClassName string

The data class name.

timeout TimeSpan?

The timeout.

batchSize int

The batch size.

Examples

var dataApi = ctx.Use<IDataEnricherApi>();
dataApi.QueueAllAsync("Employee", TimeSpan.FromSeconds(30));