Skip to content

ADL_IMPORT ​

ADL_IMPORT starts the ADL import.

Syntax ​

leo-grammar
CC "ImportExport" ADL_IMPORT fileName [ otherlib ]
							ModelSettings AttrProfSettings
							[ protfile:strValue ]
							[ import-versioned-file ] [ appmodels ]
							[ silent ] [ abort-with-mixed-libs ] .

ModelSettings :	[ existing-models:ExistingTreatment ]
				ModelSuboptions
				[ with-mgroups ] [ target-mgroupid:idValue ]

ModelSuboptions : [ update-interrefs ]
				[ delete-recordrows ]
				[ delete-unchanged-objects ]
				[ delete-unchanged-connectors ]
				[ adopt-version-into-name ]
				[ models-prefix:strValue ] [ models-suffix:strValue ]

AttrProfSettings : [ existing-attrprofs:ExistingTreatment ]
				AttrProfSuboptions
				[ with-apgroups ] [ target-apgroupid:idValue ]

AttrProfSuboptions : [ update-attrprofrefs ]
					[ delete-attrprof-recordrows ]
					[ attrprofs-prefix:strValue ] [ attrprofs-suffix:strValue ]

ExistingTreatment :	overwrite | paste | rename | ignore | increase-version

#--> RESULT ecode:intValue 
			errtext:strValue 
			modelids:tokenStr 
			attrprofids:tokenStr .
CC "ImportExport" ADL_IMPORT fileName [ otherlib ]
							ModelSettings AttrProfSettings
							[ protfile:strValue ]
							[ import-versioned-file ] [ appmodels ]
							[ silent ] [ abort-with-mixed-libs ] .

ModelSettings :	[ existing-models:ExistingTreatment ]
				ModelSuboptions
				[ with-mgroups ] [ target-mgroupid:idValue ]

ModelSuboptions : [ update-interrefs ]
				[ delete-recordrows ]
				[ delete-unchanged-objects ]
				[ delete-unchanged-connectors ]
				[ adopt-version-into-name ]
				[ models-prefix:strValue ] [ models-suffix:strValue ]

AttrProfSettings : [ existing-attrprofs:ExistingTreatment ]
				AttrProfSuboptions
				[ with-apgroups ] [ target-apgroupid:idValue ]

AttrProfSuboptions : [ update-attrprofrefs ]
					[ delete-attrprof-recordrows ]
					[ attrprofs-prefix:strValue ] [ attrprofs-suffix:strValue ]

ExistingTreatment :	overwrite | paste | rename | ignore | increase-version

#--> RESULT ecode:intValue 
			errtext:strValue 
			modelids:tokenStr 
			attrprofids:tokenStr .

