use of io.adminshell.aas.v3.model.BasicEvent 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
*/
private void addAasEvent(UaNode node, Event aasEvent, Submodel submodel, Reference parentRef, boolean ordered) throws StatusException {
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 (Exception ex) {
LOG.error("addAasEvent Exception", ex);
throw ex;
}
}
Aggregations