use of opc.i4aas.AASIdentifierKeyValuePairList in project FAAAST-Service by FraunhoferIOSB.
the class AasServiceNodeManager method addSpecificAssetIds.
/**
* Adds a list of IdentifierKeyValuePairs to the given Node.
*
* @param assetInfoNode The AssetInformation node in which the
* IdentifierKeyValuePairs should be created or added
* @param list The desired list of IdentifierKeyValuePairs
* @param name The desired name of the Node
* @throws StatusException If the operation fails
*/
private void addSpecificAssetIds(AASAssetInformationType assetInfoNode, List<IdentifierKeyValuePair> list, String name) throws StatusException {
if (assetInfoNode == null) {
throw new IllegalArgumentException("assetInfoNode = null");
} else if (list == null) {
throw new IllegalArgumentException("list = null");
}
try {
logger.info("addSpecificAssetIds " + name + "; to Node: " + assetInfoNode.toString());
AASIdentifierKeyValuePairList listNode = assetInfoNode.getSpecificAssetIdNode();
boolean created = false;
if (listNode == null) {
QualifiedName browseName = UaQualifiedName.from(opc.i4aas.ObjectTypeIds.AASIdentifierKeyValuePairList.getNamespaceUri(), name).toQualifiedName(getNamespaceTable());
NodeId nid = createNodeId(assetInfoNode, browseName);
listNode = createInstance(AASIdentifierKeyValuePairList.class, nid, browseName, LocalizedText.english(name));
created = true;
}
for (IdentifierKeyValuePair ikv : list) {
if (ikv != null) {
addIdentifierKeyValuePair(listNode, ikv, ikv.getKey());
}
}
if (created) {
assetInfoNode.addComponent(listNode);
}
} catch (Throwable ex) {
logger.error("addSpecificAssetIds Exception", ex);
throw ex;
}
}
Aggregations