Package

Return to Introduction  Previous page  Next page

public Class

A Package object corresponds to a Package element in the Enterprise Architect Project Browser window. It is accessed either through the Repository Models collection (a Model is a special form of Package) or through the Package 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 DiagramObjects collection for a diagram.

Associated table in .EAP file: t_package

Package Attributes

Attribute

Type

Notes

Name

String

Read/Write.  The name of the package.

Packages

Collection

Read only.  A collection of contained packages that can be walked through.

Elements

Collection

Read only.  A collection of elements that belong to this package.

Diagrams

Collection

Read only.  A collection of diagrams contained in this package. 

Notes

String

Read/Write.  Notes about this package.

IsNamespace

Boolean

Read/Write.  True is 'package is a Namespace root'. Use 0 and 1 to set False and True.

PackageID

Long

Read only.  The local Package ID number. Valid only in this model file. 

PackageGUID

Variant

Read only.  The global Package ID. Valid across models.

ParentID

Long

Read/Write.  The ID of the package that is the parent of this one. 0 indicates this package is a model (ie. it has no parent).

Created

Date

Read/Write.  Date the package was created.

Modified

Date

Read/Write.  Date the package was last modified.

IsControlled

Boolean

Read/Write.  Indicates if the package has been marked as Controlled.

IsProtected

Boolean

Read/Write. Indicates if the package has been marked as Protected.

UseDTD

Boolean

Read/Write.  Indicates if a DTD is to be used when exporting XMI.

LogXML

Boolean

Read/Write.  Indicates if XMI export information is to be logged.

XMLPath

String

Read/Write.  The path to the where XML is saved when using controlled packages.

Version

String

Read/Write.  The version of the package.

LastLoadDate

Date

Read/Write.  The date XML was last loaded for the package.

LastSaveDate

Date

Read/Write.  The date XML was last saved from the package.

Flags

String

Read/Write.  Extended information about the package.

Owner

String

Read/Write.  The package owner when using controlled packages.

CodePath

String

Read/Write.  The path to where associated source code is found.

UMLVersion

String

Read/Write.  The UML version for XMI export purposes.

TreePos

Long

Read/Write.  The relative position in the tree compared to other packages (use to sort packages).

IsModel

Boolean

Read only.  Indicates if the package is a model or a package.

Element

Object

Read only.  The associated element object. Use to set element type information for a package, including Stereotype, Complexity, Alias, Author, Constraints and Scenarios. 

BatchSave

long

Read/Write.  Boolean value to indicate whether the package is included in the batch XMI export list or not.

BatchLoad

long

Read/Write.  Flag to indicate that the package is batch loaded during batch import from controlled packages. Not yet implemented.

Connectors

Collection

Read only. Collection of connectors.

Alias

string

Read only.  Alias.

IsVersionControlled

boolean

Read/Write.  Indicates whether or not this package is under version control.

ObjectType

ObjectType

Read only.  Distinguishes objects referenced through a Dispatch interface.

Package Methods

Method

Type

Notes

GetLastError () 

String

Returns a string value describing the most recent error that occurred in relation to this object.

This function is rarely used since an exception is thrown when an error occurs.

Update () 

Boolean 

Update 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, Stereotype, Constraints or Files - all the attributes of a typical element.

FindObject(String DottedID)

LPDISPATCH

Param: DottedID [String in]

Returns a package, element, attribute or operation matching the parameter DottedID.

The string DottedID is in the form object.object.object  where object is replaced by the name of a package, element attribute or operation.

Examples of DottedIDs include MyNamespace.Class1,  CStudent.m_Name,  MathClass.DoubleIt(int)

If the DottedID is not found, an error is returned:  Can't find matching object.

VersionControlAdd (String ConfigGuid, String XMLFile, Bool KeepCheckedOut)

void

Param: ConfigGuid [ String - in ]

Name corresponding to the Unique ID of the version control configuration to use.

Param: XMLFile [ String - in ]

Name of the XML file to use for this package.  This filename is relative to the Working Copy folder specified for the Config.

Param: KeepCheckedOut [ Boolean - in ]

Specify True to add to version control and keep package checked-out.

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.

VersionControlRemove ( )

void

Removes version control from the package.  Throws an exception if the operation fails.  Use GetLastError( ) to retrieve error information.

VersionControlCheckout (String Comment)

void

param: Comment [ String - in ] Log message that is added to the version controlled file's history (where applicable).

Perform checkout of the version controlled package.  Throws an exception if the operation fails.  Use GetLastError( ) to retrieve error information.

VersionControlCheckin (String Comment)

void

param: Comment [ String - in ] Log message that is added to the version controlled file's history (where applicable).

Perform checkin of the version controlled package.  Throws an exception if the operation fails.  Use GetLastError( ) to retrieve error information.

VersionControlGetStatus ( )

long

Returns the version control status of the package.

Return value maps to the following enumerated type;

enum EnumCheckOutStatus

{

       csUncontrolled,

       csCheckedIn,

       csCheckedOutToThisUser,

       csReadOnlyVersion,

       csCheckedOutToAnotherUser,

       csOfflineCheckedOutToThisUser,

       csOfflineNotCheckedOutToThisUser,

       csDeleted

}

csUncontrolled - Either unable to communicate with the version control provider associated with the package or the package file is unknown to the provider.

csReadOnlyVersion - Package is marked as read-only.  An earlier revision of the package has been retrieved from version control.

csOfflineCheckedOutToThisUser - Indicates that the package was "checked out" by this user whilst disconnected from version control.

csOfflineNotCheckedOutToThisUser - Indicates that Enterprise Architect can not currently connect to the version control config and the package was not previously checked out to this user.

csDeleted - The package file has been deleted from version control.

Throws an exception if the operation fails.  Use GetLastError( ) to retrieve error information.