Commit f02304e2f347798c28c67330cfe77e778ae643a3

Authored by Vladyslav_Prykhodko
Committed by Andrew Shvayka
1 parent de44eb44

Add max fields length validation

@@ -44,6 +44,7 @@ public abstract class ContactBased<I extends UUIDBased> extends SearchTextBasedW @@ -44,6 +44,7 @@ public abstract class ContactBased<I extends UUIDBased> extends SearchTextBasedW
44 @Length(fieldName = "phone") 44 @Length(fieldName = "phone")
45 @NoXss 45 @NoXss
46 protected String phone; 46 protected String phone;
  47 + @Length(fieldName = "email")
47 @NoXss 48 @NoXss
48 protected String email; 49 protected String email;
49 50
@@ -35,6 +35,7 @@ public class DashboardInfo extends SearchTextBased<DashboardId> implements HasNa @@ -35,6 +35,7 @@ public class DashboardInfo extends SearchTextBased<DashboardId> implements HasNa
35 @NoXss 35 @NoXss
36 @Length(fieldName = "title") 36 @Length(fieldName = "title")
37 private String title; 37 private String title;
  38 + @Length(fieldName = "image", max = 1000000)
38 private String image; 39 private String image;
39 @Valid 40 @Valid
40 private Set<ShortCustomerInfo> assignedCustomers; 41 private Set<ShortCustomerInfo> assignedCustomers;
@@ -54,6 +54,7 @@ public class DeviceProfile extends SearchTextBased<DeviceProfileId> implements H @@ -54,6 +54,7 @@ public class DeviceProfile extends SearchTextBased<DeviceProfileId> implements H
54 @NoXss 54 @NoXss
55 @ApiModelProperty(position = 11, value = "Device Profile description. ") 55 @ApiModelProperty(position = 11, value = "Device Profile description. ")
56 private String description; 56 private String description;
  57 + @Length(fieldName = "image", max = 1000000)
57 @ApiModelProperty(position = 12, value = "Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. ") 58 @ApiModelProperty(position = 12, value = "Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. ")
58 private String image; 59 private String image;
59 private boolean isDefault; 60 private boolean isDefault;
@@ -26,7 +26,7 @@ import org.thingsboard.server.common.data.validation.NoXss; @@ -26,7 +26,7 @@ import org.thingsboard.server.common.data.validation.NoXss;
26 @JsonPropertyOrder({ "alias", "name", "image", "description", "descriptor" }) 26 @JsonPropertyOrder({ "alias", "name", "image", "description", "descriptor" })
27 public class WidgetTypeDetails extends WidgetType { 27 public class WidgetTypeDetails extends WidgetType {
28 28
29 - @NoXss 29 + @Length(fieldName = "image", max = 1000000)
30 @ApiModelProperty(position = 8, value = "Base64 encoded thumbnail", readOnly = true) 30 @ApiModelProperty(position = 8, value = "Base64 encoded thumbnail", readOnly = true)
31 private String image; 31 private String image;
32 @NoXss 32 @NoXss
@@ -50,6 +50,7 @@ public class WidgetsBundle extends SearchTextBased<WidgetsBundleId> implements H @@ -50,6 +50,7 @@ public class WidgetsBundle extends SearchTextBased<WidgetsBundleId> implements H
50 @ApiModelProperty(position = 5, value = "Title used in search and UI", readOnly = true) 50 @ApiModelProperty(position = 5, value = "Title used in search and UI", readOnly = true)
51 private String title; 51 private String title;
52 52
  53 + @Length(fieldName = "image", max = 1000000)
53 @Getter 54 @Getter
54 @Setter 55 @Setter
55 @ApiModelProperty(position = 6, value = "Base64 encoded thumbnail", readOnly = true) 56 @ApiModelProperty(position = 6, value = "Base64 encoded thumbnail", readOnly = true)