Search in sources :

Example 1 with NodeConfiguration

use of org.thingsboard.rule.engine.api.NodeConfiguration in project thingsboard by thingsboard.

the class AnnotationComponentDiscoveryService method prepareNodeDefinition.

private NodeDefinition prepareNodeDefinition(RuleNode nodeAnnotation) throws Exception {
    NodeDefinition nodeDefinition = new NodeDefinition();
    nodeDefinition.setDetails(nodeAnnotation.nodeDetails());
    nodeDefinition.setDescription(nodeAnnotation.nodeDescription());
    nodeDefinition.setInEnabled(nodeAnnotation.inEnabled());
    nodeDefinition.setOutEnabled(nodeAnnotation.outEnabled());
    nodeDefinition.setRelationTypes(getRelationTypesWithFailureRelation(nodeAnnotation));
    nodeDefinition.setCustomRelations(nodeAnnotation.customRelations());
    nodeDefinition.setRuleChainNode(nodeAnnotation.ruleChainNode());
    Class<? extends NodeConfiguration> configClazz = nodeAnnotation.configClazz();
    NodeConfiguration config = configClazz.getDeclaredConstructor().newInstance();
    NodeConfiguration defaultConfiguration = config.defaultConfiguration();
    nodeDefinition.setDefaultConfiguration(mapper.valueToTree(defaultConfiguration));
    nodeDefinition.setUiResources(nodeAnnotation.uiResources());
    nodeDefinition.setConfigDirective(nodeAnnotation.configDirective());
    nodeDefinition.setIcon(nodeAnnotation.icon());
    nodeDefinition.setIconUrl(nodeAnnotation.iconUrl());
    nodeDefinition.setDocUrl(nodeAnnotation.docUrl());
    return nodeDefinition;
}
Also used : NodeDefinition(org.thingsboard.rule.engine.api.NodeDefinition) NodeConfiguration(org.thingsboard.rule.engine.api.NodeConfiguration)

Aggregations

NodeConfiguration (org.thingsboard.rule.engine.api.NodeConfiguration)1 NodeDefinition (org.thingsboard.rule.engine.api.NodeDefinition)1