use of com.prosysopc.ua.UaBrowsePath in project FAAAST-Service by FraunhoferIOSB.
the class AasServiceNodeManager method addAssetAdministrationShell.
/**
* Adds the given AssetAdministrationShell.
*
* @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 addAssetAdministrationShell(AssetAdministrationShell aas) throws StatusException, ServiceException, AddressSpaceException, ServiceResultException {
try {
TypeDefinitionBasedNodeBuilderConfiguration.Builder conf = TypeDefinitionBasedNodeBuilderConfiguration.builder();
Reference derivedFrom = aas.getDerivedFrom();
if (derivedFrom != null) {
UaBrowsePath bp = UaBrowsePath.from(opc.i4aas.ObjectTypeIds.AASAssetAdministrationShellType, UaQualifiedName.from(opc.i4aas.ObjectTypeIds.AASAssetAdministrationShellType.getNamespaceUri(), AASAssetAdministrationShellType.DERIVED_FROM));
conf.addOptional(bp);
}
this.setNodeBuilderConfiguration(conf.build());
QualifiedName browseName = UaQualifiedName.from(NAMESPACE_URI, aas.getIdShort()).toQualifiedName(getNamespaceTable());
String displayName = "AAS:" + aas.getIdShort();
NodeId nid = new NodeId(getNamespaceIndex(), aas.getIdShort());
if (findNode(nid) != null) {
// The NodeId already exists
nid = getDefaultNodeId();
}
AASAssetAdministrationShellType aasShell = createInstance(AASAssetAdministrationShellTypeNode.class, nid, browseName, LocalizedText.english(displayName));
addIdentifiable(aasShell, aas.getIdentification(), aas.getAdministration(), aas.getCategory());
// DataSpecifications
addEmbeddedDataSpecifications(aasShell, aas.getEmbeddedDataSpecifications());
// AssetInformation
AssetInformation assetInformation = aas.getAssetInformation();
if (assetInformation != null) {
addAssetInformation(aasShell, assetInformation);
}
// submodel references
List<Reference> submodelRefs = aas.getSubmodels();
if ((submodelRefs != null) && (!submodelRefs.isEmpty())) {
addSubmodelReferences(aasShell, submodelRefs);
}
// add AAS to Environment
addNodeAndReference(aasEnvironmentNode, aasShell, Identifiers.Organizes);
referableMap.put(AasUtils.toReference(aas), new ObjectData(aas, aasShell));
} catch (Throwable ex) {
logger.error("addAssetAdministrationShell Exception", ex);
throw ex;
}
}
Aggregations