Commit fe5215c7ccb6df14ae34fe81a07c4f61c164b8ce

Authored by Viacheslav Klimov
1 parent 2d845c78

Minor refactoring

... ... @@ -103,7 +103,6 @@ public class AdminController extends BaseController {
103 103 } else if (adminSettings.getKey().equals("sms")) {
104 104 smsService.updateSmsConfiguration();
105 105 }
106   -
107 106 return adminSettings;
108 107 } catch (Exception e) {
109 108 throw handleException(e);
... ...
... ... @@ -37,7 +37,6 @@ import org.thingsboard.server.common.data.relation.EntityRelation;
37 37 import org.thingsboard.server.common.data.relation.EntityRelationInfo;
38 38 import org.thingsboard.server.common.data.relation.EntityRelationsQuery;
39 39 import org.thingsboard.server.common.data.relation.RelationTypeGroup;
40   -import org.thingsboard.server.dao.service.ConstraintValidator;
41 40 import org.thingsboard.server.queue.util.TbCoreComponent;
42 41 import org.thingsboard.server.service.security.permission.Operation;
43 42
... ... @@ -85,7 +84,6 @@ public class EntityRelationController extends BaseController {
85 84 if (relation.getTypeGroup() == null) {
86 85 relation.setTypeGroup(RelationTypeGroup.COMMON);
87 86 }
88   - ConstraintValidator.validateFields(relation);
89 87 relationService.saveRelation(getTenantId(), relation);
90 88
91 89 logEntityAction(relation.getFrom(), null, getCurrentUser().getCustomerId(),
... ...
... ... @@ -95,6 +95,7 @@ public class ThingsboardErrorResponseHandler extends ResponseEntityExceptionHand
95 95 }
96 96 }
97 97
  98 +
98 99 private void handleThingsboardException(ThingsboardException thingsboardException, HttpServletResponse response) throws IOException {
99 100
100 101 ThingsboardErrorCode errorCode = thingsboardException.getErrorCode();
... ...
... ... @@ -41,6 +41,7 @@ import org.thingsboard.server.common.data.relation.RelationTypeGroup;
41 41 import org.thingsboard.server.common.data.relation.RelationsSearchParameters;
42 42 import org.thingsboard.server.dao.entity.EntityService;
43 43 import org.thingsboard.server.dao.exception.DataValidationException;
  44 +import org.thingsboard.server.dao.service.ConstraintValidator;
44 45
45 46 import javax.annotation.Nullable;
46 47 import java.util.ArrayList;
... ... @@ -559,6 +560,7 @@ public class BaseRelationService implements RelationService {
559 560 if (relation == null) {
560 561 throw new DataValidationException("Relation type should be specified!");
561 562 }
  563 + ConstraintValidator.validateFields(relation);
562 564 validate(relation.getFrom(), relation.getTo(), relation.getType(), relation.getTypeGroup());
563 565 }
564 566
... ...