new Mapping()
Represents a (external) data mapping
Extends
Methods
deregister()
Deregisters the element. The id will be undefined afterwards. Equivalent to setId(undefined)
- Inherited From
- See
- setId
exportElements()
Same as runExportOnElements()
- Version
- Experimental feature, might be removed at any time
- Since
- 4.3.1
id() → {string}
Returns the registered ID, or undefined if not registered.
- Inherited From
- Type:
- string
iterateRows(rowFunction, errorFunction) → {Array.<$k.Mapping>}
Uses the mapping as data-source and validates each row with the validation-function. 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)
- captions: Table captions (table 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)
- disabledQueryParameters: List of disabled query parameters
- 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.
- queryParameters: Query parameters object ( e.g. {searchString: 'Goethe'}). Use disabledQueryParameters to deactivate parameters.
- quote: should the cell values should be enclosed with quotes (CSV mappings only)
- separator: separator to use in plain text files (CSV mappings only)
- triggers: should triggers be be activated during import (import only)
Name | Type | Description |
---|---|---|
rowFunction | function | function to process each row in a table. The function is invoked with the arguments:
|
errorFunction | function | function invoked on internal errors (invalid file etc):
|
- Version
- Experimental feature, might be removed at any time
- Since
- 4.2.0
Unhandled errors while importing from the table data source (e.g. no connection to database, file not found, ...).
This mapping
- Type:
- Array.<$k.Mapping>
parentFolders() → {Array.<$k.Folder>}
Returns the folders that contain this element
- Inherited From
- Type:
- Array.<$k.Folder>
registryType() → {string}
Returns the name of the registry that contains elements of this type
- Inherited From
- Type:
- string
runExport() → {object}
Runs this mapping as export
- Version
- Experimental feature, might be removed at any time
- Since
- 4.1.0
Unhandled error while exporting to the data source (e.g. no connection to database, file not found)
Object with the keys 'updated' and 'inserted' with the number of updated/inserted rows (databases only)
- Type:
- object
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
Unhandled error while exporting to the data source (e.g. no connection to database, file not found)
Object with the keys 'updated' and 'inserted' with the number of updated/inserted rows (databases only)
- Type:
- object
runImport() → {Array.<object>}
Runs this mapping as import
- Version
- Experimental feature, might be removed at any time
- Since
- 4.1.0
Unhandled error while importing from the data source (e.g. no connection to database, file not found).
Object with information about the import. { "errorCount":
Each log entry contains some or all of the following properties: { "message" : "
- Type:
- Array.<object>
setId(id, replaceScriptReferences)
Registers the element with the given ID. If the element has already been registered, then the id changes. If the id is undefined, then the element will be deregistered.
Name | Type | Description |
---|---|---|
id | string | The ID |
replaceScriptReferences | boolean | True if ID references in scripts should be replaced. Only done when the old and the new ID is not undefined. |
- Inherited From
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
If the value does not match the expected type for the parameter
If the name is not a valid parameter for mappings
This mapping
- Type:
- $k.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)
- captions: Table captions (table 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)
- disabledQueryParameters: List of disabled query parameters
- 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.
- queryParameters: Query parameters object ( e.g. {searchString: 'Goethe'}). Use disabledQueryParameters to deactivate parameters.
- quote: should the cell values should be enclosed with quotes (CSV mappings only)
- 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
If the passed object or any value does not match the expected type for the parameter
If a name is not a valid parameter for mappings
This mapping
- Type:
- $k.Mapping