Attribute
extends Node
in package
Class Attribute.
Table of Contents
- EDIT_STATUS = [0 => '', 1 => 'In Work', 2 => 'In Review', 3 => 'Approved', 4 => 'Done']
- $attributes : array<string|int, mixed>
- $children : array<string|int, mixed>
- $data_source : string
- $data_type : string
- $db : PgSQL
- Database instance
- $db_config : TiqConfig
- Config instance
- $debug : bool
- Is debug mode or not
- $description : string
- $description : string
- $display_name : string
- $display_name : string
- $error_message : mixed
- Base error message, this belongs in com_think's configuration class
- $id : int
- $nodes : array<string|int, mixed>
- $parent : Node|null
- $part_of_id : int
- $relationshipsDown : array<string|int, mixed>
- $relationshipsUp : array<string|int, mixed>
- $relative_name : string
- $relative_name : string
- $scripts : array<string|int, mixed>
- $system_node_type_id : int
- $totalAttributes : int|null
- $totalScripts : int|null
- $allowed_props : array<string|int, mixed>
- $attr_type : string|null
- $attribute_type_id : int|null
- $bool_value : bool|null
- $called_constructor : bool
- $class_script : Script|null
- $created_timestamp : string|null
- $current_value : mixed
- $data_source : string|null
- $data_source_value : string|null
- $data_type : string|null
- $datetime_value : string|null
- $description : string|null
- $display_name : string|null
- $display_path : string|null
- $document : string|null
- $edit_status : string|null
- $enumeration_name : string|null
- $enumeration_type : EnumerationType|null
- $enumeration_type_id : int|null
- $enumeration_value : string|null
- $enumeration_values : mixed
- $expiration_interval : string|null
- $expression : string|null
- $float_value : string|null
- $fqn : string|null
- $geopoint_value : string|null
- $id : int|null
- $id_path : string|null
- $importance : float|null
- $int_value : string|null
- $interpolation_method : string|null
- $interval_value : string|null
- $is_hidden : bool|null
- $is_root : bool|null
- $is_stale : bool|null
- $last_reported : string|null
- $latitude : float|null
- $library : Library|null
- $limit : string|null
- $limit_color : string|null
- $limit_hi : string|null
- $limit_hihi : string|null
- $limit_lo : string|null
- $limit_lolo : string|null
- $limits : array<string|int, mixed>|null
- $longitude : float|null
- $maverick : string|null
- $max_value : string|null
- $measurement_unit : string|null
- $measurement_unit_id : int|null
- $measurement_unit_symbol : string|null
- $min_value : string|null
- $object_value : string|null
- $operating_table : string
- $parent_name : string|null
- $part_of_id : int|null
- $quantity_id : int|null
- $range : string|null
- $referenced_object : Node|null
- $referenced_object_id : int|null
- $relative_name : string|null
- $source_config : string|null
- $status : string|null
- $string_value : string|null
- $system_node_type_id : int|null
- $system_node_type_name : string|null
- $tag : Tag|null
- $tag_id : int|null
- $target_value : string|null
- $type : Type|null
- $type_id : int|null
- $type_to_attribute_type_id : int|null
- $unlink_relative_name : bool|null
- $unsaved_props : array<string|int, mixed>
- $updated_timestamp : string|null
- __construct() : mixed
- Attribute class constructor
- __get() : mixed
- If the property is an attribute, then return the attribute object
- __set() : mixed
- Set a property for this node, the value will not be saved until the 'save' method is called
- __toString() : string
- Called during a print/echo statement, this function returns an html table of all the attributes of the Node, minus the DatabaseTrait properties
- configErrorMessage() : string
- If the TiqConfig error message constant is set, use it otherwise return the 'last resort' error message.
- createLimit() : Limit
- delete() : mixed
- Delete by ID
- findAdjMinMaxForAttribute() : mixed
- Generates the Attribute min, max ranges
- generateRelativeName() : string
- getAllowedProps() : array<string|int, mixed>
- Get the allowed properties for this Node
- getAttributeCount() : Node
- Gets the total attribute count of the given node
- getAttributes() : Node
- We have stubbed this out because attributes cannot have attributes
- getChildren() : $this
- This function fetches all the nodes one level down
- getConfig() : TiqConfig
- getCurrentValue() : array<string|int, mixed>
- This function returns the current value of the attribute.
- getDb() : PgSQL
- Get database instance
- getDisplayScript() : array<string|int, mixed>
- Gets the Display scripts associate to this node, will search inheritance path as well as type
- getEnumerationType() : mixed
- Loads the State data into the Attribute Class instance.
- getFQN() : string
- Returns a human readable FQN UnitTest Path: test/Model/AttributeTest.php/testInsertAndGetFqn()
- getFQNDisplayPath() : mixed
- This is a bulk call of the function below getFQN
- getGeoCoordinates() : void
- Gets the GeoCoordinates of a geopoint config attribute
- getInstance() : Node
- getLibrary() : mixed
- getLimit() : string
- This function fetch the limits and current value of the attribute and check the position of the current value in limits range and depending upon the position it returns the color name.
- getLimits() : Node
- getMeasurementUnits() : void
- This function fetch the measurement Unit of the given attribute and returns the unit of measure
- getNodeId() : int
- Return the ID from and FQN
- getNodeSet() : array<string|int, mixed>
- Returns a list of all nodes that are for type $identifier to get the type name use "SELECT * FROM model.system_node_types"
- getOperatingTable() : string
- Returns the current operating table
- getParent() : $this
- This function fetches all the nodes one level up
- getParentName() : mixed
- Loads the Parent Node data into the Attribute Class instance.
- getReferencedObject() : mixed
- getRelationshipsDown() : Node
- Gets all direct children nodes
- getRelationshipsUp() : Node
- Gets all direct parent nodes
- getScripts() : Node
- Gets the scripts associate to this node
- getSystemType() : Node
- Sets the system type name of the given attribute
- getTag() : mixed
- Loads the Tag data into the Attribute Class instance.
- getTargetValue() : string|null
- Gets the Attribute target value
- getTaxonomySystemNodeTypeId() : int
- getTimeSeries() : ValueStream|array<string|int, mixed>
- getType() : mixed
- hasClassScript() : bool
- Checks all of the nodes' script to see if there is a class script
- insertTimeSeries() : array<string|int, mixed>
- isDebug() : bool
- Is debug mode or not
- isVision() : bool
- Check if there is a mediator that feeds this attribute
- isWired() : bool
- Checks whether an attribute is connected to data.
- jsonSerialize() : array<string|int, mixed>
- Typically used to create a structure that js can turn into an object in the browser minus the DatabaseTrait properties
- reduceFQN() : array<string|int, string>
- save() : mixed
- writes updated properties into the database, or creates the node if it does not exist
- validateExpression() : bool|array<string|int, mixed>
- convertPostgresTypeArray() : array<string|int, mixed>
- Take a postgres typed array and converts it to a php array i.g. {"test 1","test 2"} from postgres will yeild ["test 1", "test 2"]
- getTypeName() : string
- This should be replaced by attaching a Type object to the node.
- setProps() : mixed
- Loads all database columns as static variables. To load a variable, it must exist in the class.
Constants
EDIT_STATUS
public
mixed
EDIT_STATUS
= [0 => '', 1 => 'In Work', 2 => 'In Review', 3 => 'Approved', 4 => 'Done']
Properties
$attributes
public
array<string|int, mixed>
$attributes
= array()
$children
public
array<string|int, mixed>
$children
= array()
$data_source
public
string
$data_source
$data_type
public
string
$data_type
$db
Database instance
public
static PgSQL
$db
= null
$db_config
Config instance
public
static TiqConfig
$db_config
= null
$debug
Is debug mode or not
public
static bool
$debug
= false
$description
public
string
$description
$description
public
string
$description
$display_name
public
string
$display_name
$display_name
public
string
$display_name
$error_message
Base error message, this belongs in com_think's configuration class
public
static mixed
$error_message
= 'An issue occurred, please contact ThinkIQ for Support and enable debugging'
$id
public
int
$id
$nodes
public
array<string|int, mixed>
$nodes
= array()
$parent
public
Node|null
$parent
= null
$part_of_id
public
int
$part_of_id
$relationshipsDown
public
array<string|int, mixed>
$relationshipsDown
= array()
$relationshipsUp
public
array<string|int, mixed>
$relationshipsUp
= array()
$relative_name
public
string
$relative_name
$relative_name
public
string
$relative_name
$scripts
public
array<string|int, mixed>
$scripts
= array()
$system_node_type_id
public
int
$system_node_type_id
$totalAttributes
public
int|null
$totalAttributes
= null
$totalScripts
public
int|null
$totalScripts
= null
$allowed_props
protected
array<string|int, mixed>
$allowed_props
= array()
$attr_type
protected
string|null
$attr_type
= null
$attribute_type_id
protected
int|null
$attribute_type_id
= null
$bool_value
protected
bool|null
$bool_value
= null
$called_constructor
protected
bool
$called_constructor
= false
$class_script
protected
Script|null
$class_script
= null
$created_timestamp
protected
string|null
$created_timestamp
= null
$current_value
protected
mixed
$current_value
= null
$data_source
protected
string|null
$data_source
= null
$data_source_value
protected
string|null
$data_source_value
= null
$data_type
protected
string|null
$data_type
= null
$datetime_value
protected
string|null
$datetime_value
= null
$description
protected
string|null
$description
= null
$display_name
protected
string|null
$display_name
= null
$display_path
protected
string|null
$display_path
= null
$document
protected
string|null
$document
= null
$edit_status
protected
string|null
$edit_status
= null
$enumeration_name
protected
string|null
$enumeration_name
= null
$enumeration_type
protected
EnumerationType|null
$enumeration_type
= null
$enumeration_type_id
protected
int|null
$enumeration_type_id
= null
$enumeration_value
protected
string|null
$enumeration_value
= null
$enumeration_values
protected
mixed
$enumeration_values
= null
$expiration_interval
protected
string|null
$expiration_interval
= null
$expression
protected
string|null
$expression
= null
$float_value
protected
string|null
$float_value
= null
$fqn
protected
string|null
$fqn
= null
$geopoint_value
protected
string|null
$geopoint_value
= null
$id
protected
int|null
$id
= null
$id_path
protected
string|null
$id_path
= ''
$importance
protected
float|null
$importance
= null
$int_value
protected
string|null
$int_value
= null
$interpolation_method
protected
string|null
$interpolation_method
= null
$interval_value
protected
string|null
$interval_value
= null
$is_hidden
protected
bool|null
$is_hidden
= null
$is_root
protected
bool|null
$is_root
= null
$is_stale
protected
bool|null
$is_stale
= null
$last_reported
protected
string|null
$last_reported
= null
$latitude
protected
float|null
$latitude
= null
$library
protected
Library|null
$library
= null
$limit
protected
string|null
$limit
= null
$limit_color
protected
string|null
$limit_color
= null
$limit_hi
protected
string|null
$limit_hi
= null
$limit_hihi
protected
string|null
$limit_hihi
= null
$limit_lo
protected
string|null
$limit_lo
= null
$limit_lolo
protected
string|null
$limit_lolo
= null
$limits
protected
array<string|int, mixed>|null
$limits
= null
$longitude
protected
float|null
$longitude
= null
$maverick
protected
string|null
$maverick
= null
$max_value
protected
string|null
$max_value
= null
$measurement_unit
protected
string|null
$measurement_unit
= null
$measurement_unit_id
protected
int|null
$measurement_unit_id
= null
$measurement_unit_symbol
protected
string|null
$measurement_unit_symbol
= null
$min_value
protected
string|null
$min_value
= null
$object_value
protected
string|null
$object_value
= null
$operating_table
protected
string
$operating_table
= 'attributes'
$parent_name
protected
string|null
$parent_name
= null
$part_of_id
protected
int|null
$part_of_id
= null
$quantity_id
protected
int|null
$quantity_id
= null
$range
protected
string|null
$range
= null
$referenced_object
protected
Node|null
$referenced_object
= null
$referenced_object_id
protected
int|null
$referenced_object_id
= null
$relative_name
protected
string|null
$relative_name
= null
$source_config
protected
string|null
$source_config
= null
$status
protected
string|null
$status
= null
$string_value
protected
string|null
$string_value
= null
$system_node_type_id
protected
int|null
$system_node_type_id
= null
$system_node_type_name
protected
string|null
$system_node_type_name
= null
$tag
protected
Tag|null
$tag
= null
$tag_id
protected
int|null
$tag_id
= null
$target_value
protected
string|null
$target_value
= null
$type
protected
Type|null
$type
= null
$type_id
protected
int|null
$type_id
= null
$type_to_attribute_type_id
protected
int|null
$type_to_attribute_type_id
= null
$unlink_relative_name
protected
bool|null
$unlink_relative_name
= null
$unsaved_props
protected
array<string|int, mixed>
$unsaved_props
= array()
$updated_timestamp
protected
string|null
$updated_timestamp
= null
Methods
__construct()
Attribute class constructor
public
__construct([null $identifier = null ][, array<string|int, mixed> $config = [] ][, array<string|int, mixed> $additionalMethods = [] ]) : mixed
Parameters
- $identifier : null = null
- $config : array<string|int, mixed> = []
- $additionalMethods : array<string|int, mixed> = []
Tags
Return values
mixed —__get()
If the property is an attribute, then return the attribute object
public
__get( $name) : mixed
Parameters
Return values
mixed —__set()
Set a property for this node, the value will not be saved until the 'save' method is called
public
__set(string $prop, mixed $value) : mixed
Parameters
- $prop : string
- $value : mixed
Return values
mixed —__toString()
Called during a print/echo statement, this function returns an html table of all the attributes of the Node, minus the DatabaseTrait properties
public
__toString() : string
Return values
string —configErrorMessage()
If the TiqConfig error message constant is set, use it otherwise return the 'last resort' error message.
public
static configErrorMessage() : string
Return values
string —createLimit()
public
createLimit(string $name, float $value) : Limit
Parameters
- $name : string
-
Must be HiHi, Hi, Lo, LoLo or target. Replace with an Enum maybe?
- $value : float
Return values
Limit —delete()
Delete by ID
public
delete() : mixed
Cleans up Scripts and other dependant items TODO: add time series data cleanup. Currently it takes too long to delete
Tags
Return values
mixed —findAdjMinMaxForAttribute()
Generates the Attribute min, max ranges
public
findAdjMinMaxForAttribute() : mixed
Tags
Return values
mixed —generateRelativeName()
public
static generateRelativeName(string $displayName[, string|null $typeName = null ][, int|null $partOfId = null ][, int|null $nodeId = null ]) : string
Parameters
- $displayName : string
- $typeName : string|null = null
- $partOfId : int|null = null
- $nodeId : int|null = null
Return values
string —getAllowedProps()
Get the allowed properties for this Node
public
getAllowedProps() : array<string|int, mixed>
Return an array intersection of the Class Properties and Table Columns
Return values
array<string|int, mixed> —getAttributeCount()
Gets the total attribute count of the given node
public
getAttributeCount([string|null $search_params = null ][, false $deep_search = false ][, false $show_hidden_attributes = true ]) : Node
Parameters
- $search_params : string|null = null
-
This parameter is a JSON object
- $deep_search : false = false
-
This toggles the ability to search not only immediate children but children of children
- $show_hidden_attributes : false = true
Return values
Node —getAttributes()
We have stubbed this out because attributes cannot have attributes
public
getAttributes([string $column = 'display_name' ][, string $order = 'ASC' ][, int|null $limit = null ][, int|null $offset = null ][, string|null $search_params = null ][, bool $deep_search = true ][, bool $show_hidden_attributes = false ][, string $default_selected_ids = "" ]) : Node
Parameters
- $column : string = 'display_name'
- $order : string = 'ASC'
- $limit : int|null = null
- $offset : int|null = null
- $search_params : string|null = null
- $deep_search : bool = true
- $show_hidden_attributes : bool = false
- $default_selected_ids : string = ""
Return values
Node —getChildren()
This function fetches all the nodes one level down
public
getChildren([array<string|int, mixed> $additionalMethods = [] ]) : $this
Parameters
- $additionalMethods : array<string|int, mixed> = []
Tags
Return values
$this —getConfig()
public
static getConfig() : TiqConfig
Return values
TiqConfig —getCurrentValue()
This function returns the current value of the attribute.
public
getCurrentValue() : array<string|int, mixed>
Returns an array with the current value, is_stale flag, and last_reported time ina human readable format. This function also sets these values as properties in the class itself Example return: ['value' => 15.1, 'last_reported' => 1 minute ago, 'is_stale' => false]
Tags
Return values
array<string|int, mixed> —getDb()
Get database instance
public
static getDb() : PgSQL
Return values
PgSQL —getDisplayScript()
Gets the Display scripts associate to this node, will search inheritance path as well as type
public
static getDisplayScript(int $id) : array<string|int, mixed>
Parameters
- $id : int
Tags
Return values
array<string|int, mixed> —getEnumerationType()
Loads the State data into the Attribute Class instance.
public
getEnumerationType() : mixed
Currently, only loads the state name
Tags
Return values
mixed —getFQN()
Returns a human readable FQN UnitTest Path: test/Model/AttributeTest.php/testInsertAndGetFqn()
public
getFQN([string $delimiter = '.' ][, bool $use_display_names = false ]) : string
Parameters
- $delimiter : string = '.'
-
optional parameter to separate the relative names
- $use_display_names : bool = false
-
optional parameter to return display names instead of relative names
Tags
Return values
string —getFQNDisplayPath()
This is a bulk call of the function below getFQN
public
static getFQNDisplayPath(array<string|int, mixed> $ids[, string $delimiter = '.' ][, bool $reduce = true ]) : mixed
Parameters
- $ids : array<string|int, mixed>
- $delimiter : string = '.'
- $reduce : bool = true
Return values
mixed —getGeoCoordinates()
Gets the GeoCoordinates of a geopoint config attribute
public
getGeoCoordinates() : void
Return values
void —getInstance()
public
static getInstance(mixed $identifier[, array<string|int, mixed>|null $config = [] ]) : Node
Parameters
- $identifier : mixed
-
could be an FQN or ID
- $config : array<string|int, mixed>|null = []
Tags
Return values
Node —getLibrary()
public
getLibrary() : mixed
Tags
Return values
mixed —getLimit()
This function fetch the limits and current value of the attribute and check the position of the current value in limits range and depending upon the position it returns the color name.
public
getLimit() : string
Tags
Return values
string —getLimits()
public
getLimits() : Node
Return values
Node —getMeasurementUnits()
This function fetch the measurement Unit of the given attribute and returns the unit of measure
public
getMeasurementUnits() : void
Tags
Return values
void —getNodeId()
Return the ID from and FQN
public
static getNodeId(string $identifier) : int
Parameters
- $identifier : string
-
FQN or ID
Tags
Return values
int —getNodeSet()
Returns a list of all nodes that are for type $identifier to get the type name use "SELECT * FROM model.system_node_types"
public
static getNodeSet(string $identifier[, string $column = 'display_name' ][, string $order = 'ASC' ][, int|null $limit = null ][, int|null $offset = null ][, string|null $search_params = null ][, string $default_selected_ids = "" ][, bool|null $deep_search = false ][, array<string|int, mixed> $additionalMethods = [] ]) : array<string|int, mixed>
Parameters
- $identifier : string
-
type_name or ID
- $column : string = 'display_name'
- $order : string = 'ASC'
- $limit : int|null = null
- $offset : int|null = null
- $search_params : string|null = null
- $default_selected_ids : string = ""
- $deep_search : bool|null = false
- $additionalMethods : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed> —getOperatingTable()
Returns the current operating table
public
getOperatingTable() : string
Return values
string —getParent()
This function fetches all the nodes one level up
public
getParent([array<string|int, mixed> $additionalMethods = [] ]) : $this
Parameters
- $additionalMethods : array<string|int, mixed> = []
Tags
Return values
$this —getParentName()
Loads the Parent Node data into the Attribute Class instance.
public
getParentName() : mixed
Tags
Return values
mixed —getReferencedObject()
public
getReferencedObject() : mixed
Return values
mixed —getRelationshipsDown()
Gets all direct children nodes
public
getRelationshipsDown() : Node
Return values
Node —getRelationshipsUp()
Gets all direct parent nodes
public
getRelationshipsUp() : Node
Return values
Node —getScripts()
Gets the scripts associate to this node
public
getScripts() : Node
Tags
Return values
Node —getSystemType()
Sets the system type name of the given attribute
public
getSystemType() : Node
Return values
Node —getTag()
Loads the Tag data into the Attribute Class instance.
public
getTag() : mixed
Currently, only loads the tag name into the source_config (data_source?...)
Tags
Return values
mixed —getTargetValue()
Gets the Attribute target value
public
getTargetValue() : string|null
Return values
string|null —getTaxonomySystemNodeTypeId()
public
static getTaxonomySystemNodeTypeId( $id) : int
Parameters
Return values
int —getTimeSeries()
public
getTimeSeries( $start, $end) : ValueStream|array<string|int, mixed>
Parameters
Tags
Return values
ValueStream|array<string|int, mixed> —getType()
public
getType() : mixed
Tags
Return values
mixed —hasClassScript()
Checks all of the nodes' script to see if there is a class script
public
hasClassScript() : bool
Tags
Return values
bool —insertTimeSeries()
public
insertTimeSeries(array<string|int, mixed> $values, array<string|int, mixed> $timestamps[, array<string|int, mixed> $quality = [] ]) : array<string|int, mixed>
Parameters
- $values : array<string|int, mixed>
- $timestamps : array<string|int, mixed>
- $quality : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed> —isDebug()
Is debug mode or not
public
static isDebug() : bool
Return values
bool —isVision()
Check if there is a mediator that feeds this attribute
public
isVision() : bool
Return values
bool —isWired()
Checks whether an attribute is connected to data.
public
isWired() : bool
"Connected to data" means the attribute has a tag, or has an expression, or is internal with data
Tags
Return values
bool —jsonSerialize()
Typically used to create a structure that js can turn into an object in the browser minus the DatabaseTrait properties
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —reduceFQN()
public
static reduceFQN(array<string|int, mixed> $paths, string $delimiter) : array<string|int, string>
Parameters
- $paths : array<string|int, mixed>
- $delimiter : string
Return values
array<string|int, string> —save()
writes updated properties into the database, or creates the node if it does not exist
public
save() : mixed
Tags
Return values
mixed —validateExpression()
public
static validateExpression(mixed $rootId, mixed $expression) : bool|array<string|int, mixed>
Parameters
- $rootId : mixed
- $expression : mixed
Return values
bool|array<string|int, mixed> —convertPostgresTypeArray()
Take a postgres typed array and converts it to a php array i.g. {"test 1","test 2"} from postgres will yeild ["test 1", "test 2"]
protected
convertPostgresTypeArray( $data) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —getTypeName()
This should be replaced by attaching a Type object to the node.
protected
getTypeName() : string
..
Return values
string —setProps()
Loads all database columns as static variables. To load a variable, it must exist in the class.
protected
setProps([array<string|int, mixed> $config = [] ][, array<string|int, mixed> $additionalMethods = [] ]) : mixed
If the 'id' property is not set, we still run this function, populating the $allowed_props variable
Parameters
- $config : array<string|int, mixed> = []
-
This array contains the same properties as a record from the corresponding table in the database
- $additionalMethods : array<string|int, mixed> = []