The package creation unit in the Fore language is used to create handlers of the events occurring during business application or component update creation. Events can be used to set up the created update, reorder objects and change the number and types of objects to be included in the update.
The unit code structure consists of two parts: fixed part containing required interface and classes definitions, and an application class containing event implementations. The application class can be renamed if required. To provide work of the package creation unit, add a link to the Metabase system assembly.
The example of unit code:
// ---Fixed part should always be in the unit in the specified form---
Public Interface IBaseEventArgs
End Interface IBaseEventArgs;
Public Interface IUpdateEventArgs: IBaseEventArgs
// Created update file (.pefx)
Public Property Update: IMetabaseUpdate
Get
End Property Update;
End Interface IUpdateEventArgs;
Public Class BaseEventArgs: Object, IBaseEventArgs
End Class BaseEventArgs;
Public Class UpdateEventArgs: BaseEventArgs, IUpdateEventArgs
_update: IMetabaseUpdate;
Public Constructor Create(Upd: IMetabaseUpdate);
Begin
_update := Upd;
End Constructor Create;
Public Property Update: IMetabaseUpdate
Get
Begin
Return _update;
End Get
End Property Update;
End Class UpdateEventArgs;
// Package creation event handlers
Public Interface ICreatePackageEvents
// Event occurring before package creation
Public Sub OnBeforeCreateUpdate(Sender: Variant; Args: IBaseEventArgs);
// Event occurring after update file creation (.pefx), adding objects to it and sorting
Public Sub OnAfterSortObjects(Sender: Variant; Args: IUpdateEventArgs);
// Event occurring after package creation
Public Sub OnAfterCreateUpdate(Sender: Variant; Args: IBaseEventArgs);
End Interface ICreatePackageEvents;
// ---End of fixed part---
// ---Application class containing implementation of events---
Public Class MyComponentCreatePackageEvents: Object, ICreatePackageEvents
Public Sub OnBeforeCreateUpdate(Sender: Variant; Args: IBaseEventArgs);
Begin
// Event code…
End Sub OnBeforeCreateUpdate;
Public Sub OnAfterSortObjects(Sender: Variant; Args: IUpdateEventArgs);
Begin
// Event code…
End Sub OnAfterSortObjects;
Public Sub OnAfterCreateUpdate(Sender: Variant; Args: IBaseEventArgs);
Begin
// Event code…
End Sub OnAfterCreateUpdate;
End Class MyComponentCreatePackageEvents;
See also:
Creating and Installing Updates | Creating and Installing Component Updates