# Class: ExpressionDataMapping

## ExpressionDataMapping

#### new ExpressionDataMapping()

Maps raw data to data objects, using FRB expressions, of a specific type. TODO: Write more thorough description.

Source:
  - data/service/expression-data-mapping.js, line 24

### Extends

- external:DataMapping

### Members

#### addObjectMappingRule

Adds a rule to be used for mapping objects to raw data.

Source:
  - data/service/expression-data-mapping.js, line 246

#### addRawDataMappingRule

Adds a rule to be used for mapping raw data to objects.

Source:
  - data/service/expression-data-mapping.js, line 264

#### addRequisitePropertyName

Adds a name to the list of properties that will participate in eager mapping. The requisite property names will be mapped during the map from raw data phase.

Source:
  - data/service/expression-data-mapping.js, line 211

#### initWithServiceObjectDescriptorAndSchema

Source:
  - data/service/expression-data-mapping.js, line 84

#### mapFromRawData

Source:
  - data/service/expression-data-mapping.js, line 845
To Do:
  - Document deprecation in favor of mapRawDataToObject()

#### mapToRawData

Source:
  - data/service/expression-data-mapping.js, line 855
To Do:
  - Document deprecation in favor of mapObjectToRawData()

#### objectDescriptor :ObjectDescriptor

The descriptor of the objects that are mapped to by this data mapping.

##### Type:

- ObjectDescriptor

Source:
  - data/service/expression-data-mapping.js, line 141

#### objectDescriptorReference :ObjectDescriptorReference

A reference to the object descriptor that is used by this mapping. Used by serialized data mappings.

##### Type:

- ObjectDescriptorReference

Source:
  - data/service/expression-data-mapping.js, line 171

#### requisitePropertyNames

Source:
  - data/service/expression-data-mapping.js, line 227

#### schemaDescriptor :ObjectDescriptor

The descriptor of the "raw data" mapped from by this data mapping.

##### Type:

- ObjectDescriptor

Source:
  - data/service/expression-data-mapping.js, line 156

#### schemaDescriptorReference :ObjectDescriptorReference

A reference to the object descriptor of the "raw data" that is used by this mapping. Used by serialized data mappings.

##### Type:

- ObjectDescriptorReference

Source:
  - data/service/expression-data-mapping.js, line 186

#### service :DataService

The service that owns this mapping object. Used to create fetches for relationships.

##### Type:

- DataService

Source:
  - data/service/expression-data-mapping.js, line 201

### Methods

#### mapObjectToCriteriaSourceForProperty(object, data, propertyName)

Convert model object properties to the raw data properties present in the requirements for a given propertyName

##### Parameters:

Name | Type | Description
--- | --- | ---
`object` | Object | An object whose properties' values hold the model data.
`data` | Object | An object whose properties must be set or modified to represent the model data.
`propertyName` | string | The name of the property whose requirements need to be populated in the raw data.

Source:
  - data/service/expression-data-mapping.js, line 364

#### mapObjectToRawData(object, data)

Convert model objects to raw data objects of an appropriate type. Subclasses should override this method to map properties of the model objects to raw data, as in the following: mapObjectToRawData: { value: function (object, data) { data.GIVEN_NAME = object.firstName; data.FAMILY_NAME = object.lastName; } } The default implementation of this method copies the properties defined by the model object to the raw data object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`object` | Object | An object whose properties' values hold the model data.
`data` | Object | An object whose properties must be set or modified to represent the model data

Source:
  - data/service/expression-data-mapping.js, line 338

#### mapObjectToRawDataProperty(object, data, propertyName)

Returns the value of a single raw data property evaluated against the model object

##### Parameters:

Name | Type | Description
--- | --- | ---
`object` | Object | An object whose properties' values hold the model data.
`data` | Object | The object on which to assign the property
`propertyName` | string | The name of the raw property to which to assign the values.

Source:
  - data/service/expression-data-mapping.js, line 426

#### mapRawDataToObject(data, object)

Convert raw data to data objects of an appropriate type. Subclasses should override this method to map properties of the raw data to data objects, as in the following: mapRawDataToObject: { value: function (data, object) { object.firstName = data.GIVEN_NAME; object.lastName = data.FAMILY_NAME; } } The default implementation of this method copies the properties defined by the raw data object to the data object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | Object | An object whose properties' values hold the raw data.
`object` | Object | An object whose properties must be set or modified to represent the raw data.

Source:
  - data/service/expression-data-mapping.js, line 296

#### mapRawDataToObjectProperty(data, object, propertyName)

Returns the value of a single model property evaluated against the raw data object

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | Object | An object whose properties' values hold the raw data.
`object` | Object | The object on which to assign the property
`propertyName` | string | The name of the model property to which to assign the values.

Source:
  - data/service/expression-data-mapping.js, line 603

#### resolvePrerequisitesForProperty(object, propertyName)

Pre-fetches the model properties that are required to map another model property

##### Parameters:

Name | Type | Description
--- | --- | ---
`object` | Object | The object on which to prefetch properties
`propertyName` | string | The name of the model property for which there are prerequisites

Source:
  - data/service/expression-data-mapping.js, line 649

#### serviceIdentifierForProperty(propertyName)

Returns the identifier of the child service of .service that is used to fetch propertyName

##### Parameters:

Name | Type | Description
--- | --- | ---
`propertyName` | string | The name of a model property

Source:
  - data/service/expression-data-mapping.js, line 471