DataModelEx class
Extends
Section titled “Extends”- addDefaultValueEditors
- addOrUpdateOperator
- addOrUpdateValueEditor
- buildQueryPath
- checkAttrProperty
- clear
- createQuery
- findLink
- findOperatorById
- getAggrFunctionCaption
- getAggrFunctionFormat
- getAggrFunctions
- getAttributeById
- getAttributeText
- getDateMacroValue
- getDateOrMacroValue
- getDefaultOperatorForAttr
- getDefaultOperatorIdForAttr
- getEditorById
- getEntitiesInQuery
- getEntitiesTree
- getEntitiesTreeWithFilter
- getEntityAttrById
- getEntityPathByAttr
- getFirstAttributeByFilter
- getFirstUICAttr
- getFullEntityPathByAttr
- getId
- getLinksByEntity
- getMainEntity
- getName
- getObject
- getOperand
- getOperatorById
- getOperatorIdsByDataType
- getRootEntity
- getTimeMacroValue
- getTimeOrMacroValue
- isDateMacro
- isEmpty
- isTimeMacro
- loadFromData
- loadFromJSON
- rgdlce
- runThroughEntities
- setData
Constructors
Section titled “Constructors”constructor
Section titled “constructor”The default constructor. ⊕ new DataModelEx(): DataModelEx
Public Properties
Section titled “Public Properties”aggrFunctions
Section titled “aggrFunctions”The list of aggregate functions.
● aggrFunctions: AggrFunction[]
editors
Section titled “editors”The list of value editors.
● editors: ValueEditor[]
eqlcns
Section titled “eqlcns”The License.
● eqlcns: EqLcns
The ID of the data mode.
● id: string
The list of links. It is used in odata broker.
● links: Link[]
The name of the data model.
● name: string
operators
Section titled “operators”The list of operators.
● operators: Operator[]
rootEntity
Section titled “rootEntity”The root entity.
● rootEntity: Entity
version
Section titled “version”The version of the data model.
● version: string
Protected Properties
Section titled “Protected Properties”mainEntity
Section titled “mainEntity”● mainEntity: Entity | null
Public Methods
Section titled “Public Methods”addDefaultValueEditors
Section titled “addDefaultValueEditors”Add default value editors.
▸ addDefaultValueEditors(): void
Returns void
addOrUpdateOperator
Section titled “addOrUpdateOperator”Add or update an operator.
▸ addOrUpdateOperator(id: string
,caption: string
,expr: string
,format: string
,kind?: DataKind): Operator
Parameters:
Section titled “Parameters:”- id:
string
- The id. - caption:
string
- The caption. - expr:
string
- The epxrpession. - format:
string
- The display format. - kind: DataKind, Optional - The def operand’s kind.
Returns Operator - The operator.
addOrUpdateValueEditor
Section titled “addOrUpdateValueEditor”Add or update a value editor.
▸ addOrUpdateValueEditor(id: string
,tag: EditorTag,resType: DataType): ValueEditor
Parameters:
Section titled “Parameters:”Returns ValueEditor - The value editor.
buildQueryPath
Section titled “buildQueryPath”▸ buildQueryPath(query: Query): Tree<Entity>
Parameters:
Section titled “Parameters:”- query: Query
checkAttrProperty
Section titled “checkAttrProperty”Checks wether attribute contains such property.
▸ checkAttrProperty(attrId: string
,propName: string
): boolean
Parameters:
Section titled “Parameters:”- attrId:
string
- The attribute ID. - propName:
string
- The property name.
Returns boolean
- true
if the attribute contains the property, otherwise false
.
Clears data model.
▸ clear(): void
Returns void
createQuery
Section titled “createQuery”Creates query.
▸ createQuery(): Query
Returns Query - The Query.
findLink
Section titled “findLink”Finds link between two entities.
▸ findLink(entityFrom: Entity,entityTo: Entity): Link | null
Parameters:
Section titled “Parameters:”Returns Link | null
- The link.
findOperatorById
Section titled “findOperatorById”Finds operator in model by its ID. This function runs through all operators inside specified model and returns the one with specified ID.
▸ findOperatorById(operatorId: string
): Operator | null
Parameters:
Section titled “Parameters:”- operatorId:
string
- An operator ID.
Returns Operator | null
- The operator or null
.
getAggrFunctionCaption
Section titled “getAggrFunctionCaption”Gets caption of the aggregate function.
▸ getAggrFunctionCaption(funcId: string
): string
Parameters:
Section titled “Parameters:”- funcId:
string
- The function id.
Returns string
- The caption.
getAggrFunctionFormat
Section titled “getAggrFunctionFormat”Gets format of the aggregate function.
▸ getAggrFunctionFormat(funcId: string
): string
Parameters:
Section titled “Parameters:”- funcId:
string
- The function id.
Returns string
- The caption.
getAggrFunctions
Section titled “getAggrFunctions”Gets the list of aggegate functions.
▸ getAggrFunctions(): AggrFunction[]
Returns AggrFunction[] - AN array of aggregate functions.
getAttributeById
Section titled “getAttributeById”Gets entity attribute by its ID. This function runs through all attributes inside specified model (it’s root entity and all its sub-entities).
▸ getAttributeById(attrId: string
): EntityAttr | null
Parameters:
Section titled “Parameters:”- attrId:
string
- The attribute ID.
Returns EntityAttr | null
- The attribute or null
.
getAttributeText
Section titled “getAttributeText”Gets the attribute text.
▸ getAttributeText(attr: EntityAttr,format: string
): string
Parameters:
Section titled “Parameters:”- attr: EntityAttr - The attribute.
- format:
string
- The format.
Returns string
- Formatted text.
getDateMacroValue
Section titled “getDateMacroValue”Gets date by its macro value.
▸ getDateMacroValue(macro: string
): Date
| null
Parameters:
Section titled “Parameters:”- macro:
string
- The macro value.
Returns Date
| null
- The date or null
getDateOrMacroValue
Section titled “getDateOrMacroValue”Gets date or macro by macro value.
▸ getDateOrMacroValue(macroValue: string
): string
| Date
Parameters:
Section titled “Parameters:”- macroValue:
string
- The macro value.
Returns string
| Date
- The date or macro valu.
getDefaultOperatorForAttr
Section titled “getDefaultOperatorForAttr”Gets default operator for an attribute.
▸ getDefaultOperatorForAttr(attr: EntityAttr): Operator
Parameters:
Section titled “Parameters:”- attr: EntityAttr - The attribute.
Returns Operator - The operator.
getDefaultOperatorIdForAttr
Section titled “getDefaultOperatorIdForAttr”▸ getDefaultOperatorIdForAttr(attr: EntityAttr): string
Parameters:
Section titled “Parameters:”- attr: EntityAttr
Returns string
getEditorById
Section titled “getEditorById”Finds editor by its ID.
▸ getEditorById(editorId: string
): ValueEditor | null
Parameters:
Section titled “Parameters:”- editorId:
string
- The editor ID.
Returns ValueEditor | null
- The value editor or null
.
getEntitiesInQuery
Section titled “getEntitiesInQuery”Get Entities used in query.
▸ getEntitiesInQuery(query: Query): Entity[]
Parameters:
Section titled “Parameters:”- query: Query - The query.
Returns Entity[]
getEntitiesTree
Section titled “getEntitiesTree”Gets entities tree.
▸ getEntitiesTree(opts: any
,filterFunc?: (ent: Entity, attr: EntityAttr) => boolean
): any
Parameters:
Section titled “Parameters:”- opts:
any
- The options. - filterFunc: (ent: Entity, attr: EntityAttr) =>
boolean
, Optional - The filter function. Takes two parameters, Entity and EntityAttr (second parameter will be null for entities), and returns boolean (true if the corresponding entity or attribute).
Returns any
- The tree of the entities and their attributes according to options and the filter function
getEntitiesTreeWithFilter
Section titled “getEntitiesTreeWithFilter”Gets entities tree due to filter.
▸ getEntitiesTreeWithFilter(filterFunc: any
): Entity[]
Parameters:
Section titled “Parameters:”- filterFunc:
any
- The filter function. Takes two parameters, Entity and EntityAttr (second parameter will be null for entities), and returns boolean (true if the corresponding entity or attribute).
Returns Entity[] - The tree of the entities and their attributes according to the filter function
getEntityAttrById
Section titled “getEntityAttrById”Gets entity attribute by its ID. This function runs through all attributes inside specified entity and all its sub-entities.
▸ getEntityAttrById(entity: Entity,attrId: string
): EntityAttr | null
Parameters:
Section titled “Parameters:”- entity: Entity
- attrId:
string
Returns EntityAttr | null
- The attribute or null
.
getEntityPathByAttr
Section titled “getEntityPathByAttr”Finds entity path by attribute
▸ getEntityPathByAttr(entity: Entity,attrId: string
,sep: string
,root: boolean
): string
Parameters:
Section titled “Parameters:”- entity: Entity - The entity.
- attrId:
string
- The attribute id. - sep:
string
- The separator. - root:
boolean
- The root option.
Returns string
- The path.
getFirstAttributeByFilter
Section titled “getFirstAttributeByFilter”Finds first attribute by filter.
▸ getFirstAttributeByFilter(filterFunc: (attr: EntityAttr) => boolean
): EntityAttr
Parameters:
Section titled “Parameters:”- filterFunc: (attr: EntityAttr) =>
boolean
- The filter function. Takes EntityAttr object in parameter and returns boolean
Returns EntityAttr
getFirstUICAttr
Section titled “getFirstUICAttr”▸ getFirstUICAttr(): EntityAttr
Returns EntityAttr
getFullEntityPathByAttr
Section titled “getFullEntityPathByAttr”Finds full entity path by attribute
▸ getFullEntityPathByAttr(attrId: string
,sep: string
): string
Parameters:
Section titled “Parameters:”- attrId:
string
- The attribute id. - sep:
string
- The separator.
Returns string
- The path.
Gets ID of the data model.
▸ getId(): string
Returns string
- The ID.
getLinksByEntity
Section titled “getLinksByEntity”Get links with the entity.
▸ getLinksByEntity(entity: Entity): Link[]
Parameters:
Section titled “Parameters:”- entity: Entity - The entity.
Returns Link[] - The link.
getMainEntity
Section titled “getMainEntity”Gets the main entity of model
▸ getMainEntity(): Entity
Returns Entity - The main entity.
getName
Section titled “getName”Gets name of the data model.
▸ getName(): string
Returns string
- The name.
getObject
Section titled “getObject”Gets the data model object.
▸ getObject(): DataModel
Returns DataModel - Tha data model.
getOperand
Section titled “getOperand”Gets operand.
▸ getOperand(attr: EntityAttr,operator: Operator,index: number
): Operand
Parameters:
Section titled “Parameters:”- attr: EntityAttr - The attribute.
- operator: Operator - The operator.
- index:
number
- The index.
Returns Operand - The operand.
getOperatorById
Section titled “getOperatorById”Finds operator in model by its ID. his function runs through all operators inside specified model and returns the one with specified ID.
▸ getOperatorById(operatorId: string
): Operator
Parameters:
Section titled “Parameters:”- operatorId:
string
- Operator ID.
Returns Operator - The operator or special NullOperator
object if operator is not found.
getOperatorIdsByDataType
Section titled “getOperatorIdsByDataType”Get operators for data type.
▸ getOperatorIdsByDataType(type: DataType): string
[]
Parameters:
Section titled “Parameters:”- type: DataType - The data type
Returns string
[] - The array of operator ids.
getRootEntity
Section titled “getRootEntity”Gets root entity of the data model.
▸ getRootEntity(): Entity
Returns Entity - The root entity.
getTimeMacroValue
Section titled “getTimeMacroValue”Gets time by its macro value.
▸ getTimeMacroValue(macro: string
): Date
| null
Parameters:
Section titled “Parameters:”- macro:
string
- The macro value.
Returns Date
| null
- The date or null
.
getTimeOrMacroValue
Section titled “getTimeOrMacroValue”Gets time or macro by macro value.
▸ getTimeOrMacroValue(time: string
): string
| Date
Parameters:
Section titled “Parameters:”- time:
string
Returns string
| Date
- The time or macro valu.
isDateMacro
Section titled “isDateMacro”Checks wether macro value is date.
▸ isDateMacro(macro: string
): boolean
Parameters:
Section titled “Parameters:”- macro:
string
- The macro value.
Returns boolean
isEmpty
Section titled “isEmpty”Checks wether the data model is empty.
▸ isEmpty(): boolean
Returns boolean
- true
if the data model is empty, otherwise false
.
isTimeMacro
Section titled “isTimeMacro”Checks wether macro value is time.
▸ isTimeMacro(macro: string
): boolean
Parameters:
Section titled “Parameters:”- macro:
string
- The macro value.
Returns boolean
loadFromData
Section titled “loadFromData”Loads data model from its JSON representation object.
▸ loadFromData(data: ModelPlainData): void
Parameters:
Section titled “Parameters:”- data: ModelPlainData - The JSON representation object.
Returns void
loadFromJSON
Section titled “loadFromJSON”Loads data model from JSON.
▸ loadFromJSON(stringJson: string
): void
Parameters:
Section titled “Parameters:”- stringJson:
string
- The JSON string.
Returns void
rgdlce
Section titled “rgdlce”Gets license.
▸ rgdlce(): boolean
Returns boolean
- The license.
runThroughEntities
Section titled “runThroughEntities”Scans model’s entity tree and calls the callback functions for each attribute and entity.
▸ runThroughEntities(processAttribute: (attr: EntityAttr, opts: any
) => void
,processEntity: (entity: Entity, opts: any
) => void
): void
Parameters:
Section titled “Parameters:”- processAttribute: (attr: EntityAttr, opts:
any
) =>void
- The callback function which is called for each attribute in model’s entity tree. The processed attribute is passed in the first function parameter. - processEntity: (entity: Entity, opts:
any
) =>void
- The callback function which is called for each entity in tree. The processed entity is passed in the first function parameter.
Returns void
setData
Section titled “setData”Sets data to data model.
▸ setData(model: ModelPlainData | string
): void
Parameters:
Section titled “Parameters:”- model: ModelPlainData |
string
- Its JSON representation object or JSON string.
Returns void