Source to destination mapping
An object may not be explicitly selected for export. However, it may be identified as a dependency of one of the selected objects. The CCX-deployment API uses a map to associate these objects to appropriate objects in the destination environment and imports them.
When an instance of a class is selected for export, and when the
PropertyDefinitionObject for the instance contains a default-value object for the
PropertyDefaultObject property, the default-value object cannot be exported
automatically. The default-value object is registered in a map during export and you have to supply
a destination side object during import.
When a mapped object is encountered during the export operation, the source mapping information
is added to an ExportMap object in the CCX-deployment API. The Exporter object
contains a data member export_map which refers to the map object. The contents of
this map are saved as JSON to the deployment package.
"sourceObjects": [
{
"objectStoreName": "OS1",
"className": "MyDocument",
"tableRootClassName": "Document",
"id": "8ef2d210-0000-c132-83ee-897558c3943c",
"name": "My Document",
"path": "/Test Folder/My Document",
"paths": [
"/Test Folder/My Document"
],
"allIdentifiers": [
"8ef2d210-0000-c132-83ee-897558c3943c"
]
}
]
where, name and path refer to the name and path
property values for the Document source object that is exported. This helps in
understanding the object being mapped in source environment and the object it should map to in the
destination environment. ImportMap object is used as the
import_map member of the Importer module. The following code looks
up the target object that was specified in the source ExportMap and sets the
provided_target attribute of the target object to a new
TargetReference object that contains the target object's object store name,
document type, and target ID in the destination
environment:imp_map = importer.import_map
targ_obj = imp_map.target_object(obj_store_name, "Document", doc_id)
targ_obj.provided_target = TargetReference(targ_obj_store_name,
"Document", doc_targ_id) PropertyDefinitionObject for the instance contains a default-value object for the
PropertyDefaultObject property, the default-value object cannot be exported
automatically. The default-value object is an instance of a class that may also need to be exported
as a dependency of the class definition holding the property definition. It is not possible to
supply an instance as the target mapped object until the class is deployed for the first time. You
can specify whether unmapped objects can be treated as an error or ignored by using the import
option:ImportOptions(ignore_unmapped_objects=True) The default setting is to ignore unmapped objects. When this option is used, a warning is logged
when an unmapped object is encountered during the import. When it is not possible to supply a mapped
object because the class does not yet exist, you can run through the import one time with the
ignore_unmapped_objects option set to True (the default). After that you can create
an object to use as the target side of the mapping, fill in the target mapping using
TargetReference, and re-run the import.