Minor refactoring
This commit is contained in:
		
							parent
							
								
									2d845c7840
								
							
						
					
					
						commit
						fe5215c7cc
					
				@ -103,7 +103,6 @@ public class AdminController extends BaseController {
 | 
			
		||||
            } else if (adminSettings.getKey().equals("sms")) {
 | 
			
		||||
                smsService.updateSmsConfiguration();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return adminSettings;
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            throw handleException(e);
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,6 @@ import org.thingsboard.server.common.data.relation.EntityRelation;
 | 
			
		||||
import org.thingsboard.server.common.data.relation.EntityRelationInfo;
 | 
			
		||||
import org.thingsboard.server.common.data.relation.EntityRelationsQuery;
 | 
			
		||||
import org.thingsboard.server.common.data.relation.RelationTypeGroup;
 | 
			
		||||
import org.thingsboard.server.dao.service.ConstraintValidator;
 | 
			
		||||
import org.thingsboard.server.queue.util.TbCoreComponent;
 | 
			
		||||
import org.thingsboard.server.service.security.permission.Operation;
 | 
			
		||||
 | 
			
		||||
@ -85,7 +84,6 @@ public class EntityRelationController extends BaseController {
 | 
			
		||||
            if (relation.getTypeGroup() == null) {
 | 
			
		||||
                relation.setTypeGroup(RelationTypeGroup.COMMON);
 | 
			
		||||
            }
 | 
			
		||||
            ConstraintValidator.validateFields(relation);
 | 
			
		||||
            relationService.saveRelation(getTenantId(), relation);
 | 
			
		||||
 | 
			
		||||
            logEntityAction(relation.getFrom(), null, getCurrentUser().getCustomerId(),
 | 
			
		||||
 | 
			
		||||
@ -95,6 +95,7 @@ public class ThingsboardErrorResponseHandler extends ResponseEntityExceptionHand
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private void handleThingsboardException(ThingsboardException thingsboardException, HttpServletResponse response) throws IOException {
 | 
			
		||||
 | 
			
		||||
        ThingsboardErrorCode errorCode = thingsboardException.getErrorCode();
 | 
			
		||||
 | 
			
		||||
@ -41,6 +41,7 @@ import org.thingsboard.server.common.data.relation.RelationTypeGroup;
 | 
			
		||||
import org.thingsboard.server.common.data.relation.RelationsSearchParameters;
 | 
			
		||||
import org.thingsboard.server.dao.entity.EntityService;
 | 
			
		||||
import org.thingsboard.server.dao.exception.DataValidationException;
 | 
			
		||||
import org.thingsboard.server.dao.service.ConstraintValidator;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Nullable;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@ -559,6 +560,7 @@ public class BaseRelationService implements RelationService {
 | 
			
		||||
        if (relation == null) {
 | 
			
		||||
            throw new DataValidationException("Relation type should be specified!");
 | 
			
		||||
        }
 | 
			
		||||
        ConstraintValidator.validateFields(relation);
 | 
			
		||||
        validate(relation.getFrom(), relation.getTo(), relation.getType(), relation.getTypeGroup());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user