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;
}
}
Aggregations