On this page
Using the Generate command
You can enter the Generate command in the command line to generate a report.
To generate a report from the package scope
generate - project projectFileName -output outputFileName -template templateName -package packageNameList
To generate a report from the element scope
generate -project projectFileName -output outputFileName -template templateName -element elementNameList
To generate a report from the option specified in the properties file
generate -properties propertiesFileName
To generate an encrypted password for a server project
generate -generatepassword password
Description
The Generate command creates a report document with a received set of information from arguments and parameters. The information will then be generated as a report document to the specified output file. By default, an argument is the specified data of the invoked parameters. If the -properties option is specified, the argument is the name of a properties file. A properties file contains other parameters, along with the specified data of each parameter.
Synopsis
Command | Function |
---|---|
-project projectFileName | Specifies the project path as a file name. Note You can specify a project name and its branch after -project, for example:
|
-output outputFileName | Specifies the output file path as a file name. |
-template templateName | Specifies a template name used to generate a report document. Note
|
-templatePath templatePath | Specifies a template path used to generate a report document. Both absolute and relative paths are allowed for this command. The specified template file must have proper structure as it has been added through the Report Wizard dialog. Note If both -template and -templatePath are specified in the same command, the error will occur. |
-package packageNameList | Specifies the name of one or more packages in a project to be included in the report. A semicolon must separate multiple package entries (;). Warning: Duplicate qualified name Do not enter a duplicate name of a root Model package or its immediate child package to the -package option. |
-element elementQualifiedNameList | Specifies the qualified name of one or more elements from a project to be included in a report. A semicolon must separate element entries (;). |
-elementID | Specifies the element ID of one or more elements in a project to be included in the report. A semicolon must separate multiple element entries (;). Note
|
[options] | Command-line options. |
-properties propertiesFileName | Specifies the name of a properties file to utilize. Use only with -properties. |
-generatepassword password | Generates an encrypted password to be used with a properties file. |
Options
The command line feature supports a set of options useful in adding additional configuration possibilities.
Command | Function | |
---|---|---|
-report reportDataName|reportDataElementID | Specifies the name of a Report Data file or Report Data element. Note
| |
-autoImage 0|1|2|3 | Specifies how an image will be shown in a report document. The default value for this argument is 1.
| |
-imageFormat jpg|png|svg|emf|wmf | Specifies an image format in a report document. The default value for this argument is jpg.
| |
-recursive true|false | Specifies how to select a package in a project. The default value for this argument is true.
| |
-includeAuxiliary true|false | Selects packages, including auxiliary packages. The default value is false. | |
-outputOnBlankField stringValue | Shows a string value in a blank field in a report document. The default value for this argument is “”. | |
-category categoryName | Specifies a template category. | |
-fields[name=value] | Specifies a variable. | |
-spassword encryptedPassword | Specifies an encrypted password to log on to the server. This option is available only in a properties file. You can get encrypted password by entering this command below in command line prompt. generate -generatepassword "enter_your_password_here" | |
-upload serverAddress | Specifies a serverAddress consisting of a scheme, userInfo, host, port, and path to connect and upload a generated report to a server (see Upload generated report to server). Note In case the server has not been trusted, a message will be displayed in the command line, asking you to choose to accept or reject the server certificate. | |
-trustAll true|false | Trusts any certificate of the specific publishing server in -upload command. The default value is false. If the value is true, the certificate will be trusted without asking any questions. | |
-overwrite true|false | Overwrites any previously generated files. The default value for this argument is true.
If you type ‘y’ or ‘yes’, the Report Wizard will generate a new report that replaces the previous one. If you type ‘n’ or ‘no’, the Report Wizard will not generate a report and terminate the process. | |
-pversion projectVersion | Specifies a server project version. | |
-ssl true|false | Specifies if a Secured Connection (SSL) is used. The default value is false.
| |
-tag tagValue | An additional argument to generate reports from a server project by specifying a server project tag name. The tagValue is non-case sensitive. More than one project version may be returned from specifying one tag value. Hence, one report generation process may generate multiple reports. You cannot use this command with –pversion. | |
-incremental true|false | Specifies the incremental method. The default value is true.
| |
-leaveprojectopen | Leaves the project open per property file after generating the report, in a series of report generation. The default value is false. | |
-loadmodule true|false | Loads all unloaded modules in a project. The default value is false.
| |
-projectpassword projectPassword | Specifies a password for the protected Teamwork Cloud project. The password is required to open a protected Teamwork Cloud project for generating a report. |
Using command line
You can use the command line on Windows, Linux, or Unix.
To use the command line on Windows
- Run a command line console. In the Console window, go to the local installation of the modeling tool's application.
- Go to the plugins\com.nomagic.magicdraw.reportwizard folder, and type the command line there.
To use the command line on Linux or Unix
- Run a terminal (command line console). In the Console window, go to the local installation of the modeling tool's application.
- Go to the plugins\com.nomagic.magicdraw.reportwizard folder, and type the command line there.
See the following examples of command line on Windows and Linux or Unix respectively.
generate -properties "C:\\output\\prop.properties"
generate -project "C:\\MagicDraw\\samples\\diagrams\\class diagram.mdzip" -output "C:\\output\\output.rtf" -template "Class Specification Report" -package "Model" -report "Built-in" -autoImage 1 -imageFormat png -recursive false -outputOnBlankField "#NA" -fields "[Author=NMA][Company=No Magic]"
./generate.sh -project "/home/project/project.mdzip" -output "/home/output/output.rtf" -template "Class Specification Report" -package "Model" -report "Built-in" -autoImage 1 -imageFormat png -recursive false -outputOnBlankField "#NA" -fields "[Author=NMA][Company=No Magic]"
Generating multiple reports
You can open multiple projects and generate multiple reports before the modeling tool shuts down. The generate command with the -properties option accepts multiple properties files as shown below.
generate -properties <file1.properties> <file2.properties> <file3.properties>... |
For example
generate -properties “property1.properties” “property2.properties” |
Note
Template, output, package, and project are the required data for each property file.
The following parameters are reset when finishing generating a report for each property file. Other parameter values affect subsequent property files, if there are no overridden values.
-project
- -output
- -template
- -templatePath
- -tag
- -pVersion
- -recursive
- -category
- -includeAuxiliary
Tip
When large-size projects need to be loaded and closed for many property files, it takes longer time to generate reports. In this case, you can use -leaveprojectopen as an option to reduce memory for loading each project when starting to generate a new report.
generate -leaveprojectopen true -properties “property1.properties” “property2.properties”
Note
-leaveprojectopen needs to be specified before -properties.