Parameters ​

  • <main-parameter> (strValue) - fileName, the name of the ADL file.
  • existing-models (enumValue, optional) - if given, specifies the treatment for models that already exist in the database. Five options are possible: overwrite, paste, rename, ignore, increase-version
  • with-mgroups (modifier, optional) - if given, specifies that also the modelgroup hierarchy of the ADL file should be imported.
  • target-mgroupid (idValue, optional) - if given, specifies the target modelgroup for the imported models resp. modelgroups.
  • update-interrefs (modifier, optional) - if given, specifies that the model interreferences within the imported model set should be updated if the names of models were changed during import.
  • delete-recordrows (modifier, optional) - if given, specifies that within the existing-models option 'paste' existing record rows are deleted before new rows from the ADL file are inserted in an object. In all other existing-models options the argument is ignored.
  • delete-unchanged-objects (modifier, optional) - if given, specifies that within the existing-models option 'paste' already existing objects that are not changed by the import are deleted from the model. In all other existing-models options the argument is ignored.
  • delete-unchanged-connectors (modifier, optional) - if given, specifies that within the existing-models option 'paste' already existing connectors that are not changed by the import are deleted from the model. In all other existing-models options the argument is ignored.
  • adopt-version-into-name (modifier, optional) - if given, specifies that the new name of the model is generated from the old one + the version number
  • models-prefix (strValue, optional) - with this option a string value can be passed for renaming all imported models using this prefix.
  • models-suffix (strValue, optional) - with this option a string value can be passed for renaming all imported models using this suffix.
  • existing-attrprofs (enumValue, optional) - if given, specifies the treatment for attribute profiles that already exist in the database. Five options are possible: overwrite, paste, rename, ignore, increase-version.
  • with-apgroups (modifier, optional) - if given, specifies that also the attribute profile group hierarchy of the ADL file should be imported
  • target-apgroupid (idValue, optional) - if given, specifies the target attribute profile group for the imported attribute profiles resp. attribute profile groups
  • update-attrprofrefs (modifier, optional) - if given, specifies that the attributeprofile references within the imported model set should be updated if the names of attribute profiles were changed during import.
  • delete-attrprof-recordrows (modifier, optional) - if given, specifies that within the existing-attrprofs option 'paste' existing record rows are deleted before new rows from the ADL file are inserted in an attribute profile. In all other existing-attrprofs options this argument is ignored.
  • attrprofs-prefix (strValue, optional) - with this option a string value can be passed for renaming all imported attribute profiles using this prefix.
  • attrprofs-suffix (strValue, optional) - with this option a string value can be passed for renaming all imported attribute profiles using this suffix.
  • import-versioned-file (modifier, optional) - if given, allows to import ADL files from versioned libraries and risk inconsistent data (like broken references) in special cases.
  • appmodels (modifier, optional) - if given, performs an application model import. Note: Because the application model import does not allow any suboptions, better use ADL_IMPORT_APPMODELS instead!
  • protfile (strValue, optional) - if given, specifies a filename for a protocol file with log messages of the ADL import.
  • otherlib (modifier, optional) - if given, sets the option "import objects from other library".
  • silent (modifier, optional) - if given, imports in silent mode, i.e. no user interaction is necessary. A valid target-modelgroupid must be given. A target-apgroupid must be given unless with-attrprofgroups is used.
  • abort-with-mixed-libs (modifier, optional) - if given, importing an ADL file containing more than one libraries is aborted.

Returns ​

  • ecode (intValue) - specifies whether the adl file was imported successfully or not. ecode is set to 0 if the import worked, to 1 if not.
  • errtext (strValue) - contains an error text that could be displayed (in the case ecode = 1).
  • modelids (tokenStr) - is set to a list of the model ids that have been imported. The modelids are separated by spaces (" ").
  • attrprofids (tokenStr) - is set to a list of the attribute profile ids that have been imported. The attrprofids are separated by spaces (" ").

Details ​

If the argument silent is given, and the ADL file contains models or modelgroups also a target-modelgroupid has to be specified. If the ADL file contains attributeprofiles, additionally a target-attrprofgroupid has to be specified. Otherwise the import will yield an error.

See Also ​

ADL_EXPORT
ADL_IMPORT_APPMODELS

Examples ​

asc
CC "AdoScript" FILE_DIALOG open filter1:"ADL Filesss" type1:"**.adl"
IF (endbutton != "ok") {
   EXIT
}
CC "AdoScript" GET_TEMP_FILENAME

CC "ImportExport" ADL_IMPORT (path) otherlib
        existing-models:overwrite protfile:(filename)
        models-prefix:">" models-suffix:"<"
        attrprofs-prefix:">" attrprofs-suffix:"<"
        update-interrefs update-attrprofrefs
IF (ecode = 0) {
   CC "AdoScript" FREAD file:(filename)
   CC "AdoScript" VIEWBOX text:(text)
}
CC "AdoScript" FILE_DIALOG open filter1:"ADL Filesss" type1:"**.adl"
IF (endbutton != "ok") {
   EXIT
}
CC "AdoScript" GET_TEMP_FILENAME

CC "ImportExport" ADL_IMPORT (path) otherlib
        existing-models:overwrite protfile:(filename)
        models-prefix:">" models-suffix:"<"
        attrprofs-prefix:">" attrprofs-suffix:"<"
        update-interrefs update-attrprofrefs
IF (ecode = 0) {
   CC "AdoScript" FREAD file:(filename)
   CC "AdoScript" VIEWBOX text:(text)
}

At first, the file dialog is shown and the user selects an ADL file. At next, a temporary filename is retrieved. After that, the selected file is imported with mode "overwrite" and with full renaming plus reference updating. A protocol is written to the temporary file. If the import was successful, the content of the protocol file is displayed.

Versions and Changes ​

Available since ADOxx 1.3