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