Pré. | Proc. |
Project Class
The Project interface can be accessed from the Repository using GetProjectInterface(). The returned interface provides access to the XML-based Enterprise Architect Automation Interface. Use this interface to get XML for the various internal elements and to run some utility functions to perform tasks such as load diagrams or run reports.
Project Attributes
Attribute |
Remarks |
See also |
---|---|---|
ObjectType |
ObjectType Notes: Read only Distinguishes objects referenced through a Dispatch interface. |
ObjectType |
Notes
- The Project methods listed here all require input GUIDs in XML format; use GUIDtoXML to change the Enterprise Architect GUID to an XML GUID
Learn more
Project Methods
Method |
Remarks |
See also |
---|---|---|
BuildExecutableStatemachine (string ElementGUID, string ExtraOptions) |
Boolean Notes: Builds Executable StateMachine code for an <<executable statemachine>> Artifact element. Parameters:
|
|
CancelValidation () |
Void Notes: Cancels a validation process. |
Model Validation |
CanValidate () |
Boolean Notes: Returns a value to indicate that the Model Validation component is loaded. |
|
CreateBaseline (string PackageGUID, string Version, string Notes) |
Boolean Notes: Creates a Baseline of a specified Package. Parameters:
|
|
CreateBaselineEx (string PackageGUID, string Version, string Notes, EA.CreateBaselineFlag Flags) |
Boolean Notes: Creates a Baseline of a specified Package, with a flag to exclude Package contents below the first level. Parameters:
|
Creating Baselines CreateBaselineFlag |
DefineRule (string CategoryID, EA.EnumMVErrorType ErrorType, string ErrorMessage) |
String Notes: Defines the individual rules that can be performed during model validation. It must be called once for each rule from the EA_OnInitializeUserRules broadcast handler. The return value is a RuleId, which can be used for reference purposes when an individual rule is executed by Enterprise Architect during model validation. See the Model Validation Example for a detailed example of the use of this method. Parameters:
|
EA_OnInitializeUserRules Model Validation Example Project Class |
DefineRuleCategory (string CategoryName) |
String Notes: Defines a category of rules that can be performed during model validation (there is typically one category per Add-In). It must be called once from the EA_OnInitializeUserRules broadcast handler. The return value is a CategoryId that must to be passed to the DefineRule method. See the Model Validation Example for a detailed example of the use of this method. Parameters:
|
EA_OnInitializeUserRules Project Class Model Validation Example |
DeleteBaseline (string BaselineGUID) |
Boolean Notes: Deletes a Baseline, identified by the BaselineGUID, from the repository. If the repository is configured to store Baselines in a Reusable Asset Service Registry, then it is not possible to delete the Baseline and a False value is returned. Parameters:
|
|
DoBaselineCompare (string PackageGUID, string Baseline, string ConnectString) |
String Notes: Performs a Baseline comparison using the supplied Package GUID and Baseline GUID (obtained in the result list from GetBaselines). Optionally you can include the connection string required to find the Baseline if it exists in a different model file. This method returns a log file of the status of all elements found and compared in the difference procedure. You can use this log information as input to DoBaselineMerge - automatically merging information from the Baseline. Parameters:
|
Project Class |
DoBaselineMerge (string PackageGUID, string Baseline, string MergeInstructions, string ConnectString) |
String Notes: Performs a batch merge based on instructions contained in an XML file (MergeInstructions). You can supply an optional connection string if the Baseline is located in another model. In the MergeInstructions file, each MergeItem node supplies the GUID of a differenced item from the XML difference log. As the merge is uni-directional and actioned in only one possible way, no additional arguments are required. Enterprise Architect chooses the correct procedure based on the 'Difference' results. <Merge> <MergeItem guid="{XXXXXX}" /> <MergeItem guid="{XXXXXX}" /> </Merge> Alternatively, you can supply a single Mergeitem with a GUID of RestoreAll. In this case, Enterprise Architect batch-processes ALL differences. <Merge> <MergeItem guid="RestoreAll" changed="true" baselineOnly="true" modelOnly="true" moved="true" fullRestore="false" /> </Merge> Parameters:
|
Project Class |
EnumDiagramElements (string DiagramGUID) |
protected abstract: String Notes: Gets an XML list of all elements in a diagram. Parameters:
|
|
EnumDiagrams (string PackageGUID) |
protected abstract: String Notes: Gets an XML list of all diagrams in a specified Package. Parameters:
|
|
EnumElements (string PackageGUID) |
protected abstract: String Notes: Gets an XML list of elements in a specified Package. Parameters:
|
|
EnumLinks (string ElementGUID) |
protected abstract: String Notes: Gets an XML list of connectors for a specified element. Parameters:
|
|
EnumPackages (string PackageGUID) |
protected abstract: String Notes: Gets an XML list of child Packages inside a parent Package. Parameters:
|
|
EnumProjects () |
protected abstract: String Notes: Gets a list of projects in the current file; corresponds to Models in Repository. |
Repository Class |
EnumViewEx (string ProjectGUID) |
protected abstract: String Notes: Gets a list of Views in the current project. Parameters:
|
|
EnumViews () |
protected abstract: String Notes: Enumerates the Views for a project. Returned as an XML document. |
|
Exit () |
protected abstract: String Notes: Exits the current instance of Enterprise Architect; this function is maintained for backward compatibility and should never be called. Enterprise Architect automatically exits when you are no longer using any of the provided objects. |
|
ExportPackageXMI (string PackageGUID, enumXMIType XMIType, long DiagramXML, long DiagramImage, long FormatXML, long UseDTD, string FileName) |
protected abstract: String Notes: Exports XMI for a specified Package. Parameters:
|
XMIType |
ExportPackageXMIEx (string PackageGUID, enumXMIType XMIType, long DiagramXML, long DiagramImage,
|
protected abstract: String Notes: Exports XMI for a specified Package, with a flag to determine whether the export includes Package content below the first level. Parameters:
|
Configure Packages XMIType ExportPackageXMIFlag |
ExportProjectXML (string DirectoryPath) |
Boolean Notes: Exports the entire current project to Native XML files in the specified directory. The contents of the directory will be deleted prior to exporting the project data Parameters:
|
|
ExportReferenceData (string FileName, string Tables) |
Boolean Notes: Exports Reference Data. Parameters:
|
|
GenerateBuildRunExecutableStateMachine (string ElementGUID, string ExtraOptions) |
Boolean Notes: Generates, builds and runs Executable StateMachine code for an <<executable statemachine>> Artifact element, which will start simulation of the StateMachine. Parameters:
|
|
GenerateClass (string ElementGUID, string ExtraOptions) |
Boolean Notes: Generates the code for a single Class. Parameters:
|
|
GenerateDiagramFromScenario (string ElementGUID, EnumScenarioDiagramType DiagramType, long OverwriteExistingDiagram) |
Boolean Notes: Generates various diagrams from the scenario specification of an element. Parameters:
|
ScenarioDiagramType |
GenerateElementDDL (string ElementGUID, string FileName, string ExtraOptions) |
Boolean Notes: Generates DDL for an element using the options that are currently set on the Generate DDL screen. |
|
GenerateExecutableStatemachine (string ElementGUID, string ExtraOptions) |
Boolean Notes: Generates Executable StateMachine code for an <<executable statemachine>> Artifact element. Parameters:
|
|
GeneratePackage (string PackageGUID,
|
Boolean Notes: Generates the code for all Classes within a Package. For example: recurse=1;overwrite=1;dir=C:\ Parameters:
|
|
GeneratePackageDDL (string PackageGUID, string FileName, string ExtraOptions) |
Boolean Notes: Generates DDL for all elements in a Package using the options that are currently set on the Generate DDL screen. |
|
GenerateTestFromScenario (string ElementGUID, EnumScenarioTestType TestType) |
Boolean Notes: Generates a Vertical Test Suite, a Horizontal Test Suite, an Internal test or an External test from the scenario specification of an element. Parameters:
|
Generate Test Cases ScenarioTestType |
GenerateWSDL(string WSDLComponentGUID, string Filename, string Encoding, string ExtraOptions) |
Boolean Notes: Generates WSDL for the specified WSDL stereotyped Component. Parameters:
|
WSDL |
GenerateXSD (string PackageGUID,
|
Boolean Notes: Creates an XML schema for a Package, specified by its GUID. Returns True on success. Parameters:
|
|
GetAllDiagramImagesAndMap (string Directory) |
Boolean Notes : Saves the image and image-map for every diagram in the model, in the specified directory location. The image files will be saved in PNG format and each will have the diagram GUID as the image name. The image-map files will be saved as .txt files and each will have the diagram GUID as the image map name. The 'Auto Create Diagram Image and Image Map' option must be selected in the model options for this function to save the images and image-maps. Parameters:
|
Cloud Page |
GetBaselines (string PackageGUID, string ConnectString) |
String Notes: Returns a list (in XML format) of Baselines associated with the supplied Package GUID. Parameters:
|
|
GetDiagram (string DiagramGUID) |
protected abstract: String Notes: Gets the diagram details, in XML format. Parameters:
|
|
GetDiagramImageAndMap (string DiagramGUID, string Directory) |
Boolean Notes: Saves the image and image-map for the diagram with the specified GUID, in the specified directory location. The image will be saved in PNG format and will have the DiagramGUID as the image name. The image-map will be saved as a .txt file and will have the DiagramGUID as the image-map name. The 'Auto Create Diagram Image and Image Map' option must be selected in the model-specific options for this function to save the image and image-map. Parameters:
|
Cloud Page |
GetElement (string ElementGUID) |
protected abstract: String Notes: Gets XML for the specified element. Parameters:
|
|
GetElementConstraints (string ElementGUID) |
protected abstract: String Notes: Gets constraints for an element, in XML format. Parameters:
|
|
GetElementEffort (string ElementGUID) |
protected abstract: String Notes: Gets efforts for an element, in XML format. Parameters:
|
|
GetElementFiles (string ElementGUID) |
protected abstract: String Notes: Gets metrics for an element, in XML format. Parameters:
|
|
GetElementMetrics (string ElementGUID) |
protected abstract: String Notes: Gets files for an element, in XML format. Parameters:
|
|
GetElementProblems (string ElementGUID) |
protected abstract: String Notes: Gets a list of issues (problems) associated with an element, in XML format. Parameters:
|
|
GetElementProperties (string ElementGUID) |
protected abstract: String Notes: Gets Tagged Values for an element, in XML format. Parameters:
|
|
GetElementRequirements (string ElementGUID) |
protected abstract: String Notes: Gets a list of requirements for an element, in XML format. Parameters:
|
|
GetElementResources (string ElementGUID) |
protected abstract: String Notes: Gets a list of resources for an element, in XML format. Parameters:
|
|
GetElementRisks (string ElementGUID) |
protected abstract: String Notes: Gets a list of risks associated with an element, in XML format. Parameters:
|
|
GetElementScenarios (string ElementGUID) |
protected abstract: String Notes: Gets a list of scenarios for an element, in XML format. Parameters:
|
|
GetElementTests (string ElementGUID) |
protected abstract: String Notes: Gets a list of tests for an element, in XML format. Parameters:
|
|
GetFileNameDialog (string Filename, string FilterString, long FilterIndex, long Flags, string InitialDirectory,
|
String Notes: Opens a standard 'File Open' or 'Save As' dialog and returns a string containing the full path to the selected file on success. Returns an empty string if the dialog was canceled. For example: Filename = "" FilterString = "CSV Files (*.csv)|*.csv|All Files (*.*)|*.*||" Filterindex = 1 Flags = &H2 'OFN_OVERWRITEPROMPT InitialDirectory = "" OpenOrSave = 1 filepath = Project.GetFileNameDialog (Filename, FilterString, Filterindex, Flags, InitialDirectory, OpenOrSave) In this example, the 'Save As' dialog will prompt for a CSV file. Parameters:
|
|
GetLastError () |
protected abstract: String Notes: Returns a string value describing the most recent error that occurred in relation to this object. |
|
GetLink (string LinkGUID) |
protected abstract: String Notes: Gets connector details, in XML format. Parameters:
|
|
GUIDtoXML (string GUID) |
String Notes: Changes an internal GUID to the form used in XML. Parameters:
|
|
ImportDirectory (string PackageGUID, string Language, string DirectoryPath, string ExtraOptions) |
Boolean Notes: Imports a source code directory into the model. Parameters:
|
|
ImportFile (string PackageGUID, string Language, string FileName, string ExtraOptions) |
Boolean Notes: Imports an individual file or binary module into the model, in a Package per namespace style import. Parameters:
|
|
ImportPackageXMI (string PackageGUID, string Filename, long ImportDiagrams, long StripGUID) |
String Notes: Imports an XMI file at a point in the tree. Returns an empty string if successful, or returns an error message on failure. Parameters:
|
|
ImportReferenceData (string FileName, string DataSets) |
Boolean Notes: Imports Reference Data. Parameters:
|
|
ImportVisualStudioSolution (string PackageGUID, string SolutionPath) |
Boolean Notes: Imports a Visual Studio Solution into the model. Parameters:
|
|
LayoutDiagram (string DiagramGUID, long LayoutStyle) |
Boolean Notes: Deprecated. Use LayoutDiagramEx. Calls the function to automatically layout a diagram in hierarchical fashion. It is only recommended for Class and Object diagrams. Parameters:
|
|
LayoutDiagramEx (string DiagramGUID, long LayoutStyle, long Iterations, long LayerSpacing, long ColumnSpacing, boolean SaveToDiagram) |
Boolean Notes: Calls the function to automatically layout a diagram in hierarchical fashion. It is only recommended for Class and Object diagrams. LayoutStyle accepts these options
- lsDiagramDefault - lsProgramDefault
- lsCycleRemoveGreedy - lsCycleRemoveDFS
- lsLayeringLongestPathSink - lsLayeringLongestPathSource - lsLayeringOptimalLinkLength
- IsInitializeNaive - IsInitializeDFSOut - IsInitializeDFSIn
- lsCrossReduceAggressive
- lsLayoutDirectionUp - lsLayoutDirectionDown - lsLayoutDirectionLeft - lsLayoutDirectionRight Parameters:
|
ConstLayoutStyles |
LoadControlledPackage (string PackageGUID) |
String Notes: Loads a Package that has been marked and configured as controlled. The filename details are stored in the Package control data. Parameters:
|
|
LoadDiagram (string DiagramGUID) |
protected abstract: Boolean Notes: Loads a diagram by its GUID. Parameter:
|
Project Class |
LoadProject (string FileName) |
protected abstract: Boolean Notes: Loads an Enterprise Architect project file. Do not use this method if you have accessed the Project interface from the Repository, which has already loaded a file. Parameters:
|
|
Migrate (string GUID, string SourceType, string DestinationType) |
Void Notes: Migrates a model (or part of a model) from one BPMN, ArchiMate, UPDM or SysML format to an upgraded format. Parameters:
|
|
MigrateToBPMN11 (string GUID,
|
Void Notes: Migrates every BPMN 1.0 construct in a Package or an element (including elements, attributes, diagrams and connectors) to BPMN 1.1. Parameters
Migrating to BPEL is possible in the Ultimate and Unified Editions of Enterprise Architect. |
|
ProjectTransfer (string SourceFilePath,
|
Boolean Notes: Transfers the project from a source .eap file or DBMS to a target .eap file, .eapx file, .feap file, .qea file or .qeax file. Parameters:
In automation, the target file must not previously exist. Enterprise Architect creates a new, empty Base.* file using the specified target name and extension, and transfers the source project into it. |
|
PublishResult (string CategoryID,
|
String Notes: Returns the results of each rule that can be performed during model validation. It must be called once for each rule from the EA_OnInitializeUserRules broadcast handler. The return value is a RuleId, which can be used for reference purposes when an individual rule is executed by Enterprise Architect during model validation. See the Model Validation Example for a detailed example of the use of this method. Parameters:
|
EA_OnInitializeUserRules Model Validation Example Project Class |
PutDiagramImageOnClipboard (string DiagramGUID,
|
protected abstract: Boolean Notes: Copies an image of the specified diagram to the clipboard. Parameters:
|
|
PutDiagramImageToFile (string Diagram GUID,
|
protected abstract: Boolean Notes: Saves an image of the specified diagram to file. Parameters:
|
|
ReloadProject () |
protected abstract: Boolean Notes: Reloads the current project. This is a convenient method to refresh the current loaded project (in case of outside changes to the .eap file). |
|
RunExecutableStatemachine (string ElementGUID, string ExtraOptions) |
Boolean Notes: Runs Executable StateMachine code for an <<executable statemachine>> Artifact element, which will start simulation of the StateMachine Parameters:
|
|
RunModelSearch (string Search, string SearchTerm, bool ShowInEA) |
Void Notes: Invokes the Model Search component. Parameters:
|
Model Search Repository Class |
RunReport (string PackageGUID,
|
protected abstract: Void Notes: Runs a named document report. Parameters:
|
Document Generator Interface Package Generate Documentation Virtual Documents |
RunHTMLReport (string PackageGUID,
|
String Notes: Runs an HTML report (as for 'Documentation | Publish as HTML' when you click on a Package in the Browser window and on the icon). Parameters:
|
Create an HTML Report Model Documents and Report Packages |
SaveControlledPackage (string PackageGUID) |
String Notes: Saves a Package that has been configured as a controlled Package, to Native/XMI format. Only the Package GUID is required, Enterprise Architect picks the rest up from the Package control information. Parameter:
|
|
SaveDiagramImageToFile (string Filename) |
protected abstract: String Notes: Saves a diagram image of the current diagram to file. Parameters:
|
|
ShowWindow (long Show) |
protected abstract: Void Notes: Shows or hides the Enterprise Architect User Interface. Parameters:
|
|
SynchronizeClass (string ElementGUID,
|
Boolean Notes: Synchronizes a Class with the latest source code. Parameters:
|
|
SynchronizePackage (string PackageGUID,
|
Boolean Notes: Synchronizes each Class in a Package with the latest source code. Parameters:
|
|
TransformElement (string TransformName,
|
Boolean Notes: Transforms an element into a Package. Parameters:
|
|
TransformPackage (string TransformName,
|
Boolean Notes: Runs a transformation on the contents of a Package. Parameters:
|
|
ValidateDiagram (string DiagramGUID) |
Boolean Notes: Invokes the Enterprise Architect Model Validation component, then validates the diagram (for correctness) and the elements and connectors within the diagram. Output can be viewed through 'Start > Application > Design > System Output > Model Validation'. Returns a Boolean value to indicate the success or failure of the process, regardless of the results of the validation. Parameters:
|
Model Validation |
ValidateElement (string ElementGUID) |
Boolean Notes: Invokes the Enterprise Architect Model Validation component, then validates the element and all child elements, diagrams, connectors, attributes and operations. Output can be viewed through 'Start > Application > Design > System Output > Model Validation'. Returns a Boolean value to indicate the success or failure of the process, regardless of the results of the validation. Parameters:
|
|
ValidatePackage (string PackageGUID) |
Boolean Notes: Invokes the Enterprise Architect Model Validation component, then validates the Package and all sub-Packages, elements, connectors and diagrams within it. Output can be viewed through 'Start > Application > Design > System Output > Model Validation'. Returns a Boolean value to indicate the success or failure of the process, regardless of the results of the validation. Parameters:
|
|
XMLtoGUID (string GUID) |
String Notes: Changes a GUID in XML format to the form used inside Enterprise Architect. Parameters:
|