Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IAbstractModel

This interface exposes a single Mendix Model. This interface contains the parts of the Model that are exposed through the SDK.

Hierarchy

  • IAbstractModel

Implemented by

Index

Properties

id

id: string

Working copy id of the current opened model (read only)

metaModelVersion

metaModelVersion: Version

The Mendix meta model version related to the project.

mxVersionForModel

mxVersionForModel: Version

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

workingCopy

workingCopy: IWorkingCopy

The meta data of the model.

Methods

addModuleUnitInterfaces

  • addModuleUnitInterfaces(moduleJson: string | IAbstractUnitJson[]): IStructuralUnit
  • 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

    • moduleJson: string | IAbstractUnitJson[]

    Returns IStructuralUnit

allUnits

  • allUnits(): IAbstractUnit[]
  • Returns all units in the project, including modules, folders etc. To retrieve all "real" documents (pages, microflows etc.), use allDocuments().

    Returns IAbstractUnit[]

closeConnection

  • 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>

deleteFile

  • deleteFile(filePath: string, callback: IVoidCallback, errorCallback: IErrorCallback): void
  • deleteFile(filePath: string): Promise<void>
  • Deletes the file with the specified filepath.

    Parameters

    Returns void

  • Parameters

    • filePath: string

    Returns Promise<void>

deleteWorkingCopy

  • Deletes this model from the server, and the (SDK) client.

    Parameters

    Returns void

  • Returns Promise<void>

exportModuleMpk

  • exportModuleMpk(moduleId: string, outFilePath: string, callback: IVoidCallback, errorCallback?: IErrorCallback): void
  • exportModuleMpk(moduleId: string, outFilePath: string): Promise<void>
  • Exports the module as MPK. If outFilePath is empty, the raw response body will be provided in the callback

    Parameters

    Returns void

  • Parameters

    • moduleId: string
    • outFilePath: string

    Returns Promise<void>

exportMpk

  • Exports this model as MPK. If outFilePath is empty, the raw response body will be provided.

    Parameters

    Returns void

  • Parameters

    • outFilePath: string

    Returns Promise<IExportMpkResponse>

filterUnitsByCustomWidgetId

  • filterUnitsByCustomWidgetId(workingCopyId: string, widgetId: string, callback: ICallback<string[]>, errorCallback?: IErrorCallback): void
  • filterUnitsByCustomWidgetId(workingCopyId: string, widgetId: string): Promise<string[]>
  • Returns a list of unitIds that contains a specific custom widget

    Parameters

    Returns void

  • Parameters

    • workingCopyId: string
    • widgetId: string

    Returns Promise<string[]>

flushChanges

  • 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>

getFile

  • getFile(filePath: string, outFilePath: string, callback: function, errorCallback: IErrorCallback): void
  • getFile(filePath: string, outFilePath: string): Promise<any>
  • Downloads the file specified by the supplied filepath. If outFilePath is empty, the raw response body will be provided in the callback

    Parameters

    • filePath: string
    • outFilePath: string
    • callback: function
        • (response?: any): void
        • Parameters

          • Optional response: any

          Returns void

    • errorCallback: IErrorCallback

    Returns void

  • Parameters

    • filePath: string
    • outFilePath: string

    Returns Promise<any>

getFilePaths

  • getFilePaths(callback: ICallback<string[]>, errorCallback: IErrorCallback): void
  • getFilePaths(): Promise<string[]>
  • Returns an array of all filepaths in the working copy.

    Parameters

    Returns void

  • Returns Promise<string[]>

getFiles

  • Returns all files or a subset of files options.filter: glob pattern to limit the set of files options.format: "json" or "zip" options.path: useful if format is "zip". If provided the zip will be stored on disk

    Parameters

    • callback: function
        • (response?: string[]): void
        • Parameters

          • Optional response: string[]

          Returns void

    • errorCallback: IErrorCallback

    Returns void

  • Returns Promise<string[]>

  • Parameters

    • options: IGetFilesOptions
    • callback: function
        • (response?: string[] | any): void
        • Parameters

          • Optional response: string[] | any

          Returns void

    • errorCallback: IErrorCallback

    Returns void

  • Parameters

    Returns Promise<string[] | any>

getLastEventId

  • getLastEventId(callback: ICallback<number>, errorCallback?: IErrorCallback): void
  • getLastEventId(): Promise<number>
  • 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>

importModuleMpk

  • 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>

loadUnitById

  • loadUnitById<T>(id: string, forceRefresh: boolean, callback: ICallback<T>, errorCallback?: IErrorCallback): void
  • loadUnitById<T>(id: string, forceRefresh: boolean): Promise<T>
  • Given an id, fetches a complete unit. The result might be returned from the cache. Use this method if you have just a unit Id, otherwise, unit.fetch() is a simpler alternative.

    Type parameters

    Parameters

    Returns void

  • Type parameters

    Parameters

    • id: string
    • forceRefresh: boolean

    Returns Promise<T>

onBuildResultEventReceived

  • onBuildResultEventReceived(callback: function): void

onFileChangesReceived

  • onFileChangesReceived(callback: function): void
  • Parameters

    • callback: function
        • (files: string[]): void
        • Parameters

          • files: string[]

          Returns void

    Returns void

onModelChange

onModelEventProcessed

onWorkingCopyDataEventReceived

  • onWorkingCopyDataEventReceived(callback: function): void

putFile

  • putFile(inFilePath: string | Blob, filePath: string, callback: IVoidCallback, errorCallback: IErrorCallback): void
  • putFile(inFilePath: string | Blob, filePath: string): Promise<void>
  • Uploads the supplied file to the specified filepath.

    Parameters

    Returns void

  • Parameters

    • inFilePath: string | Blob
    • filePath: string

    Returns Promise<void>

setErrorHandler

  • 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

startReceivingModelEvents

  • startReceivingModelEvents(): void
  • Returns void

startReceivingWorkingCopyEvents

  • startReceivingWorkingCopyEvents(): void
  • Returns void

stopReceivingModelEvents

  • stopReceivingModelEvents(): void
  • Returns void

stopReceivingWorkingCopyEvents

  • stopReceivingWorkingCopyEvents(): void
  • Returns void

Generated using TypeDoc