Represents a data model
Index
Constructors
Public Properties
Public Methods
- checkAttrProperty
- createQuery
- findOperatorById
- getAggrFunctionCaption
- getAggrFunctionFormat
- getAggrFunctions
- getAttributeById
- getAttributeText
- getDateMacroValue
- getDateOrMacroValue
- getDefaultOperatorForAttr
- getDefaultOperatorIdForAttr
- getEditorById
- getEntitiesTree
- getEntitiesTreeWithFilter
- getEntityAttrById
- getEntityPathByAttr
- getFirstAttributeByFilter
- getFirstUICAttr
- getFullEntityPathByAttr
- getId
- getName
- getObject
- getOperand
- getOperatorById
- getRootEntity
- getTimeMacroValue
- getTimeOrMacroValue
- isDateMacro
- isEmpty
- isTimeMacro
- loadFromData
- loadFromJSON
- rgdlce
- runThroughEntities
- setData
Constructors
constructor
The default constructor. ⊕ new DataModel(): DataModel
Public Properties
aggrFunctions
The list of aggregate functions.
● aggrFunctions: AggrFunction[]
editors
The list of value editors.
● editors: ValueEditor[]
eqlcns
The License.
● eqlcns: EqLcns
id
The ID of the data mode.
● id: string
name
The name of the data model.
● name: string
operators
The list of operators.
● operators: Operator[]
rootEntity
The root entity.
● rootEntity: Entity
version
The version of the data model.
● version: string
Public Methods
checkAttrProperty
Checks wether attribute contains such property.
▸ checkAttrProperty(attrId: string
,propName: string
): boolean
Parameters:
- attrId:
string
- The attribute ID. - propName:
string
- The property name.
Returns boolean
- true
if the attribute contains the property, otherwise false
.
createQuery
Creates query.
▸ createQuery(): Query
Returns Query - The Query.
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:
- operatorId:
string
- An operator ID.
Returns Operator | null
- The operator or null
.
getAggrFunctionCaption
Gets caption of the aggregate function.
▸ getAggrFunctionCaption(funcId: string
): string
Parameters:
- funcId:
string
- The function id.
Returns string
- The caption.
getAggrFunctionFormat
Gets format of the aggregate function.
▸ getAggrFunctionFormat(funcId: string
): string
Parameters:
- funcId:
string
- The function id.
Returns string
- The caption.
getAggrFunctions
Gets the list of aggegate functions.
▸ getAggrFunctions(): AggrFunction[]
Returns AggrFunction[] - AN array of aggregate functions.
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
Parameters:
- attrId:
string
- The attribute ID.
Returns EntityAttr - The attribute or null
.
getAttributeText
Gets the attribute text.
▸ getAttributeText(attr: EntityAttr,format: string
): string
Parameters:
- attr: EntityAttr - The attribute.
- format:
string
- The format.
Returns string
- Formatted text.
getDateMacroValue
Gets date by its macro value.
▸ getDateMacroValue(macro: string
): Date
| null
Parameters:
- macro:
string
- The macro value.
Returns Date
| null
- The date or null
getDateOrMacroValue
Gets date or macro by macro value.
▸ getDateOrMacroValue(macroValue: string
): string
| Date
Parameters:
- macroValue:
string
- The macro value.
Returns string
| Date
- The date or macro valu.
getDefaultOperatorForAttr
Gets default operator for an attribute.
▸ getDefaultOperatorForAttr(attr: EntityAttr): Operator
Parameters:
- attr: EntityAttr - The attribute.
Returns Operator - The operator.
getDefaultOperatorIdForAttr
▸ getDefaultOperatorIdForAttr(attr: EntityAttr): string
Parameters:
- attr: EntityAttr
Returns string
getEditorById
Finds editor by its ID.
▸ getEditorById(editorId: string
): ValueEditor | null
Parameters:
- editorId:
string
- The editor ID.
Returns ValueEditor | null
- The value editor or null
.
getEntitiesTree
Gets entities tree.
▸ getEntitiesTree(opts: any
): any
Parameters:
- opts:
any
- The options.
Returns any
- The tree.
getEntitiesTreeWithFilter
Gets entities tree due to filter.
▸ getEntitiesTreeWithFilter(filterCallback: any
): Entity[]
Parameters:
- filterCallback:
any
- The filter.
Returns Entity[] - The tree.
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:
- entity: Entity
- attrId:
string
Returns EntityAttr | null
- The attribute or null
.
getEntityPathByAttr
Finds entity path by attribute
▸ getEntityPathByAttr(entity: Entity,attrId: string
,sep: string
,root: boolean
): string
Parameters:
- entity: Entity - The entity.
- attrId:
string
- The attribute id. - sep:
string
- The separator. - root:
boolean
- The root option.
Returns string
- The path.
getFirstAttributeByFilter
Finds first attribute by filter.
▸ getFirstAttributeByFilter(filterCallback: (attr: EntityAttr) => boolean
): EntityAttr
Parameters:
- filterCallback: (attr: EntityAttr) =>
boolean
- The filter.
Returns EntityAttr
getFirstUICAttr
▸ getFirstUICAttr(): EntityAttr
Returns EntityAttr
getFullEntityPathByAttr
Finds full entity path by attribute
▸ getFullEntityPathByAttr(attrId: string
,sep: string
): string
Parameters:
- attrId:
string
- The attribute id. - sep:
string
- The separator.
Returns string
- The path.
getId
Gets ID of the data model.
▸ getId(): string
Returns string
- The ID.
getName
Gets name of the data model.
▸ getName(): string
Returns string
- The name.
getObject
Gets the data model object.
▸ getObject(): DataModel
Returns DataModel - Tha data model.
getOperand
Gets operand.
▸ getOperand(attr: EntityAttr,operator: Operator,index: number
): Operand
Parameters:
- attr: EntityAttr - The attribute.
- operator: Operator - The operator.
- index:
number
- The index.
Returns Operand - The operand.
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:
- operatorId:
string
- Operator ID.
Returns Operator - The operator or special NullOperator
object if operator is not found.
getRootEntity
Gets root entity of the data model.
▸ getRootEntity(): Entity
Returns Entity - The root entity.
getTimeMacroValue
Gets time by its macro value.
▸ getTimeMacroValue(macro: string
): Date
| null
Parameters:
- macro:
string
- The macro value.
Returns Date
| null
- The date or null
.
getTimeOrMacroValue
Gets time or macro by macro value.
▸ getTimeOrMacroValue(time: string
): string
| Date
Parameters:
- time:
string
Returns string
| Date
- The time or macro valu.
isDateMacro
Checks wether macro value is date.
▸ isDateMacro(macro: string
): boolean
Parameters:
- macro:
string
- The macro value.
Returns boolean
isEmpty
Checks wether the data model is empty.
▸ isEmpty(): boolean
Returns boolean
- true
if the data model is empty, otherwise false
.
isTimeMacro
Checks wether macro value is time.
▸ isTimeMacro(macro: string
): boolean
Parameters:
- macro:
string
- The macro value.
Returns boolean
loadFromData
Loads data model from its JSON representation object.
▸ loadFromData(data: DataModelData): void
Parameters:
- data: DataModelData - The JSON representation object.
Returns void
loadFromJSON
Loads data model from JSON.
▸ loadFromJSON(stringJson: string
): void
Parameters:
- stringJson:
string
- The JSON string.
Returns void
rgdlce
Gets license.
▸ rgdlce(): boolean
Returns boolean
- The license.
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:
- 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
Sets data to data model.
▸ setData(model: DataModelData | string
): void
Parameters:
- model: DataModelData |
string
- Its JSON representation object or JSON string.
Returns void