Options
All
  • Public
  • Public/Protected
  • All
Menu

Abstract: this class should never be instantiated. Implementation of IModel.

Hierarchy

  • AbstractModel

Implements

Index

Constructors

Properties

internal
_errorHandler: IErrorCallback
internal
_isInitialized: boolean = false
internal
_qualifiedNameCache: QualifiedNameCache = ...

Map qualifiedName -> AbstractElement[]; the same qualified name could potentially refer to different kind of objects; e.g. MyFirstModule.SecondThing could both be an entity or a microflow.

A structure has a qualified name precisely if it's public, publicly contained through namespaces and has a public, 1-string-typed name property. In other words: every structure having a qualified name is already present in the interface of the containing unit. So, as soon as processUnitInterfaces has been called the cache is complete (no lazy loading). (It still needs to be continuously updated obviously.)

internal
_units: IUnitsMap = {}

Map unitId -> unit, containing all units of this model, which could be partial(ly loaded).

internal
_unitsByType: IUnitsByTypeCache = {}

Map unitType -> units[], containing all units of this model, per type, but not sorted in any particular order. Please extend the type whenever applicable, for convenience of the programmer.

internal
deltaManager: IDeltaManager
internal
detachedStructures: IStructure[] = []
internal
metaModelVersion: Version

The Mendix meta model version related to the project.

modelEventManager: IModelEventManager
internal
mxVersionForModel: Version

The Mendix product version the model was created with/in. Note: this does not have to equal the meta model version.

workingCopy: IWorkingCopy

The meta data of the model.

Accessors

  • get _unitTypes(): string[]
  • internal

    Returns string[]

  • get id(): string
  • Working copy id of the current opened model (read only)

    Returns string

