ProfileExportProcessor
extends AbstractProfileProcessor
in package
uses
ApiServiceTrait
Table of Contents
Constants
- OPC_TYPES = ['Objects' => \TiqUtilities\Enums\OpcType::OBJECT, 'String' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'Integer' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'Double' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'Boolean' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'DateTime' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'Duration' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'Enumeration' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'FolderType' => \TiqUtilities\Enums\OpcType::OBJECT_TYPE, 'BaseObjectType' => \TiqUtilities\Enums\OpcType::OBJECT_TYPE, 'BaseDataVariableType' => \TiqUtilities\Enums\OpcType::VARIABLE_TYPE]
Properties
- $logger : AlertLogger
- $currentDate : string
- The date that the nodeset model was created
- $library : Library
- The library that is being processed
- $libraryDescription : string
- $libraryDisplayName : string
- $libraryId : string
- The library ID that is being processed
- $localModelUris : array<string|int, mixed>
- $namespaceUri : string
- $opcBaseProfile : array<string|int, mixed>
- This serves as a hash table for the base OPC UA types
- $opcUaClient : OPCWebApiService
- The OPC Web API client that is used to communicate with the OPC Web API
- $opcUaCustomSubTypes : array<string|int, mixed>
- The custom sub types that are created for the ThinkIQ library types
- $opcUaCustomTypes : array<string|int, mixed>
- An array of custom OPC UA types that represent the ThinkIQ library types, helps as a hash table for working with event objects and references types
- $projectId : string
- The project ID that the OPC Web API uses to keep track of the nodeset models
- $requiredModels : array<string|int, mixed>
- A collection of the required models that are needed for this nodeset model
- $targetNodesetNamespaceKey : string
- The namespace key for the main nodeset model
- $thinkIqApiFactory : mixed
- $thinkIqTypes : array<string|int, mixed>
- An array of custom OPC UA types that represent the base types such as Event Object, Reference, geopoint, ThinkIQ Scripts
- $thinkIqTypesToOpcUaType : array<string|int, mixed>
- Serves as a container for thinkiq types and the base opc ua types
- $tiqOpcUaLibraries : array<string|int, mixed>
- A collection of the ThinkIQ library namespaces as we process them in the nodeset models
- $types : array<string|int, mixed>
- The types that are being processed
- $version : string
- The version of the nodeset model
Methods
- __construct() : mixed
- downloadInfoModel() : array<string|int, mixed>|string
- Download the infomodel
- exportTypesToNodesetXml() : string
- This method is responsible for exporting the ThinkIQ types to the OPC UA nodeset model.
- findMatchingDataType() : string
- Find matching data type
- getInfomodelNamespaces() : array<string|int, mixed>|string
- Get the infomodel namespaces
- getInfoModels() : array<string|int, mixed>|string
- Get the infomodels from the API service
- getLibraryDescription() : string
- getLibraryDisplayName() : string
- getLogger() : AlertLogger
- Get the alert logger instance
- getNamespace() : string
- getProjectId() : string
- getRequiredModels() : array<string|int, mixed>
- getThinkIqLocalEnumTypes() : array<string|int, mixed>
- Get local enumeration types
- getThinkIqLocalLibraries() : array<string|int, mixed>
- Get local libraries
- loadUaNodes() : array<string|int, mixed>
- Creates a dictionary of UA nodes from the given project name space keys and project ID
- mapChildrenToNodes() : array<string|int, mixed>
- removeProject() : bool
- uploadInfomodel() : int
- Upload an infomodel to the API service
- createAndProcessThinkIqLibraryScripts() : void
- Create and process the ThinkIQ library scripts.
- createOpcType() : array<string|int, mixed>
- Helper method to create OPC UA Types
- findNodesetNamespace() : string
- Find the namespace for the nodeset model for the given library ID.
- findOrMakeCustomType() : string
- Find or make a custom type for the given ThinkIQ type.
- handleBulckPropertyCreation() : void
- Handle the bulk property creation.
- handleBulckScriptCreation() : void
- Handle the bulk script creation.
- handleSubTypeCreation() : bool
- This method is responsible for handling the creation of subTypes in the OPC UA server.
- processTypeReference() : bool
- Processes a type by validating its existence, resolving dependencies if necessary, and creating or assigning its reference in the system.
Constants
OPC_TYPES
public
mixed
OPC_TYPES
= ['Objects' => \TiqUtilities\Enums\OpcType::OBJECT, 'String' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'Integer' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'Double' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'Boolean' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'DateTime' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'Duration' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'Enumeration' => \TiqUtilities\Enums\OpcType::DATA_TYPE, 'FolderType' => \TiqUtilities\Enums\OpcType::OBJECT_TYPE, 'BaseObjectType' => \TiqUtilities\Enums\OpcType::OBJECT_TYPE, 'BaseDataVariableType' => \TiqUtilities\Enums\OpcType::VARIABLE_TYPE]
Properties
$logger
protected
AlertLogger
$logger
$currentDate
The date that the nodeset model was created
private
string
$currentDate
$library
The library that is being processed
private
Library
$library
$libraryDescription
private
string
$libraryDescription
$libraryDisplayName
private
string
$libraryDisplayName
$libraryId
The library ID that is being processed
private
string
$libraryId
$localModelUris
private
array<string|int, mixed>
$localModelUris
= []
- Contains the local model URIs that are loaded from the OPC UA client
$namespaceUri
private
string
$namespaceUri
$opcBaseProfile
This serves as a hash table for the base OPC UA types
private
array<string|int, mixed>
$opcBaseProfile
= []
$opcUaClient
The OPC Web API client that is used to communicate with the OPC Web API
private
OPCWebApiService
$opcUaClient
$opcUaCustomSubTypes
The custom sub types that are created for the ThinkIQ library types
private
array<string|int, mixed>
$opcUaCustomSubTypes
= []
$opcUaCustomTypes
An array of custom OPC UA types that represent the ThinkIQ library types, helps as a hash table for working with event objects and references types
private
array<string|int, mixed>
$opcUaCustomTypes
= []
$projectId
The project ID that the OPC Web API uses to keep track of the nodeset models
private
string
$projectId
$requiredModels
A collection of the required models that are needed for this nodeset model
private
array<string|int, mixed>
$requiredModels
= []
$targetNodesetNamespaceKey
The namespace key for the main nodeset model
private
string
$targetNodesetNamespaceKey
$thinkIqApiFactory
private
mixed
$thinkIqApiFactory
$thinkIqTypes
An array of custom OPC UA types that represent the base types such as Event Object, Reference, geopoint, ThinkIQ Scripts
private
array<string|int, mixed>
$thinkIqTypes
= []
$thinkIqTypesToOpcUaType
Serves as a container for thinkiq types and the base opc ua types
private
array<string|int, mixed>
$thinkIqTypesToOpcUaType
= []
$tiqOpcUaLibraries
A collection of the ThinkIQ library namespaces as we process them in the nodeset models
private
array<string|int, mixed>
$tiqOpcUaLibraries
= []
$types
The types that are being processed
private
array<string|int, mixed>
$types
$version
The version of the nodeset model
private
string
$version
Methods
__construct()
public
__construct(mixed $type, mixed $libraryId) : mixed
Parameters
- $type : mixed
- $libraryId : mixed
downloadInfoModel()
Download the infomodel
public
downloadInfoModel(ApiServiceFactory $apiService, int $nodesetId[, bool $nodesetXMLOnly = false ][, bool $metadataOnly = false ]) : array<string|int, mixed>|string
Parameters
- $apiService : ApiServiceFactory
-
- The API service
- $nodesetId : int
-
- The nodeset ID
- $nodesetXMLOnly : bool = false
-
- Whether to download only the nodeset XML
- $metadataOnly : bool = false
Return values
array<string|int, mixed>|string —- The response from the request
exportTypesToNodesetXml()
This method is responsible for exporting the ThinkIQ types to the OPC UA nodeset model.
public
exportTypesToNodesetXml() : string
It processes each type and its attributes, creating the corresponding OPC UA types and variables.
Return values
string —The generated nodeset XML as a string.
findMatchingDataType()
Find matching data type
public
findMatchingDataType(string $aOriginalDataTypeNodeId, mixed $projectNodeDictionary) : string
Parameters
- $aOriginalDataTypeNodeId : string
-
- The original data type node ID
- $projectNodeDictionary : mixed
Return values
string —- The matching data type
getInfomodelNamespaces()
Get the infomodel namespaces
public
getInfomodelNamespaces(ApiServiceFactory $apiService) : array<string|int, mixed>|string
Parameters
- $apiService : ApiServiceFactory
-
- The API service
Return values
array<string|int, mixed>|string —- The infomodel namespaces
getInfoModels()
Get the infomodels from the API service
public
getInfoModels(ApiServiceFactory $apiService) : array<string|int, mixed>|string
Parameters
- $apiService : ApiServiceFactory
-
- The API service
Return values
array<string|int, mixed>|stringgetLibraryDescription()
public
getLibraryDescription() : string
Return values
stringgetLibraryDisplayName()
public
getLibraryDisplayName() : string
Return values
stringgetLogger()
Get the alert logger instance
public
getLogger() : AlertLogger
Return values
AlertLoggergetNamespace()
public
getNamespace() : string
Return values
stringgetProjectId()
public
getProjectId() : string
Return values
stringgetRequiredModels()
public
getRequiredModels() : array<string|int, mixed>
Return values
array<string|int, mixed>getThinkIqLocalEnumTypes()
Get local enumeration types
public
getThinkIqLocalEnumTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>getThinkIqLocalLibraries()
Get local libraries
public
getThinkIqLocalLibraries() : array<string|int, mixed>
Return values
array<string|int, mixed>loadUaNodes()
Creates a dictionary of UA nodes from the given project name space keys and project ID
public
loadUaNodes(array<string|int, mixed> $projectNameSpaceKeys, string $projectId, OPCWebApiService $OPCWebApiService, OpcType $projectTypes) : array<string|int, mixed>
Parameters
- $projectNameSpaceKeys : array<string|int, mixed>
-
- The project name space keys
- $projectId : string
-
- The project ID
- $OPCWebApiService : OPCWebApiService
-
- The OPC Web API service
- $projectTypes : OpcType
-
- The project types
Return values
array<string|int, mixed> —$results - The results of the loaded nodes
mapChildrenToNodes()
public
static mapChildrenToNodes(array<string|int, mixed> $children, string $parentNodeId, array<string|int, mixed> $objectTypeNodeIdDic, string $baseNode) : array<string|int, mixed>
Parameters
- $children : array<string|int, mixed>
- $parentNodeId : string
- $objectTypeNodeIdDic : array<string|int, mixed>
- $baseNode : string
Return values
array<string|int, mixed>removeProject()
public
removeProject(string $projectId) : bool
Parameters
- $projectId : string
Return values
booluploadInfomodel()
Upload an infomodel to the API service
public
uploadInfomodel(ApiServiceFactory $apiService, array<string|int, mixed> $body[, bool $overwrite = false ]) : int
Parameters
- $apiService : ApiServiceFactory
-
- The API service
- $body : array<string|int, mixed>
-
- The body of the request containing the infomodel data
- $overwrite : bool = false
-
- Whether to overwrite an existing infomodel with the same name
Return values
int —- The ID of the uploaded infomodel
createAndProcessThinkIqLibraryScripts()
Create and process the ThinkIQ library scripts.
private
createAndProcessThinkIqLibraryScripts(string $namespace) : void
Parameters
- $namespace : string
-
The namespace where the scripts will be created.
createOpcType()
Helper method to create OPC UA Types
private
createOpcType(string $namespace, BaseNode $type) : array<string|int, mixed>
Parameters
- $namespace : string
-
The namespace for the OPC UA Type
- $type : BaseNode
-
The OPC UA Type to create
Return values
array<string|int, mixed> —The created OPC UA Type
findNodesetNamespace()
Find the namespace for the nodeset model for the given library ID.
private
findNodesetNamespace(string $libraryId, string $typeName) : string
Parameters
- $libraryId : string
-
The library ID that needs to be checked.
- $typeName : string
-
The name of the type that we are trying to resolve
Return values
string —The Namespace of the Nodeset Model that the type name was found in.
findOrMakeCustomType()
Find or make a custom type for the given ThinkIQ type.
private
findOrMakeCustomType(string $thinkIqType, string $namespace, bool $opcUaType, string $basedOpcUaType) : string
Parameters
- $thinkIqType : string
-
The ThinkIQ type that needs to be checked.
- $namespace : string
-
The namespace where the custom type will be created.
- $opcUaType : bool
-
TRUE indicates if the type is an OPC UA type, FALSE indicates a custom type.
- $basedOpcUaType : string
-
The base OPC UA type to be used for creating the custom type.
Return values
string —The node ID of the custom type.
handleBulckPropertyCreation()
Handle the bulk property creation.
private
handleBulckPropertyCreation(string $namespace, string $parentNodeId, array<string|int, mixed> $properties) : void
Parameters
- $namespace : string
-
The namespace where the properties will be created.
- $parentNodeId : string
-
The Node Id of the type that this new type will inherit from
- $properties : array<string|int, mixed>
-
The properties to be created.
handleBulckScriptCreation()
Handle the bulk script creation.
private
handleBulckScriptCreation(string $parentNodeId, string $namespace, array<string|int, mixed> $scripts) : void
Parameters
- $parentNodeId : string
-
The parent node ID where the scripts will be created.
- $namespace : string
-
The namespace where the scripts will be created.
- $scripts : array<string|int, mixed>
-
The scripts to be created.
handleSubTypeCreation()
This method is responsible for handling the creation of subTypes in the OPC UA server.
private
handleSubTypeCreation(string $subTypeId, string $typeName) : bool
It checks if the subType already exists, and if not, it creates it.
Parameters
- $subTypeId : string
-
The type ID of the subType.
- $typeName : string
-
The name of the type that we are trying to create
Return values
bool —True if we need to resolve the dependency first, false if we don't need to resolve it
processTypeReference()
Processes a type by validating its existence, resolving dependencies if necessary, and creating or assigning its reference in the system.
private
processTypeReference(string $typeId) : bool
Parameters
- $typeId : string
-
The ID of the type to process.
Return values
bool —Returns true if dependency resolution is required before proceeding, false otherwise.