Class: Mapping

$k. Mapping

new $k.Mapping()

Represents a (external) data mapping

Extends

Methods

exportElements()

Same as runExportOnElements()

Version:
  • Experimental feature, might be removed at any time
Since:
  • 4.3.1

runExport() : object

Runs this mapping as export

Version:
  • Experimental feature, might be removed at any time
Since:
  • 4.1.0
Throws:
Type Description
$k.exception.MappingError

Unhandled error while exporting to the data source (e.g. no connection to database, file not found)

Returns:
Type Description
object Object with the keys 'updated' and 'inserted' with the number of updated/inserted rows (databases only)

runExportOnElements(elements) : object

Runs this mapping as export on some elements

Name Type Description
elements Array.<$k.SemanticElement>

List of semantic elements to export via this mapping

Version:
  • Experimental feature, might be removed at any time
Since:
  • 4.1.0
Throws:
Type Description
$k.exception.MappingError

Unhandled error while exporting to the data source (e.g. no connection to database, file not found)

Returns:
Type Description
object Object with the keys 'updated' and 'inserted' with the number of updated/inserted rows (databases only)

runImport() : Array.<object>

Runs this mapping as import

Version:
  • Experimental feature, might be removed at any time
Since:
  • 4.1.0
Throws:
Type Description
$k.exception.MappingError

Unhandled error while importing from the data source (e.g. no connection to database, file not found).

Returns:
Type Description
Array.<object> Object with information about the import.

{
"errorCount": ,
"log": [ logEntry1, logEntry2, ... ]
}
Each log entry contains some or all of the following properties:

{
"message" : "",
"caption" : "",
"data" : "",
"mapping" : "",
"category" : "",
"row:" ""
}

setParameter(name, value) : $k.Mapping

Set a single mapping parameter value overriding this parameter in the mapping definition

Name Type Description
name string

Name of the parameter to set

value

Value of the parameter

Version:
  • Experimental feature, might be removed at any time
Since:
  • 4.1.0
See:
Throws:
Type Description
$k.exception.TypeError

If the value does not match the expected type for the parameter

$k.exception.InvalidValue

If the name is not a valid parameter for mappings

Returns:
Type Description
$k.Mapping This mapping

setParameters(object) : $k.Mapping

Set a group of parameter values overriding the parameter in the mapping definition.


Possible parameters:


  • bindings: database bindings (object with name and value) to use to replace parameters in select statements (database and import only)

  • caption: should the first row in the file be ignored, because it contains captions (CSV mappings only)

  • dbEnvironment: database environment string (Oracle mappings only)

  • dbHostname: database host name to connect to (MySQL mappings only

  • dbPassword: database users password to use (databases only)

  • dbUsername: database user name to use (databases only)

  • encoding: encoding to use

  • importString: use this string instead of configured data source

  • isJson: is the source a json file (XML mappings only)

  • logTopicsToFolder: should the modified/created topics be logged to folders (false to switch off, true requires configured folder object in mapping) (import only)

  • netEntity: use this NetEntity as file input or output. For output to text (CSV etc.) set the charset of the entity before export, the encoding of the mapping is ignored.

  • separator: separator to use in plain text files (CSV mappings only)

  • triggers: should triggers be be activated during import (import only)


Name Type Description
object object

Object with parameter names and values

Version:
  • Experimental feature, might be removed at any time
Since:
  • 4.1.0
Throws:
Type Description
$k.exception.TypeError

If the passed object or any value does not match the expected type for the parameter

$k.exception.InvalidValue

If a name is not a valid parameter for mappings

Returns:
Type Description
$k.Mapping This mapping

Intherited methods