Methods

  • _addDetachedStructure(structure: IStructure): void
  • internal

    Parameters

    Returns void

  • Registers the given unit in the cache(s).

    internal

    Parameters

    Returns void

  • Structural units have children (e.g., folders have documents), but in storage the inverse is stored: documents specify in which parent they reside. However, in the SDK we want to be able to read the children of a folder, so these kind of properties are expressed using StructuralChild(List)Property objects, see properties/structural.ts. We notify structural parents that a child was added upon loading a child structure, so that parent can do the appropriate bookkeeping at that time (and only once). This way we avoid having to visit all unit interfaces to gather all children of a specific structural child (list) property.

    internal

    Parameters

    Returns void

  • _allModelClasses(): any
  • internal

    Returns any

  • _allOfTypes<T>(structureTypeNames: string[]): T[]
  • internal

    Type parameters

    Parameters

    • structureTypeNames: string[]

    Returns T[]

  • If a model element changes its name, broken by-name references should be attempted to resolve.

    In the future this might be made smarter and less expensive, once that becomes an issue.

    internal

    Parameters

    Returns void

  • _removeDetachedStructure(structure: IStructure): void
  • internal

    Parameters

    Returns void

  • Unregisters the given unit from the cache(s).

    internal

    Parameters

    Returns void

  • _resolveContainer(unit: IAbstractUnit, containerId: string): void
  • internal

    Parameters

    Returns void

  • _resolveName(structureTypeName: string, qualifiedName: null | string): null | IAbstractElement
  • Given an object type name and a qualified name, finds the corresponding element (or null if the reference is broken). Will always succeed for unbroken references, since all objects that are referred by name should be part of the public interface of the model.

    Example usage: modelStore.resolveName(domainmodels.Attribute.structureTypeName, "Expenses.Expense.Price");

    internal

    Parameters

    • structureTypeName: string
    • qualifiedName: null | string

    Returns null | IAbstractElement

  • _sendDelta(delta: Delta): void
  • internal

    Parameters

    Returns void

  • _unitInterfacesByType<T>(structureTypeName: string): T[]
  • Return the non-defensive set of unit interfaces of a certain type. Creates the collection lazily if needed.

    internal

    Type parameters

    Parameters

    • structureTypeName: string

    Returns T[]

  • Adds the given module json to the project, which will make the module and its units read-only and unloadable. Returns the added module.

    Gives error if

    • The JSON isn't an array
    • The module package is not compatible with the same metamodel version as the project

    Parameters

    Returns IStructuralUnit

  • Ends the connection with the Model API client. Flushes any pending deltas and invokes the callback once complete. If a callback is provided but no error callback is provided, errors will be handled through the default modelstore error handler.

    Parameters

    Returns void

  • Returns Promise<void>

  • completePendingChange(eventId?: number): void
  • internal

    Parameters

    • Optional eventId: number

    Returns void

  • exportModuleMpk(moduleId: string, outFilePath: string, callback: IVoidCallback, errorCallback?: IErrorCallback): void
  • exportModuleMpk(moduleId: string, outFilePath: string): Promise<void>
  • filterUnitsByCustomWidgetId(workingCopyId: string, widgetId: string, callback: ICallback<string[]>, errorCallback: IErrorCallback): void
  • filterUnitsByCustomWidgetId(workingCopyId: string, widgetId: string): Promise<string[]>
  • getFile(filePath: string, outFilePath: string, callback: IVoidCallback, errorCallback: IErrorCallback): void
  • getFile(filePath: string, outFilePath: string): Promise<void>
  • Downloads the file specified by the supplied filepath. If outFilePath is empty, the raw response body will be provided in the callback

    Parameters

    Returns void

  • Parameters

    • filePath: string
    • outFilePath: string

    Returns Promise<void>

  • Get the event id for the last processed batch of deltas in Model Server after flushing any pending deltas. If a callback is provided but no error callback is provided, errors will be handled through the default modelstore error handler.

    Parameters

    Returns void

  • Returns Promise<number>

  • handleError(message: string, errorCallback: undefined | IErrorCallback): void
  • Parameters

    Returns void

  • importModuleMpk(mpkPath: string | Blob, callback: IVoidCallback, errorCallback?: IErrorCallback): void
  • importModuleMpk(mpkPath: string | Blob): Promise<void>
  • Imports the given module MPK.

    Importing a module overwrites existing files in the project.

    Gives error if

    • A module with the same name already exists
    • The module package is not using the same metamodel version as the project

    Parameters

    Returns void

  • Parameters

    • mpkPath: string | Blob

    Returns Promise<void>

  • initializeFromModelServer(workingCopyId: string): Promise<void>
  • internal

    Parameters

    • workingCopyId: string

    Returns Promise<void>

  • loadUnitById<T>(id: string, forceRefresh: undefined | boolean, callback: ICallback<T>, errorCallback?: IErrorCallback): void
  • loadUnitById<T>(id: string, forceRefresh: undefined | boolean): Promise<T>
  • onBuildResultEventReceived(callback: (buildResultEvent: IBuildResultEvent) => void): void
  • onFileChangesReceived(callback: (files: string[]) => void): void
  • onUnitLoaded(callback: (modelUnitId: string) => void): void
  • internal

    Parameters

    • callback: (modelUnitId: string) => void
        • (modelUnitId: string): void
        • Parameters

          • modelUnitId: string

          Returns void

    Returns void

  • putFile(inFilePath: string | Blob, filePath: string, callback: IVoidCallback, errorCallback: IErrorCallback): void
  • putFile(inFilePath: string | Blob, filePath: string): Promise<void>
  • Sets the callback that is invoked when an error occurs in an asynchronous operation for which no error callback is specified.

    Examples of such operations are making changes to the model and loading elements.

    Parameters

    Returns void

  • startPendingChange(): void
  • internal

    Returns void

  • startReceivingModelEvents(): void
  • startReceivingWorkingCopyEvents(): void
  • Before calling this API, ensure that all handlers (i.e. onBuildResultEventReceived() and/or onWorkingCopyDataEventReceived() ), have been registered

    Returns void

  • stopReceivingModelEvents(): void
  • stopReceivingWorkingCopyEvents(): void

Generated using TypeDoc