Search in sources :

Example 1 with AdministrativeInformation

use of io.adminshell.aas.v3.model.AdministrativeInformation in project FAAAST-Service by FraunhoferIOSB.

the class AasServiceNodeManager method addAdminInformationProperties.

/**
 * Adds the AdminInformation Properties to the given node (if they don't
 * exist).
 *
 * @param adminInfNode The desired AdminInformation node
 * @param info The corresponding AAS AdministrativeInformation object
 */
private void addAdminInformationProperties(AASAdministrativeInformationType adminInfNode, AdministrativeInformation info) {
    try {
        if ((adminInfNode != null) && (info != null)) {
            if (info.getVersion() != null) {
                if (adminInfNode.getVersionNode() == null) {
                    NodeId myPropertyId = new NodeId(getNamespaceIndex(), adminInfNode.getNodeId().getValue().toString() + "." + AASAdministrativeInformationType.VERSION);
                    PlainProperty<String> myProperty = new PlainProperty<>(this, myPropertyId, UaQualifiedName.from(opc.i4aas.ObjectTypeIds.AASAssetAdministrationShellType.getNamespaceUri(), AASAdministrativeInformationType.VERSION).toQualifiedName(getNamespaceTable()), LocalizedText.english(AASAdministrativeInformationType.VERSION));
                    myProperty.setDataTypeId(Identifiers.String);
                    if (VALUES_READ_ONLY) {
                        myProperty.setAccessLevel(AccessLevelType.CurrentRead);
                    }
                    myProperty.setDescription(new LocalizedText("", ""));
                    adminInfNode.addProperty(myProperty);
                }
                adminInfNode.setVersion(info.getVersion());
            }
            if (info.getRevision() != null) {
                if (adminInfNode.getRevisionNode() == null) {
                    NodeId myPropertyId = new NodeId(getNamespaceIndex(), adminInfNode.getNodeId().getValue().toString() + "." + AASAdministrativeInformationType.REVISION);
                    PlainProperty<String> myProperty = new PlainProperty<>(this, myPropertyId, UaQualifiedName.from(opc.i4aas.ObjectTypeIds.AASAssetAdministrationShellType.getNamespaceUri(), AASAdministrativeInformationType.REVISION).toQualifiedName(getNamespaceTable()), LocalizedText.english(AASAdministrativeInformationType.REVISION));
                    myProperty.setDataTypeId(Identifiers.String);
                    if (VALUES_READ_ONLY) {
                        myProperty.setAccessLevel(AccessLevelType.CurrentRead);
                    }
                    myProperty.setDescription(new LocalizedText("", ""));
                    adminInfNode.addProperty(myProperty);
                }
                adminInfNode.setRevision(info.getRevision());
            }
        }
    } catch (Exception ex) {
        LOG.error("addAdminInfProperties Exception", ex);
    }
}
Also used : PlainProperty(com.prosysopc.ua.server.nodes.PlainProperty) NodeId(com.prosysopc.ua.stack.builtintypes.NodeId) ByteString(com.prosysopc.ua.stack.builtintypes.ByteString) LangString(io.adminshell.aas.v3.model.LangString) LocalizedText(com.prosysopc.ua.stack.builtintypes.LocalizedText) ServiceResultException(com.prosysopc.ua.stack.common.ServiceResultException) StatusException(com.prosysopc.ua.StatusException) MessageBusException(de.fraunhofer.iosb.ilt.faaast.service.exception.MessageBusException) ServiceException(com.prosysopc.ua.ServiceException) UaNodeFactoryException(com.prosysopc.ua.nodes.UaNodeFactoryException) AddressSpaceException(com.prosysopc.ua.client.AddressSpaceException)

Aggregations

ServiceException (com.prosysopc.ua.ServiceException)1 StatusException (com.prosysopc.ua.StatusException)1 AddressSpaceException (com.prosysopc.ua.client.AddressSpaceException)1 UaNodeFactoryException (com.prosysopc.ua.nodes.UaNodeFactoryException)1 PlainProperty (com.prosysopc.ua.server.nodes.PlainProperty)1 ByteString (com.prosysopc.ua.stack.builtintypes.ByteString)1 LocalizedText (com.prosysopc.ua.stack.builtintypes.LocalizedText)1 NodeId (com.prosysopc.ua.stack.builtintypes.NodeId)1 ServiceResultException (com.prosysopc.ua.stack.common.ServiceResultException)1 MessageBusException (de.fraunhofer.iosb.ilt.faaast.service.exception.MessageBusException)1 LangString (io.adminshell.aas.v3.model.LangString)1