Pré. | Proc. |
Package Class
A Package object corresponds to a Package element in the Enterprise Architect Browser window. Packages can be accessed either through the Repository Models collection (a Model is a special form of Package) or through the Packages collection.
Note that a Package has an Element object as an attribute; this corresponds to an Enterprise Architect Package element in the t_object table and is used to associate additional information (such as scenarios and constraints) with the logical Package.
To set additional information for a Package, reference the Element object directly. Also note that if you add a Package to a diagram, you should add an instance of the element (not the Package itself) to the DiagramObject Class for a diagram.
Associated table in repository
t_package
Learn more
- Repository Class
- Package Class
- Package Version Control Options
- Resynchronize the Status of Version Controlled Packages
- Report Deletion of Cross Package References
Package Attributes
Attribute |
Remarks |
See also |
---|---|---|
Alias |
String Notes: Read only Alias |
|
BatchLoad |
Long Notes: Read/Write Flag to indicate that the Package is batch loaded during batch import from controlled Packages. Not currently used. |
|
BatchSave |
Long Notes: Read/Write Boolean value to indicate whether the Package is included in the batch XMI export list or not. |
|
CodePath |
String Notes: Read/Write The path where associated source code is found. Not currently used. |
|
Connectors |
Collection Notes: Read only The collection of connectors. |
Collection Class |
Created |
Date Notes: Read/Write Date the Package was created. |
|
Diagrams |
Collection Notes: Read only A collection of diagrams contained in this Package. |
Collection Class |
Element |
Element Notes: Read only The associated element object; use to get/set common information such as Stereotype, Complexity, Alias, Author, Constraints, Tagged Values and Scenarios. |
Element Class |
Elements |
Collection Notes: Read only A collection of elements that belong to this Package. |
Collection Class |
Flags |
String Notes: Read/Write Extended information about the Package. |
|
IsControlled |
Boolean Notes: Read/Write Indicates if the Package has been marked as Controlled. |
|
IsModel |
Boolean Notes: Read only Indicates if the Package is a model or a Package. |
|
IsNamespace |
Boolean Notes: Read/Write True indicates that 'Package is a Namespace root'. Use 0 and 1 to set False and True. |
|
IsProtected |
Boolean Notes: Read/Write Indicates if the Package has been marked as 'Protected'. |
|
IsVersionControlled |
Boolean Notes: Read only Indicates whether or not this Package is under Version Control. |
|
LastLoadDate |
Date Notes: Read/Write The date XML was last loaded for the Package. |
|
LastSaveDate |
Date Notes: Read/Write The date XML was last saved from the Package. |
|
LogXML |
Boolean Notes: Read/Write Indicates if XMI export information is to be logged. |
|
Modified |
Date Notes: Read/Write Date the Package was last modified. |
|
Name |
String Notes: Read/Write The name of the Package. |
|
Notes |
String Notes: Read/Write Notes about this Package. |
|
ObjectType |
ObjectType Notes: Read only Distinguishes objects referenced through a Dispatch interface. |
ObjectType |
Owner |
String Notes: Read/Write. The Package owner when using controlled Packages. |
|
PackageGUID |
Variant Notes: Read only The global Package ID; valid across models. |
|
PackageID |
Long Notes: Read only The local Package ID number. Valid only in this model file. |
|
Packages |
Collection Notes: Read only A collection of contained Packages that can be walked through. |
Collection Class |
ParentID |
Long Notes: Read/Write The ID of the Package that is the parent of this one. 0 indicates that this Package is a model (that is, it has no parent). |
|
StereotypeEx |
String Notes: Read/Write All the applied stereotypes of the element in a comma-separated list. Reading the value will provide the stereotype name only; assigning the value accepts either fully-qualified or simple names. When setting this attribute, LastError (from the GetLastError method) will be non-empty on error. |
|
TreePos |
Long Notes: Read/Write The relative position in the tree compared to other Packages (use to sort Packages). |
|
TypeInfoProperties |
Notes: Read only Returns an interface pointer of TypeInfoProperties. |
TypeInfoProperties Class |
UMLVersion |
String Notes: Read/Write The UML version for XMI export purposes. |
|
UseDTD |
Boolean Notes: Read/Write Indicates if a DTD is to be used when exporting XMI. |
|
Version |
String Notes: Read/Write The version of the Package. |
|
XMLPath |
String Notes: Read/Write The path to which the XML is saved when using controlled Packages. |
Package Methods
Method |
Remarks |
See also |
---|---|---|
ApplyGroupLock (string aGroupName) |
Boolean Notes: Applies a group lock to the Package object, for the specified group, on behalf of the current user. User Security applies to the use of this function; if the user does not have permission to apply or release locks on elements, diagrams and Packages, the operation will fail. Returns True if the operation is successful; returns False if the operation is unsuccessful. Use GetLastError() to retrieve error information. Parameters:
|
|
ApplyGroupLockRecursive (string aGroupName, boolean IncludeElements, boolean IncludeDiagrams, boolean IncludeSubPackages) |
Boolean Notes: Applies a group lock to the Package object, object, and all of the Package, diagrams and elements contained within that Package, for the specified group, on behalf of the current user. User Security applies to the use of this function; if the user does not have permission to apply or release locks on elements, diagrams and Packages, the operation will fail. Returns True if the operation is successful; returns False if the operation is unsuccessful. Use 'GetLastError()' to retrieve error information. Parameters
|
|
ApplyUserLock () |
Boolean Notes: Applies a user lock to the Package object for the current user. User Security applies to the use of this function; if the user does not have permission to apply or release locks on elements, diagrams and Packages, the operation will fail. Returns True if the operation is successful; returns False if the operation is unsuccessful. Use 'GetLastError()' to retrieve error information. |
|
ApplyUserLockRecursive (boolean IncludeElements, boolean IncludeDiagrams, boolean IncludeSubPackages) |
Boolean Notes: Applies user locks to the Package object, and all of the Packages, diagrams and elements contained within that Package. User Security applies to the use of this function; if the user does not have permission to apply or release locks on elements, diagrams and Packages, the operation will fail. Returns True if the operation is successful; returns False if the operation is unsuccessful. Use GetLastError() to retrieve error information. Parameters
|
|
Clone |
LDISPATCH Notes: Inserts a copy of the Package into the same parent as the original Package. Returns the newly-created Package. |
|
FindObject (string DottedID) |
LPDISPATCH Notes: Returns a Package, element, attribute or operation matching the parameter DottedID. If the DottedID is not found, an error is returned: Can't find matching object. Parameters
|
|
GetLastError() |
String Notes: Returns a string value describing the most recent error that occurred in relation to this object. |
|
GetTXAlias (string Code, long Flag) |
String Notes: Returns the Alias of the element for a given language. Parameters
|
Translate Page |
GetTXNote (string Code, long Flag) |
String Returns the Notes of the element for a given language. Parameters
|
Translate Page |
SetTXAlias (string Code, string Translation) |
String Notes - Set the translated Alias of the element for a given language.
|
Translate Page |
SetTXName (string Code, string Translation) |
String Notes - Set the translated name of the element for a given language.
|
Translate Page |
SetTXNote (string Code, string Translation) |
String Notes - Set the translated Notes of the element for a given language.
|
Translate Page |
GetTXName (string Code, long Flag) |
String Notes: Returns the name of the element for a given language. Parameters
|
Translate Page |
ReleaseUserLock () |
Boolean Notes: Releases user locks and group locks from the Package object, and all of the Packages, diagrams and elements contained within that Package. User Security applies to the use of this function; if the user does not have permission to apply or release locks on elements, diagrams and Packages, the operation will fail. Returns True if the operation is successful; returns False if the operation is unsuccessful. Use GetLastError() to retrieve error information. |
|
ReleaseUserLockRecursive (boolean IncludeElements,
|
Boolean Notes: Releases user locks from the Package object, and all of the Packages, diagrams and elements contained within that Package. User Security applies to the use of this function; if the user does not have permission to apply or release locks on elements, diagrams and Packages, the operation will fail. Returns True if the operation is successful; returns False if the operation is unsuccessful. Use GetLastError() to retrieve error information. Parameters IncludeElements: Boolean - Recursively release user locks from child elements IncludeDiagrams: Boolean - Recursively release user locks from child diagrams IncludeSubPackages: Boolean - Recursively release user locks from child Packages |
|
SetReadOnly (boolean ReadOnly, boolean IncludeSubPkgs) |
Void Notes: Sets a Package Flag to mark a Package as ReadOnly=1. If Project Security is enabled, the user must have 'Configure Packages' permission to use this method. Throws an exception if the operation fails due to the user not having 'Configure Packages' permission; use 'GetLastError()' to retrieve error information. Parameters
False, any Read Only flag is removed from the Package True, a Read Only flag is applied to the Package
False, only the flag on the object Package is set or cleared True, flags are set (or cleared, according to the ReadOnly parameter) for the object Package plus all of the nested sub-Packages that it contains When working with Version Controlled Packages, the Read Only flag can be applied to Packages whether they are checked-in or checked-out. User Security applies to setting this flag - if you are prevented from editing the Package, you are also prevented from setting the flag. |
|
Update () |
Boolean Notes: Updates the current Package object after modification or appending a new item. If False is returned, check the 'GetLastError()' function for more information. Note that a Package object also has an element component that must be taken into account; the Package object contains information about the Package attributes such as hierarchy or contents. The element attribute contains information about, for example, Stereotypes, Constraints or Files - all the attributes of a typical element. |
|
VersionControlAdd (string ConfigGuid, string XMLFile, string Comment, boolean KeepCheckedOut) |
Void Notes: Places the Package under Version Control, using the specified Version Control Configuration and the specified XMI filename. Throws an exception if the operation fails; use GetLastError() to retrieve error information. It is recommended that the Package be saved using Update() before calling VersionControlAdd(), so that any outstanding changes are not lost. Parameters
|
|
VersionControlCheckin (string Comment) |
Void Notes: Perform checkin of the Version Controlled Package (also see VersionControlCheckinEx). Throws an exception if the operation fails; use GetLastError() to retrieve error information. Parameters
|
|
VersionControlCheckinEx (string Comment, boolean PreserveCrossPkgRefs) |
Void Notes: Perform check-in of the Version Controlled Package. Throws an exception if the operation fails; use GetLastError() to retrieve error information. Parameters
|
|
VersionControlCheckout (string Comment) |
Void Notes: Perform checkout of the Version Controlled Package. Throws an exception if the operation fails; use GetLastError() to retrieve error information. Parameters:
When working in an environment that uses a Private Model deployment and your model contains a significant number of cross-Package references, it is recommended that you invoke the Repository.ScanXMIAndReconcile() method from time to time, following the re-importation of controlled Packages - for example, after using Package.VersionControlGetLatest() to update a number of Packages, or after performing a number of Package check-outs. |
|
VersionControlGetLatest (boolean ForceImport) |
Void Notes: Updates the local working copy of the Package file associated with the object Package, before re-importing the Package data from the Package file. Parameters:
See also the menu option 'Version Control | Get Latest'. When working in an environment that uses a Private Model deployment and your model contains a significant number of cross-Package references, it is recommended that you invoke the 'Repository.ScanXMIAndReconcile()' method from time to time, following the re-importation of controlled Packages - for example, after using 'Package.VersionControlGetLatest()' to update a number of Packages, or after performing a number of Package check-outs. |
|
VersionControlGetStatus () |
Long Notes: Returns the Version Control status of the Package, as recorded in the current project database. Throws an exception if the operation fails; use GetLastError() to retrieve error information. Return value maps to this enumerated type: enum EnumCheckOutStatus { csUncontrolled = 0, csCheckedIn, csCheckedOutToThisUser, csReadOnlyVersion, csCheckedOutToAnotherUser, csOfflineCheckedIn, csCheckedOutOfflineByUser, csCheckedOutOfflineByOther, csDeleted, };
|
|
VersionControlPutLatest (string CheckInComment) |
Void Notes: Perform a checkin of the Version Controlled Package, whilst keeping the Package checked-out. Throws an exception if the operation fails; use GetLastError() to retrieve error information. When a Package that was previously marked as Checked Out Offline, is successfully 'Put' (checkedin) to Version Control, that Package's flags are updated to clear the Checked Out Offline indicator. Parameters:
|
|
VersionControlRemove () |
Void Notes: Removes Version Control from the Package. Throws an exception if the operation fails; use 'GetLastError()' to retrieve error information. |
|
VersionControlResynchPkgStatus (boolean ClearSettings) |
Notes: Synchronizes the Version Control status of the single object Package recorded in your current model with the Package status reported by your Version Control provider. Parameters:
True, the Version Control settings are cleared from the Package False, the Version Control settings remain unchanged |