Search in sources :

Example 1 with AASIdentifierKeyValuePairList

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;
    }
}
Also used : IdentifierKeyValuePair(io.adminshell.aas.v3.model.IdentifierKeyValuePair) AASIdentifierKeyValuePairList(opc.i4aas.AASIdentifierKeyValuePairList) UaQualifiedName(com.prosysopc.ua.UaQualifiedName) QualifiedName(com.prosysopc.ua.stack.builtintypes.QualifiedName) NodeId(com.prosysopc.ua.stack.builtintypes.NodeId)

Aggregations

UaQualifiedName (com.prosysopc.ua.UaQualifiedName)1 NodeId (com.prosysopc.ua.stack.builtintypes.NodeId)1 QualifiedName (com.prosysopc.ua.stack.builtintypes.QualifiedName)1 IdentifierKeyValuePair (io.adminshell.aas.v3.model.IdentifierKeyValuePair)1 AASIdentifierKeyValuePairList (opc.i4aas.AASIdentifierKeyValuePairList)1