Search in sources :

Example 1 with AASReferenceList

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;
    }
}
Also used : EmbeddedDataSpecification(io.adminshell.aas.v3.model.EmbeddedDataSpecification) Reference(io.adminshell.aas.v3.model.Reference) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) ArrayList(java.util.ArrayList) AASReferenceList(opc.i4aas.AASReferenceList)

Example 2 with AASReferenceList

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;
    }
}
Also used : IdentifierKeyValuePair(io.adminshell.aas.v3.model.IdentifierKeyValuePair) Reference(io.adminshell.aas.v3.model.Reference) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) UaQualifiedName(com.prosysopc.ua.UaQualifiedName) QualifiedName(com.prosysopc.ua.stack.builtintypes.QualifiedName) ByteString(com.prosysopc.ua.stack.builtintypes.ByteString) LangString(io.adminshell.aas.v3.model.LangString) AASAssetInformationType(opc.i4aas.AASAssetInformationType) AssetKind(io.adminshell.aas.v3.model.AssetKind) NodeId(com.prosysopc.ua.stack.builtintypes.NodeId) AASReferenceList(opc.i4aas.AASReferenceList) File(io.adminshell.aas.v3.model.File)

Example 3 with AASReferenceList

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;
    }
}
Also used : EmbeddedDataSpecification(io.adminshell.aas.v3.model.EmbeddedDataSpecification) Reference(io.adminshell.aas.v3.model.Reference) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) ArrayList(java.util.ArrayList) AASReferenceList(opc.i4aas.AASReferenceList)

Example 4 with AASReferenceList

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;
    }
}
Also used : Reference(io.adminshell.aas.v3.model.Reference) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) UaQualifiedName(com.prosysopc.ua.UaQualifiedName) QualifiedName(com.prosysopc.ua.stack.builtintypes.QualifiedName) NodeId(com.prosysopc.ua.stack.builtintypes.NodeId) AASReferenceList(opc.i4aas.AASReferenceList) Constraint(io.adminshell.aas.v3.model.Constraint)

Example 5 with AASReferenceList

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;
    }
}
Also used : EmbeddedDataSpecification(io.adminshell.aas.v3.model.EmbeddedDataSpecification) Reference(io.adminshell.aas.v3.model.Reference) DefaultReference(io.adminshell.aas.v3.model.impl.DefaultReference) ArrayList(java.util.ArrayList) AASReferenceList(opc.i4aas.AASReferenceList)

Aggregations

Reference (io.adminshell.aas.v3.model.Reference)7 DefaultReference (io.adminshell.aas.v3.model.impl.DefaultReference)7 AASReferenceList (opc.i4aas.AASReferenceList)7 EmbeddedDataSpecification (io.adminshell.aas.v3.model.EmbeddedDataSpecification)4 ArrayList (java.util.ArrayList)4 UaQualifiedName (com.prosysopc.ua.UaQualifiedName)3 NodeId (com.prosysopc.ua.stack.builtintypes.NodeId)3 QualifiedName (com.prosysopc.ua.stack.builtintypes.QualifiedName)3 ByteString (com.prosysopc.ua.stack.builtintypes.ByteString)2 Constraint (io.adminshell.aas.v3.model.Constraint)2 LangString (io.adminshell.aas.v3.model.LangString)2 UaNode (com.prosysopc.ua.nodes.UaNode)1 MethodManagerUaNode (com.prosysopc.ua.server.MethodManagerUaNode)1 NodeManagerUaNode (com.prosysopc.ua.server.NodeManagerUaNode)1 AssetKind (io.adminshell.aas.v3.model.AssetKind)1 File (io.adminshell.aas.v3.model.File)1 IdentifierKeyValuePair (io.adminshell.aas.v3.model.IdentifierKeyValuePair)1 AASAssetInformationType (opc.i4aas.AASAssetInformationType)1