Search in sources :

Example 1 with AASCapabilityType

use of opc.i4aas.AASCapabilityType in project FAAAST-Service by FraunhoferIOSB.

the class AasServiceNodeManager method addAasCapability.

/**
 * Adds an AAS Capability to the given node.
 *
 * @param node The desired UA node
 * @param aasCapability The corresponding AAS Capability to add
 * @param submodel The corresponding Submodel as parent object of the data element
 * @param parentRef The AAS reference to the parent object
 * @param ordered Specifies whether the capability should be added ordered
 *            (true) or unordered (false)
 * @throws StatusException If the operation fails
 * @throws ServiceException If the operation fails
 * @throws AddressSpaceException If the operation fails
 * @throws ServiceResultException If the operation fails
 */
private void addAasCapability(UaNode node, Capability aasCapability, Submodel submodel, Reference parentRef, boolean ordered) throws StatusException, ServiceException, AddressSpaceException, ServiceResultException {
    try {
        if ((node != null) && (aasCapability != null)) {
            String name = aasCapability.getIdShort();
            QualifiedName browseName = UaQualifiedName.from(opc.i4aas.ObjectTypeIds.AASCapabilityType.getNamespaceUri(), name).toQualifiedName(getNamespaceTable());
            NodeId nid = getDefaultNodeId();
            AASCapabilityType capabilityNode = createInstance(AASCapabilityType.class, nid, browseName, LocalizedText.english(name));
            addSubmodelElementBaseData(capabilityNode, aasCapability);
            if (ordered) {
                node.addReference(capabilityNode, Identifiers.HasOrderedComponent, false);
            } else {
                node.addComponent(capabilityNode);
            }
            Reference capabilityRef = AasUtils.toReference(parentRef, aasCapability);
            referableMap.put(capabilityRef, new ObjectData(aasCapability, capabilityNode, submodel));
        }
    } catch (Throwable ex) {
        logger.error("addAasCapability Exception", ex);
        throw ex;
    }
}
Also used : Reference(io.adminshell.aas.v3.model.Reference) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) UaQualifiedName(com.prosysopc.ua.UaQualifiedName) QualifiedName(com.prosysopc.ua.stack.builtintypes.QualifiedName) NodeId(com.prosysopc.ua.stack.builtintypes.NodeId) ObjectData(de.fraunhofer.iosb.ilt.faaast.service.endpoint.opcua.data.ObjectData) ByteString(com.prosysopc.ua.stack.builtintypes.ByteString) LangString(io.adminshell.aas.v3.model.LangString) AASCapabilityType(opc.i4aas.AASCapabilityType)

Aggregations

UaQualifiedName (com.prosysopc.ua.UaQualifiedName)1 ByteString (com.prosysopc.ua.stack.builtintypes.ByteString)1 NodeId (com.prosysopc.ua.stack.builtintypes.NodeId)1 QualifiedName (com.prosysopc.ua.stack.builtintypes.QualifiedName)1 ObjectData (de.fraunhofer.iosb.ilt.faaast.service.endpoint.opcua.data.ObjectData)1 LangString (io.adminshell.aas.v3.model.LangString)1 Reference (io.adminshell.aas.v3.model.Reference)1 DefaultReference (io.adminshell.aas.v3.model.impl.DefaultReference)1 AASCapabilityType (opc.i4aas.AASCapabilityType)1