Instance export

Syntax

$objects.instanceExport(
    name: "my-export.objects.xml", 
    excludes: [`my.module:MyType#excludedRef`], 
    includes: [`my.module:MyType#includedRef`])

Description

Exports a set of object instances to XML. The generated format can be read in again later using the instanceImport() function and instantiated into objects. By default, all objects referenced from the input objects via composition references are also exported. If an object from the object graph exported in this way is referenced via a regular reference, then this object must either also be included in the export via a composition reference, or the regular reference must be treated as a composition reference via the includes parameter, or excluded from the export via the excludes parameter.

Parameters

name Type Type Description Mandatory Default
objects Set of objects The set of objects to be exported. Based on these objects, all objects that can be accessed via composition references are also exported. Yes -
name Character string The file name of the export file no "<Datum>-<Typ>.objects.xml"
excludes Set of attributes and/or types All attributes specified in this set are excluded from the export. If a type is specified, all attributes of this type are excluded. no []
includes Set of attributes and/or types All references specified in this set are treated as compositions and the objects referenced by them are included in the export. If a class is specified, then all references that have this class as a type are included in the export. no []

Return value

Type: Binary value

The XML file generated from the object graph.

Examples

All accounts as XML export

all(`tl.accounts:Person`)
    .instanceExport(
        name: "all-accounts.xml",
        includes: [
            `tl.accounts:Person#representativeGroup`, 
            `tl.accounts:Person#contact`])

Output: XML file with all accounts in the system including their contacts and deputy groups.