Search in sources :

Example 1 with AASIriConceptDescriptionType

use of opc.i4aas.AASIriConceptDescriptionType in project FAAAST-Service by FraunhoferIOSB.

the class AasServiceNodeManager method addConceptDescriptions.

/**
 * Adds the given list of AAS Concept Descriptions.
 *
 * @param descriptions The desired list of AAS Concept Descriptions
 * @throws StatusException If the operation fails
 * @throws ServiceResultException Generic service exception
 */
private void addConceptDescriptions(List<ConceptDescription> descriptions) throws StatusException, ServiceResultException {
    try {
        // create folder DictionaryEntries
        final UaNode dictionariesFolder = getServer().getNodeManagerRoot().getNodeOrExternal(Identifiers.Dictionaries);
        // Folder for my objects
        final NodeId dictionarieEntriesFolderId = new NodeId(getNamespaceIndex(), "Dictionaries.DictionaryEntries");
        FolderTypeNode dictEntriesFolder = createInstance(FolderTypeNode.class, "DictionaryEntries", dictionarieEntriesFolderId);
        this.addNodeAndReference(dictionariesFolder, dictEntriesFolder, Identifiers.Organizes);
        for (ConceptDescription c : descriptions) {
            String name = c.getIdShort();
            NodeId nid = createNodeId(dictionariesFolder, name);
            DictionaryEntryType dictNode;
            switch(c.getIdentification().getIdType()) {
                case IRDI:
                    AASIrdiConceptDescriptionType irdiNode = createInstance(AASIrdiConceptDescriptionType.class, name, nid);
                    addIdentifiable(irdiNode, c.getIdentification(), c.getAdministration(), name);
                    addConceptDescriptionReference(irdiNode, getReference(c));
                    dictEntriesFolder.addComponent(irdiNode);
                    dictionaryMap.put(getReference(c), irdiNode);
                    dictNode = irdiNode;
                    break;
                case IRI:
                    AASIriConceptDescriptionType iriNode = createInstance(AASIriConceptDescriptionType.class, name, nid);
                    addIdentifiable(iriNode, c.getIdentification(), c.getAdministration(), name);
                    addConceptDescriptionReference(iriNode, getReference(c));
                    dictEntriesFolder.addComponent(iriNode);
                    dictionaryMap.put(getReference(c), iriNode);
                    dictNode = iriNode;
                    break;
                default:
                    AASCustomConceptDescriptionType customNode = createInstance(AASCustomConceptDescriptionType.class, name, nid);
                    addIdentifiable(customNode, c.getIdentification(), c.getAdministration(), name);
                    addConceptDescriptionReference(customNode, getReference(c));
                    dictEntriesFolder.addComponent(customNode);
                    dictionaryMap.put(getReference(c), customNode);
                    dictNode = customNode;
                    break;
            }
            referableMap.put(AasUtils.toReference(c), new ObjectData(c, dictNode));
        }
    } catch (Throwable ex) {
        logger.error("addConceptDescriptions Exception", ex);
        throw ex;
    }
}
Also used : AASIriConceptDescriptionType(opc.i4aas.AASIriConceptDescriptionType) DictionaryEntryType(com.prosysopc.ua.types.opcua.DictionaryEntryType) AASCustomConceptDescriptionType(opc.i4aas.AASCustomConceptDescriptionType) NodeId(com.prosysopc.ua.stack.builtintypes.NodeId) ObjectData(de.fraunhofer.iosb.ilt.faaast.service.endpoint.opcua.data.ObjectData) UaNode(com.prosysopc.ua.nodes.UaNode) NodeManagerUaNode(com.prosysopc.ua.server.NodeManagerUaNode) MethodManagerUaNode(com.prosysopc.ua.server.MethodManagerUaNode) ConceptDescription(io.adminshell.aas.v3.model.ConceptDescription) ByteString(com.prosysopc.ua.stack.builtintypes.ByteString) LangString(io.adminshell.aas.v3.model.LangString) FolderTypeNode(com.prosysopc.ua.types.opcua.server.FolderTypeNode) AASIrdiConceptDescriptionType(opc.i4aas.AASIrdiConceptDescriptionType)

Aggregations

UaNode (com.prosysopc.ua.nodes.UaNode)1 MethodManagerUaNode (com.prosysopc.ua.server.MethodManagerUaNode)1 NodeManagerUaNode (com.prosysopc.ua.server.NodeManagerUaNode)1 ByteString (com.prosysopc.ua.stack.builtintypes.ByteString)1 NodeId (com.prosysopc.ua.stack.builtintypes.NodeId)1 DictionaryEntryType (com.prosysopc.ua.types.opcua.DictionaryEntryType)1 FolderTypeNode (com.prosysopc.ua.types.opcua.server.FolderTypeNode)1 ObjectData (de.fraunhofer.iosb.ilt.faaast.service.endpoint.opcua.data.ObjectData)1 ConceptDescription (io.adminshell.aas.v3.model.ConceptDescription)1 LangString (io.adminshell.aas.v3.model.LangString)1 AASCustomConceptDescriptionType (opc.i4aas.AASCustomConceptDescriptionType)1 AASIrdiConceptDescriptionType (opc.i4aas.AASIrdiConceptDescriptionType)1 AASIriConceptDescriptionType (opc.i4aas.AASIriConceptDescriptionType)1