DependencyModel

This model represents a dependency between two events, usually added to a DependencyStore.

It is a subclass of the DependencyBaseModel class, which in its turn subclasses Model. Please refer to documentation of those classes to become familiar with the base interface of this class.

Fields and references

A Dependency has a few predefined fields, see Fields below. The name of any fields data source can be customized in the subclass, see the example below. Please also refer to Model for details.

class MyDependency extends DependencyModel {
  static get fields() {
    return [
      { name: 'to', dataSource: 'targetId' },
      { name: 'from', dataSource: 'sourceId' }
    ]);
  }
}

After load and project normalization, these references are accessible (assuming their respective stores are loaded):

  • fromEvent - The event on the start side of the dependency
  • toEvent - The event on the end side of the dependency

Async resolving of references

As described above, a dependency has links to events. These references are populated async, using the calculation engine of the project that the resource via its store is a part of. Because of this asyncness, references cannot be used immediately after modifications:

dependency.from = 2;
// dependency.fromEvent is not yet up to date

To make sure references are updated, wait for calculations to finish:

dependency.from = 2;
await dependency.project.commitAsync();
// dependency.fromEvent is up to date

As an alternative, you can also use setAsync() to trigger calculations directly after the change:

await dependency.setAsync({ from : 2});
// dependency.fromEvent is up to date

Properties

66

Class hierarchy

isDependencyModel: Boolean= truereadonly
Identifies an object as an instance of DependencyModel class, or subclass thereof.
isDependencyModel: Boolean= truereadonlystatic
Identifies an object as an instance of DependencyModel class, or subclass thereof.
isDependencyBaseModelDependencyBaseModel
isModelModel
isModelLinkModelLink
isModelStmModelStm
isTreeNodeTreeNode

Dependency

fullLagDependencyBaseModel
hardTypeDependencyBaseModel
TypestaticDependencyBaseModel

Editing

copyOfModel
isPersistableDependencyBaseModel
isValidDependencyBaseModel

Fields

allFieldsstaticModel
autoExposeFieldsstaticModel
childrenFieldstaticModel
defaultsstaticModel
fieldMapstaticModel
fieldsstaticModel
idFieldstaticModel

Grouping

Identification

keyModel

JSON

jsonModel

Lifecycle

configBase

Linked records

hasLinksModelLink
isLinkedModelLink
recordLinksModelLink

Misc

stmModelStm

Other

$namestaticModel
relationsstaticModel

Parent & children

allChildrenTreeNode
childLevelTreeNode
firstChildTreeNode
isLeafTreeNode
isLoadedTreeNode
isParentTreeNode
isRootTreeNode
lastChildTreeNode
nextSiblingTreeNode
parentTreeNode
parentIdTreeNode

Functions

62

Configuration

applyDefaultsstaticBase

Dependency

getHardTypeDependencyBaseModel
highlightDependencyBaseModel
isHighlightedWithDependencyBaseModel
setHardTypeDependencyBaseModel
setLagDependencyBaseModel
unhighlightDependencyBaseModel

Editing

copyModel
getDataModel
removeModel
setModel
setAsyncDependencyBaseModel

Events

Fields

addFieldstaticModel
getModel
processFieldstaticModel
removeFieldstaticModel

Identification

asIdstaticModel
generateIdstaticModel

JSON

toJSONModel

Lifecycle

destroystaticBase

Misc

equalsModel
initClassstaticBase
isOfTypeNamestaticBase
linkModelLink
mixinstaticBase

Other

getDefaultTypestaticDependencyBaseModel

Parent & children

appendChildTreeNode
bubbleTreeNode
bubbleWhileTreeNode
containsTreeNode
insertChildTreeNode
isExpandedTreeNode
removeChildTreeNode
traverseTreeNode

Typedefs

2
DependencyTypeDependencyBaseModel