ProfileImportProcessor
extends AbstractProfileProcessor
in package
uses
ApiServiceTrait
Table of Contents
Properties
- $cloudLibProfileIdsByNamespace : mixed
- $localEnumTypes : mixed
- $localLibraries : mixed
- $localStructureTypes : mixed
- $localVariableTypes : mixed
- $opcWebApi : BaseApiServiceFactory
- $projectCreatedNodeMap : Map
- $projectNodeDictionary : mixed
- $visitedNodes : array<string|int, mixed>
- $compositeDictionary : mixed
- $inProgress : mixed
- $libraryTypes : mixed
- A hash table that keeps track of the existing types of a library.
- $logger : AlertLogger
- $typesCreated : array<string|int, mixed>
- $projectId : string
Methods
- __construct() : mixed
- downloadInfoModel() : array<string|int, mixed>|string
- Download the infomodel
- extractEditStatusAndImportance() : array<string|int, mixed>
- Extracts the edit status and importance from the properties node IDs
- extractMeasurementUnitsFromCache() : bool
- fetchFile() : string
- findMatchingDataType() : string
- Find matching data type
- findOrFailMeasurementUnit() : array<string|int, mixed>
- Find or fail measurement unit
- findOrMakeLibrary() : Library
- Helper method to either create or retrieve a library from the system
- findOrMakeType() : Type
- Helper method to either find or make a ThinkIQ
- getInfomodelNamespaces() : array<string|int, mixed>|string
- Get the infomodel namespaces
- getInfoModels() : array<string|int, mixed>|string
- Get the infomodels from the API service
- getLibraryName() : string
- getLogger() : AlertLogger
- Get the alert logger instance
- getThinkIqLocalEnumTypes() : array<string|int, mixed>
- Get local enumeration types
- getThinkIqLocalLibraries() : array<string|int, mixed>
- Get local libraries
- importProfileTypes() : mixed
- loadUaNodes() : array<string|int, mixed>
- Creates a dictionary of UA nodes from the given project name space keys and project ID
- preprocessAndCache() : void
- Cache measurement unit abbreviations from the UNECE to OPC UA CSV
- processEnumType() : EnumerationType
- resolveVariableType() : Type
- Resolve variable type
- updateExistingAttributeRelativeName() : void
- Update existing attribute relative name
- uploadInfomodel() : int
- Upload an infomodel to the API service
- findMatchingUnitSymbol() : bool
- Find matching data type
- generateRelativeName() : mixed
- isJsonObject() : bool
- Checks to see if the given string is a JSON Object or not
- processThinkIQScript() : mixed
Properties
$cloudLibProfileIdsByNamespace
public
mixed
$cloudLibProfileIdsByNamespace
= []
$localEnumTypes
public
mixed
$localEnumTypes
= []
$localLibraries
public
mixed
$localLibraries
= []
$localStructureTypes
public
mixed
$localStructureTypes
= []
$localVariableTypes
public
mixed
$localVariableTypes
= []
$opcWebApi
public
BaseApiServiceFactory
$opcWebApi
$projectCreatedNodeMap
public
Map
$projectCreatedNodeMap
A map that keeps track of the nodes that were created during the import process. This is used to avoid creating the same node multiple times.
$projectNodeDictionary
public
mixed
$projectNodeDictionary
= []
$visitedNodes
public
array<string|int, mixed>
$visitedNodes
= []
$compositeDictionary
protected
mixed
$compositeDictionary
= []
$inProgress
protected
mixed
$inProgress
= []
$libraryTypes
A hash table that keeps track of the existing types of a library.
protected
mixed
$libraryTypes
= []
$logger
protected
AlertLogger
$logger
$typesCreated
protected
array<string|int, mixed>
$typesCreated
= []
$projectId
private
string
$projectId
Methods
__construct()
public
__construct(BaseApiServiceFactory $opcWebApi, mixed $loadedProject, mixed $infomodelNamespaces) : mixed
Parameters
- $opcWebApi : BaseApiServiceFactory
- $loadedProject : mixed
- $infomodelNamespaces : 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
extractEditStatusAndImportance()
Extracts the edit status and importance from the properties node IDs
public
static extractEditStatusAndImportance(array<string|int, mixed> &$propertiesNodeIds, array<string|int, mixed> $projectNodeDictionary) : array<string|int, mixed>
Parameters
- $propertiesNodeIds : array<string|int, mixed>
-
- The properties node IDs
- $projectNodeDictionary : array<string|int, mixed>
-
- The project node dictionary
Return values
array<string|int, mixed> —- An array containing the edit status and importance
extractMeasurementUnitsFromCache()
public
static extractMeasurementUnitsFromCache(string $cacheFile, string $unitSymbol) : bool
Parameters
- $cacheFile : string
- $unitSymbol : string
Return values
boolfetchFile()
public
static fetchFile(string $url) : string
Parameters
- $url : string
Return values
stringfindMatchingDataType()
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
findOrFailMeasurementUnit()
Find or fail measurement unit
public
findOrFailMeasurementUnit(string $unitName) : array<string|int, mixed>
Parameters
- $unitName : string
-
- The unit name
Return values
array<string|int, mixed> —- The measurement unit
findOrMakeLibrary()
Helper method to either create or retrieve a library from the system
public
findOrMakeLibrary(string $namespace, mixed $process) : Library
Parameters
- $namespace : string
-
- The namespace of the library
- $process : mixed
Return values
Library —- The library object
findOrMakeType()
Helper method to either find or make a ThinkIQ
public
findOrMakeType(string $displayName, string $description, string $superTypeNodeId, string $hostLibraryId[, int|null $editStatus = null ][, int|null $importance = null ]) : Type
Parameters
- $displayName : string
-
- The display name of the type
- $description : string
-
- The description of the type
- $superTypeNodeId : string
-
- The super type node ID
- $hostLibraryId : string
-
- The host library Id
- $editStatus : int|null = null
-
- The edit status of the types
- $importance : int|null = null
-
- The level of importance of the type
Return values
Type —- The created 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>|stringgetLibraryName()
public
static getLibraryName(string $namespace) : string
Parameters
- $namespace : string
Return values
stringgetLogger()
Get the alert logger instance
public
getLogger() : AlertLogger
Return values
AlertLoggergetThinkIqLocalEnumTypes()
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>importProfileTypes()
public
importProfileTypes(SplStack $profiles) : mixed
Parameters
- $profiles : SplStack
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
preprocessAndCache()
Cache measurement unit abbreviations from the UNECE to OPC UA CSV
public
static preprocessAndCache(string $cacheFile, string $fileContent) : void
Parameters
- $cacheFile : string
-
- The cache file
- $fileContent : string
processEnumType()
public
processEnumType(array<string|int, mixed> $enumType[, array<string|int, mixed> $enumMetaData = [] ]) : EnumerationType
Parameters
- $enumType : array<string|int, mixed>
- $enumMetaData : array<string|int, mixed> = []
Return values
EnumerationTyperesolveVariableType()
Resolve variable type
public
resolveVariableType(string $id, TypeToAttributeType $newAttribute, SplStack $stackOfDataVariables, array<string|int, mixed> &$localVariableTypes, string $typeToAttributeDataTypeNodeId, string $variableTypesNodeId, array<string|int, mixed> &$processingNodes, array<string|int, mixed> &$visitedDataVariables) : Type
Parameters
- $id : string
-
- The ID
- $newAttribute : TypeToAttributeType
-
- The new attribute
- $stackOfDataVariables : SplStack
-
- The stack of data variables
- $localVariableTypes : array<string|int, mixed>
-
- The local variable types
- $typeToAttributeDataTypeNodeId : string
-
- The type to attribute data type node ID
- $variableTypesNodeId : string
-
- The variable types node ID
- $processingNodes : array<string|int, mixed>
-
- The processing nodes
- $visitedDataVariables : array<string|int, mixed>
-
- The visited data variables
Return values
Type —- The resolved variable type
updateExistingAttributeRelativeName()
Update existing attribute relative name
public
updateExistingAttributeRelativeName(int $attributeId, string $displayName, int $typeId) : void
Parameters
- $attributeId : int
-
- The attribute ID
- $displayName : string
- $typeId : int
-
- The type ID
uploadInfomodel()
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
findMatchingUnitSymbol()
Find matching data type
private
findMatchingUnitSymbol(string|null $unitSymbol) : bool
Parameters
- $unitSymbol : string|null
Return values
bool —- TRUE if the data type was found, FALSE otherwise
generateRelativeName()
private
generateRelativeName(string $displayName, mixed $typeId) : mixed
Parameters
- $displayName : string
- $typeId : mixed
isJsonObject()
Checks to see if the given string is a JSON Object or not
private
isJsonObject(string $string) : bool
Parameters
- $string : string
-
The string to that we are checking.
Return values
bool —TRUE if is a JSON Object False otherwise
processThinkIQScript()
private
processThinkIQScript(string $displayName, string $description, string $partOfId, array<string|int, mixed> $properties) : mixed
Parameters
- $displayName : string
- $description : string
- $partOfId : string
- $properties : array<string|int, mixed>