Search in sources :

Example 1 with DatabaseException

use of org.thingsboard.server.dao.exception.DatabaseException in project thingsboard by thingsboard.

the class BaseRuleService method updateLifeCycleState.

private void updateLifeCycleState(RuleId ruleId, ComponentLifecycleState state) {
    Validator.validateId(ruleId, "Incorrect rule id for state change request.");
    RuleMetaData rule = ruleDao.findById(ruleId);
    if (rule != null) {
        rule.setState(state);
        validateRuleAndPluginState(rule);
        ruleDao.save(rule);
    } else {
        throw new DatabaseException("Plugin not found!");
    }
}
Also used : RuleMetaData(org.thingsboard.server.common.data.rule.RuleMetaData) DatabaseException(org.thingsboard.server.dao.exception.DatabaseException)

Example 2 with DatabaseException

use of org.thingsboard.server.dao.exception.DatabaseException in project thingsboard by thingsboard.

the class BasePluginService method updateLifeCycleState.

private void updateLifeCycleState(PluginId pluginId, ComponentLifecycleState state) {
    Validator.validateId(pluginId, "Incorrect plugin id for state change request.");
    PluginMetaData plugin = pluginDao.findById(pluginId);
    if (plugin != null) {
        plugin.setState(state);
        pluginDao.save(plugin);
    } else {
        throw new DatabaseException("Plugin not found!");
    }
}
Also used : PluginMetaData(org.thingsboard.server.common.data.plugin.PluginMetaData) DatabaseException(org.thingsboard.server.dao.exception.DatabaseException)

Aggregations

DatabaseException (org.thingsboard.server.dao.exception.DatabaseException)2 PluginMetaData (org.thingsboard.server.common.data.plugin.PluginMetaData)1 RuleMetaData (org.thingsboard.server.common.data.rule.RuleMetaData)1