Creatio development guide
PDF
This documentation is valid for Creatio version 7.12.0. We recommend using the newest version of Creatio documentation.

Terrasoft.Configuration.EntityMapper class

Glossary Item Box

Introduction

The Terrasoft.Configuration.EntityMapper class is a utility configuration class that stored in the [FinAppLending] package of the Lending product. EntittyMapper allows to map data of one Entity with another using rules defined in the configuration file. Using the approach of mapping the data of different entities avoids the appearance of a monotonous code.

The idea of mapping the data of different entities is implemented in the following classes:

  • EntityMapper – implements the mapping logic.
  • EntityResult – defines the resulting type of the mapped entity.
  • MapConfig – a set of mapping rules.
  • DetailMapConfig – used to set up a list of mapping rules of the details and entities connected with them.
  • RelationEntityMapConfig – contains rules for mapping connected entities.
  • EntityFilterMap – a filter for database query.

Terrasoft.Configuration.EntityMapper

Table 1. Methods of the Terrasoft.Configuration.EntityMapper class

Name Parameters Returned value Description
public virtual EntityResult GetMappedEntity(Guid recId, MapConfig config)

recId – GUID recodrs in the database.

config – an instance of the MapConfig class, which is a set of mapping rules.

An instance of the EntityResult class, which is a mapped data for two Entity objects. Returns mapped data for two Emtity objects.
public virtual Dictionary<string, object> GetColumnsValues(Guid recordId, MapConfig config, Dictionary<string, object> result)

recordId – GUID recodrs in the database.

Config – an instance of the MapConfig class, which is a set of mapping rules.

Result – a dictionary of columns and their values of the mapped entity.

A dictionary of columns and their values. Gets the main entity from the database and matches its columns and values according to the rules specified in the config object.
public virtual Dictionary<string, object> GetRelationEntityColumnsValues(List<RelationEntityMapConfig> relations, Dictionary<string, object> dictionaryToMerge, string columnName, Terrasoft.Nui.ServiceModel.DataContract.LookupColumnValue entitylookup)

relations – a list of rules for obtaining related records.

dictionaryToMerge – a dictionary with columns and theis values.

columnName – name of the parent column

entitylookup – an object that contains name and Id of the record in the database.

A dictionary of columns and their values. Gets the related entities from the database and matches them to the main entities.
protected virtual EntitySchemaQuery SetColumns(EntitySchemaQuery esq, Dictionary<string, string> columns)

esq – instance of the EntitySchemaQuery class

Columns – a dictionary of names of the mapped columns.

The instance of the EntitySchemaQuery class. Sets columns for selection from the database.
protected EntitySchemaQuery SetFilters(EntitySchemaQuery esq, List<EntityFilterMap> filters)

esq – instance of the EntitySchemaQuery class

filters – a list of the filters.

The instance of the EntitySchemaQuery class. Sets filters for the entities to select records from the database.
protected virtual Dictionary<string, List<Dictionary<string, object>>> GetDetailsColumnsValues(Guid recId, MapConfig config, Dictionary<string, List<Dictionary<string, object>>> result)

recId – GUID recodrs in the database.

Config – an instance of the MapConfig class, which is a set of mapping rules.

Result – a dictionary of columns and their values of the mapped entity.

A dictionary of details, detail columns and column values. Gets the entity from the database and matches its columns and values according to the rules specified in the config object.

Terrasoft.Configuration.EntityResult

Used as a container for returning mapped values.

Table 2. Main properties of the Terrasoft.Configuration.EntityResult class

Property Type Description
Columns: Dictionary<string, object> A dictionary of main entity column names and their values.
Details Dictionary<string, List<Dictionary<string, object>>> A dictionary of the detail names with the list of their columns and values.

Terrasoft.Configuration.MapConfig

Used to set a list of mapping rules

Table 3. Main properties of the Terrasoft.Configuration.MapConfig class

Property Type Description
SourceEntityName string Entity name in the database.
Columns: Dictionary<string, object> A dictionary with the names of columns of one entity and compared columns of another entity.
DetailsConfig List<DetailMapConfig> A list of configuration objects with rules for details.
CleanDetails List<string> A list of detail names for cleaning their values.
RelationEntities List<RelationEntityMapConfig> List of configuration objects with rules for mapping related records with the main entity.

Terrasoft.Configuration.DetailMapConfig

Used to set up a list of mapping rules of the details and entities connected with them.

Table 4. Main properties of the Terrasoft.Configuration.DetailMapConfig class

Property Type Description
DetailName string Detail name (Tt ensure the uniqueness of detail instance).
SourceEntityName string Entity name in the database.
Columns: Dictionary<string, object> A dictionary with the names of columns of one entity and compared columns of another entity.
Filters List<EntityFilterMap> A list of configuration objects with filtration rules for more accurate selections from the database.
RelationEntities List<RelationEntityMapConfig> List of configuration objects with rules for mapping related records with the main entity.

Terrasoft.Configuration.RelationEntityMapConfig

Contains rules for mapping connected entities.

Table 5. Main properties of the Terrasoft.Configuration.RelationEntityMapConfig class

Property Type Description
ParentColumnName string The name of the parent column, which, when found, will trigger the logic for obtaining and mapping the entity data.
SourceEntityName string Entity name in the database.
Columns: Dictionary<string, object> A dictionary with the names of columns of one entity and compared columns of another entity.
Filters List<EntityFilterMap> A list of configuration objects with filtration rules to refine selections from the database.
RelationEntities List<RelationEntityMapConfig> List of configuration objects with rules for mapping related records with the main entity.

Terrasoft.Configuration.EntityFilterMap

A filter for database query.

Table 5. Main properties of the Terrasoft.Configuration.EntityFilterMap class

Property Type Description
ColumnName string The name of the column, which when found, will start the filtering logic.
Value object The value to compare to.

© bpm'online 2002-2019.

Did you find this information useful?

How can we improve it?