Documentation

NodesWithTags extends Node
in package

Class NodeWithTags extends Nodes and is used for nodes that can contain tags, i.e. Gateway, Connector, OpcuaObject

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>
$db  : PgSQL
Database instance
$db_config  : TiqConfig
Config instance
$debug  : bool
Is debug mode or not
$description  : 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
$relationshipsDown  : array<string|int, mixed>
$relationshipsUp  : array<string|int, mixed>
$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>
$called_constructor  : bool
$class_script  : Script|null
$created_timestamp  : string|null
$description  : string|null
$display_name  : string|null
$display_path  : string|null
$document  : string|null
$edit_status  : string|null
$fqn  : string|null
$id  : int|null
$id_path  : string|null
$is_root  : bool|null
$library  : Library|null
$operating_table  : string
$part_of_id  : int|null
$relative_name  : string|null
$system_node_type_id  : int|null
$system_node_type_name  : string|null
$tags  : array<string|int, mixed>
$totalTags  : int|null
$type  : Type|null
$type_id  : int|null
$unsaved_props  : array<string|int, mixed>
$updated_timestamp  : string|null
__construct()  : mixed
Node 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.
delete()  : mixed
Delete by ID
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()  : $this
Queries attributes for a given node add attaches it to the node object.
getChildren()  : $this
This function fetches all the nodes one level down
getConfig()  : TiqConfig
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
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
getInstance()  : Node
getLibrary()  : mixed
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
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
getTagCount()  : mixed
Gets the total tag count for the given node
getTagPath()  : mixed
Gets the tag path when looking down the tree
getTags()  : array<string|int, mixed>
Gets the tags for the given node
getTaxonomySystemNodeTypeId()  : int
getType()  : mixed
hasClassScript()  : bool
Checks all of the nodes' script to see if there is a class script
isDebug()  : bool
Is debug mode or not
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
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()

$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

$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'

$nodes

public array<string|int, mixed> $nodes = array()

$relationshipsDown

public array<string|int, mixed> $relationshipsDown = array()

$relationshipsUp

public array<string|int, mixed> $relationshipsUp = array()

$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()

$called_constructor

protected bool $called_constructor = false

$class_script

protected Script|null $class_script = null

$created_timestamp

protected string|null $created_timestamp = 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

$fqn

protected string|null $fqn = ''

$id

protected int|null $id = null

$id_path

protected string|null $id_path = ''

$is_root

protected bool|null $is_root = null

$operating_table

protected string $operating_table = 'nodes'

$part_of_id

protected int|null $part_of_id = null

$relative_name

protected string|null $relative_name = 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

$type_id

protected int|null $type_id = null

$unsaved_props

protected array<string|int, mixed> $unsaved_props = array()

$updated_timestamp

protected string|null $updated_timestamp = null

Methods

__construct()

Node constructor.

public __construct([ $identifier = null ][, array<string|int, mixed> $config = [] ][, array<string|int, mixed> $additionalMethods = [] ]) : mixed
Parameters
$identifier : = null

mixed FQN or ID

$config : array<string|int, mixed> = []
$additionalMethods : array<string|int, mixed> = []
Tags
throws
Exception
Return values
mixed

__get()

If the property is an attribute, then return the attribute object

public __get( $name) : mixed
Parameters
$name :
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

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
throws
Exception
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()

Queries attributes for a given node add attaches it to the node object.

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 = false ][, false $show_hidden_attributes = true ][, string $default_selected_ids = "" ]) : $this
Parameters
$column : string = 'display_name'

This is the name of the column we order by

$order : string = 'ASC'
$limit : int|null = null
$offset : int|null = null
$search_params : string|null = null

This parameter is a JSON object

$deep_search : bool = false

This toggles the ability to search not only immediate children but children of children

$show_hidden_attributes : false = true
$default_selected_ids : string = ""
Tags
throws
Exception
Return values
$this

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
throws
Exception
Return values
$this

getConfig()

public static getConfig() : TiqConfig
Return values
TiqConfig

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
throws
Exception
Return values
array<string|int, 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
throws
Exception
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

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
throws
Exception
Return values
Node

getLibrary()

public getLibrary() : mixed
Tags
throws
Exception
Return values
mixed

getNodeId()

Return the ID from and FQN

public static getNodeId(string $identifier) : int
Parameters
$identifier : string

FQN or ID

Tags
throws
Exception
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
throws
Exception
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
throws
Exception
Return values
$this

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
throws
Exception
Return values
Node

getSystemType()

Sets the system type name of the given attribute

public getSystemType() : Node
Return values
Node

getTagCount()

Gets the total tag count for the given node

public static getTagCount(int $id[, string|null $search_params = null ][, bool $deep_search = false ]) : mixed
Parameters
$id : int
$search_params : string|null = null
$deep_search : bool = false
Return values
mixed

getTagPath()

Gets the tag path when looking down the tree

public static getTagPath(int $id, string $relative_name) : mixed
Parameters
$id : int
$relative_name : string
Return values
mixed

getTags()

Gets the tags for the given node

public static getTags(int $id[, string $column = 'display_name' ][, string $order = 'ASC' ][, int|null $limit = null ][, int|null $offset = null ][, string|null $search_params = null ][, bool $deep_search = false ][, string $default_selected_ids = "" ]) : array<string|int, mixed>
Parameters
$id : int
$column : string = 'display_name'

This is the name of the column we order by

$order : string = 'ASC'
$limit : int|null = null
$offset : int|null = null
$search_params : string|null = null

This parameter is a JSON object

$deep_search : bool = false

This toggles the ability to search not only immediate children but children of children

$default_selected_ids : string = ""
Return values
array<string|int, mixed>

getTaxonomySystemNodeTypeId()

public static getTaxonomySystemNodeTypeId( $id) : int
Parameters
$id :
Return values
int

getType()

public getType() : mixed
Tags
throws
Exception
Return values
mixed

hasClassScript()

Checks all of the nodes' script to see if there is a class script

public hasClassScript() : bool
Tags
throws
Exception
Return values
bool

isDebug()

Is debug mode or not

public static isDebug() : bool
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
throws
PDOException
Return values
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
$data :
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> = []
Return values
mixed

Search results