Add validation for DefaultEdgeRuleChain in DeviceProfile
- Refactored parameter name for clarity
This commit is contained in:
		
							parent
							
								
									2ed8b4fe9d
								
							
						
					
					
						commit
						48c1842d42
					
				@ -209,12 +209,12 @@ public class DeviceProfileDataValidator extends AbstractHasOtaPackageValidator<D
 | 
				
			|||||||
        validateOtaPackage(tenantId, deviceProfile, deviceProfile.getId());
 | 
					        validateOtaPackage(tenantId, deviceProfile, deviceProfile.getId());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void validateRuleChain(TenantId tenantId, TenantId deviceTenantId, RuleChainId ruleChainId) {
 | 
					    private void validateRuleChain(TenantId tenantId, TenantId deviceProfileTenantId, RuleChainId ruleChainId) {
 | 
				
			||||||
        RuleChain ruleChain = ruleChainService.findRuleChainById(tenantId, ruleChainId);
 | 
					        RuleChain ruleChain = ruleChainService.findRuleChainById(tenantId, ruleChainId);
 | 
				
			||||||
        if (ruleChain == null) {
 | 
					        if (ruleChain == null) {
 | 
				
			||||||
            throw new DataValidationException("Can't assign non-existent rule chain!");
 | 
					            throw new DataValidationException("Can't assign non-existent rule chain!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (!ruleChain.getTenantId().equals(deviceTenantId)) {
 | 
					        if (!ruleChain.getTenantId().equals(deviceProfileTenantId)) {
 | 
				
			||||||
            throw new DataValidationException("Can't assign rule chain from different tenant!");
 | 
					            throw new DataValidationException("Can't assign rule chain from different tenant!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user