Interface DataModel

Api for accessing the Datamodel

Note that this always already contains all changes when the Plugin scripts are executed

interface DataModel {
    create(typePersistentName: BuildingBlockType): BuildingBlock;
    findByType(typePersistentName: BuildingBlockType): BuildingBlock[];
    findByTypeAndId(
        typePersistentName: BuildingBlockType,
        id: number,
    ): BuildingBlock;
    findByTypeAndName(
        typePersistentName: BuildingBlockType,
        name: string,
        options: { ignoreCase: boolean },
    ): BuildingBlock;
    getAllPropertyNamesByType(typePersistentName: BuildingBlockType): string[];
    getAllRelationNamesByType(typePersistentName: BuildingBlockType): string[];
    getAllTypeNames(): BuildingBlockType[];
}

Methods

  • Get a Building Block object with the given type and id. Null if there is no such object.

    Parameters

    • typePersistentName: BuildingBlockType

      Persistent name of the building block type

    • id: number

      Id of the building block

    Returns BuildingBlock

  • Get a Building Block object with the given type and name. Returns {@code null} if there is no such object. Name matching is case-sensitive by default. You may pass additional option to make it case-insensitive.

    Parameters

    • typePersistentName: BuildingBlockType

      Persistent name of the building block type

    • name: string

      Name of the building block

    • options: { ignoreCase: boolean }

      Matching options

    Returns BuildingBlock

  • Get the names of all properties of a Building Block Type.

    Parameters

    Returns string[]

  • Get the names of all relation ends connected to the Building Block Type.

    Parameters

    Returns string[]