Browse Source

Add validation for Asset Profile FK in Rule Chains

pull/7611/head
Andrii Shvaika 4 years ago
parent
commit
6223307cd8
  1. 2
      dao/src/main/java/org/thingsboard/server/dao/rule/BaseRuleChainService.java

2
dao/src/main/java/org/thingsboard/server/dao/rule/BaseRuleChainService.java

@ -731,6 +731,8 @@ public class BaseRuleChainService extends AbstractEntityService implements RuleC
ConstraintViolationException e = extractConstraintViolationException(t).orElse(null);
if (e != null && e.getConstraintName() != null && e.getConstraintName().equalsIgnoreCase("fk_default_rule_chain_device_profile")) {
throw new DataValidationException("The rule chain referenced by the device profiles cannot be deleted!");
} else if (e != null && e.getConstraintName() != null && e.getConstraintName().equalsIgnoreCase("fk_default_rule_chain_asset_profile")) {
throw new DataValidationException("The rule chain referenced by the asset profiles cannot be deleted!");
} else {
throw t;
}

Loading…
Cancel
Save