Search in sources :

Example 1 with AASEventType

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

the class AasServiceNodeManager method addAasEvent.

/**
 * Adds an AAS Event to the given node.
 *
 * @param node The desired UA node
 * @param aasEvent The AAS Event 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 entity 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 addAasEvent(UaNode node, Event aasEvent, Submodel submodel, Reference parentRef, boolean ordered) throws StatusException, ServiceException, AddressSpaceException, ServiceResultException {
    try {
        if ((node != null) && (aasEvent != null)) {
            String name = aasEvent.getIdShort();
            QualifiedName browseName = UaQualifiedName.from(opc.i4aas.ObjectTypeIds.AASEventType.getNamespaceUri(), name).toQualifiedName(getNamespaceTable());
            NodeId nid = getDefaultNodeId();
            AASEventType eventNode = createInstance(AASEventType.class, nid, browseName, LocalizedText.english(name));
            addSubmodelElementBaseData(eventNode, aasEvent);
            if (aasEvent instanceof BasicEvent) {
                setBasicEventData(eventNode, (BasicEvent) aasEvent);
            }
            Reference eventRef = AasUtils.toReference(parentRef, aasEvent);
            if (ordered) {
                node.addReference(eventNode, Identifiers.HasOrderedComponent, false);
            } else {
                node.addComponent(eventNode);
            }
            referableMap.put(eventRef, new ObjectData(aasEvent, eventNode, submodel));
        }
    } catch (Throwable ex) {
        logger.error("addAasEvent 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) BasicEvent(io.adminshell.aas.v3.model.BasicEvent) ByteString(com.prosysopc.ua.stack.builtintypes.ByteString) LangString(io.adminshell.aas.v3.model.LangString) AASEventType(opc.i4aas.AASEventType)

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 BasicEvent (io.adminshell.aas.v3.model.BasicEvent)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 AASEventType (opc.i4aas.AASEventType)1