use of opc.i4aas.AASReferenceList in project FAAAST-Service by FraunhoferIOSB.
the class AasServiceNodeManager method addEmbeddedDataSpecifications.
/**
* Adds the references to the given Embedded Data Specifications.
*
* @param assetNode The desired node where the DataSpecifications should be added
* @param list The list of the desired Data Specifications
* @throws StatusException If the operation fails
*/
private void addEmbeddedDataSpecifications(AASAssetType assetNode, List<EmbeddedDataSpecification> list) throws StatusException {
try {
if ((list != null) && (!list.isEmpty())) {
List<Reference> refList = new ArrayList<>();
for (EmbeddedDataSpecification eds : list) {
refList.add(eds.getDataSpecification());
}
AASReferenceList listNode = assetNode.getDataSpecificationNode();
if (listNode == null) {
addAasReferenceList(assetNode, refList, AASAssetType.DATA_SPECIFICATION);
} else {
addEmbeddedDataSpecificationsReferences(listNode, refList);
}
}
} catch (Throwable ex) {
logger.error("addEmbeddedDataSpecifications Exception", ex);
throw ex;
}
}
use of opc.i4aas.AASReferenceList in project FAAAST-Service by FraunhoferIOSB.
the class AasServiceNodeManager method addAssetInformation.
/**
* Adds an AssetInformation object to the given Node.
*
* @param aasNode The AAS node where the AssetInformation should be added
* @param assetInformation The desired AssetInformation object
* @throws StatusException If the operation fails
*/
private void addAssetInformation(AASAssetAdministrationShellType aasNode, AssetInformation assetInformation) throws StatusException, ServiceException, AddressSpaceException, ServiceResultException {
if (aasNode == null) {
throw new IllegalArgumentException("aasNode = null");
} else if (assetInformation == null) {
throw new IllegalArgumentException("assetInformation = null");
}
try {
boolean created = false;
AASAssetInformationType assetInfoNode;
assetInfoNode = aasNode.getAssetInformationNode();
if (assetInfoNode == null) {
String displayName = "AssetInformation";
QualifiedName browseName = UaQualifiedName.from(opc.i4aas.ObjectTypeIds.AASSubmodelType.getNamespaceUri(), displayName).toQualifiedName(getNamespaceTable());
NodeId nid = createNodeId(aasNode, browseName);
assetInfoNode = createInstance(AASAssetInformationType.class, nid, browseName, LocalizedText.english(displayName));
created = true;
}
if (assetInfoNode != null) {
// AssetKind
AssetKind assetKind = assetInformation.getAssetKind();
assetInfoNode.setAssetKind(ValueConverter.convertAssetKind(assetKind));
// BillOfMaterials
List<Reference> assetBills = assetInformation.getBillOfMaterials();
if ((assetBills != null) && (!assetBills.isEmpty())) {
AASReferenceList assetBillsNode = assetInfoNode.getBillOfMaterialNode();
addBillOfMaterials(assetBillsNode, assetBills);
}
// DefaultThumbnail
File thumbnail = assetInformation.getDefaultThumbnail();
if (thumbnail != null) {
addAasFile(assetInfoNode, thumbnail, null, null, false, AASAssetInformationType.DEFAULT_THUMBNAIL);
}
// GlobalAssetId
Reference globalAssetId = assetInformation.getGlobalAssetId();
if (globalAssetId != null) {
addAasReferenceAasNS(assetInfoNode, globalAssetId, AASAssetInformationType.GLOBAL_ASSET_ID);
}
// SpecificAssetIds
List<IdentifierKeyValuePair> specificAssetIds = assetInformation.getSpecificAssetIds();
if ((specificAssetIds != null) && (!specificAssetIds.isEmpty())) {
addSpecificAssetIds(assetInfoNode, specificAssetIds, "SpecificAssetIds");
}
if (created) {
aasNode.addComponent(assetInfoNode);
}
}
} catch (Throwable ex) {
logger.error("addAssetInformation Exception", ex);
throw ex;
}
}
use of opc.i4aas.AASReferenceList in project FAAAST-Service by FraunhoferIOSB.
the class AasServiceNodeManager method addEmbeddedDataSpecifications.
/**
* Adds the references to the given Embedded Data Specifications.
*
* @param aasNode The desired object where the DataSpecifications should be added
* @param list The list of the desired Data Specifications
* @throws StatusException If the operation fails
*/
private void addEmbeddedDataSpecifications(AASAssetAdministrationShellType aasNode, List<EmbeddedDataSpecification> list) throws StatusException {
try {
if ((list != null) && (!list.isEmpty())) {
List<Reference> refList = new ArrayList<>();
for (EmbeddedDataSpecification eds : list) {
refList.add(eds.getDataSpecification());
}
AASReferenceList listNode = aasNode.getDataSpecificationNode();
if (listNode == null) {
addAasReferenceList(aasNode, refList, AASAssetAdministrationShellType.DATA_SPECIFICATION);
} else {
addEmbeddedDataSpecificationsReferences(listNode, refList);
}
}
} catch (Throwable ex) {
logger.error("addEmbeddedDataSpecifications Exception", ex);
throw ex;
}
}
use of opc.i4aas.AASReferenceList in project FAAAST-Service by FraunhoferIOSB.
the class AasServiceNodeManager method addAasReferenceList.
/**
* Creates a node with the given name and adds the given list of references.
*
* @param node The UA node in which the list of references should be created
* @param list The desired list of references
* @param name The desired name of the Node
* @throws StatusException If the operation fails
*/
private void addAasReferenceList(UaNode node, List<Reference> list, String name) throws StatusException {
if (node == null) {
throw new IllegalArgumentException("node = null");
} else if (list == null) {
throw new IllegalArgumentException("list = null");
}
try {
logger.info("addAasReferenceList " + name + "; to Node: " + node.toString());
QualifiedName browseName = UaQualifiedName.from(opc.i4aas.ObjectTypeIds.AASReferenceList.getNamespaceUri(), name).toQualifiedName(getNamespaceTable());
NodeId nid = getDefaultNodeId();
AASReferenceList referenceListNode = createInstance(AASReferenceList.class, nid, browseName, LocalizedText.english(name));
int counter = 1;
for (Reference ref : list) {
addAasReferenceAasNS(referenceListNode, ref, name + counter++);
}
node.addComponent(referenceListNode);
} catch (Throwable ex) {
logger.error("addAasReferenceList Exception", ex);
throw ex;
}
}
use of opc.i4aas.AASReferenceList in project FAAAST-Service by FraunhoferIOSB.
the class AasServiceNodeManager method addEmbeddedDataSpecifications.
/**
* Adds the references to the given Embedded Data Specifications.
*
* @param submodelNode The desired object where the DataSpecifications should be added
* @param list The list of the desired Data Specifications
* @throws StatusException If the operation fails
*/
private void addEmbeddedDataSpecifications(AASSubmodelType submodelNode, List<EmbeddedDataSpecification> list) throws StatusException {
try {
if ((list != null) && (!list.isEmpty())) {
List<Reference> refList = new ArrayList<>();
for (EmbeddedDataSpecification eds : list) {
refList.add(eds.getDataSpecification());
}
AASReferenceList listNode = submodelNode.getDataSpecificationNode();
if (listNode == null) {
addAasReferenceList(submodelNode, refList, AASSubmodelType.DATA_SPECIFICATION);
} else {
addEmbeddedDataSpecificationsReferences(listNode, refList);
}
}
} catch (Throwable ex) {
logger.error("addEmbeddedDataSpecifications Exception", ex);
throw ex;
}
}
Aggregations