Commit 3382333634102b3daf917be1181d207d50eee0ec
1 parent
96cdae87
Restore after violation of the OOP rules
Showing
6 changed files
with
62 additions
and
63 deletions
@@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.RequestParam; | @@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.RequestParam; | ||
28 | import org.springframework.web.bind.annotation.ResponseBody; | 28 | import org.springframework.web.bind.annotation.ResponseBody; |
29 | import org.springframework.web.bind.annotation.RestController; | 29 | import org.springframework.web.bind.annotation.RestController; |
30 | import org.thingsboard.server.common.data.Event; | 30 | import org.thingsboard.server.common.data.Event; |
31 | -import org.thingsboard.server.common.data.event.BaseEventFilter; | 31 | +import org.thingsboard.server.common.data.event.EventFilter; |
32 | import org.thingsboard.server.common.data.exception.ThingsboardException; | 32 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
33 | import org.thingsboard.server.common.data.id.EntityId; | 33 | import org.thingsboard.server.common.data.id.EntityId; |
34 | import org.thingsboard.server.common.data.id.EntityIdFactory; | 34 | import org.thingsboard.server.common.data.id.EntityIdFactory; |
@@ -162,7 +162,7 @@ public class EventController extends BaseController { | @@ -162,7 +162,7 @@ public class EventController extends BaseController { | ||
162 | @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | 162 | @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) |
163 | @RequestParam int page, | 163 | @RequestParam int page, |
164 | @ApiParam(value = "A JSON value representing the event filter.", required = true) | 164 | @ApiParam(value = "A JSON value representing the event filter.", required = true) |
165 | - @RequestBody BaseEventFilter eventFilter, | 165 | + @RequestBody EventFilter eventFilter, |
166 | @ApiParam(value = EVENT_TEXT_SEARCH_DESCRIPTION) | 166 | @ApiParam(value = EVENT_TEXT_SEARCH_DESCRIPTION) |
167 | @RequestParam(required = false) String textSearch, | 167 | @RequestParam(required = false) String textSearch, |
168 | @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = EVENT_SORT_PROPERTY_ALLOWABLE_VALUES) | 168 | @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = EVENT_SORT_PROPERTY_ALLOWABLE_VALUES) |
common/data/src/main/java/org/thingsboard/server/common/data/event/BaseEventFilter.java
deleted
100644 → 0
1 | -/** | ||
2 | - * Copyright © 2016-2021 The Thingsboard Authors | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | -package org.thingsboard.server.common.data.event; | ||
17 | - | ||
18 | -import io.swagger.annotations.ApiModel; | ||
19 | -import io.swagger.annotations.ApiModelProperty; | ||
20 | -import lombok.Data; | ||
21 | - | ||
22 | -@ApiModel | ||
23 | -@Data | ||
24 | -public abstract class BaseEventFilter implements EventFilter { | ||
25 | - | ||
26 | - @ApiModelProperty(position = 1, value = "String value representing msg direction type (incoming to entity or outcoming from entity)", allowableValues = "IN, OUT") | ||
27 | - protected String msgDirectionType; | ||
28 | - @ApiModelProperty(position = 2, value = "String value representing the server name, identifier or ip address where the platform is running", example = "ip-172-31-24-152") | ||
29 | - protected String server; | ||
30 | - @ApiModelProperty(position = 3, value = "The case insensitive 'contains' filter based on data (key and value) for the message.", example = "humidity") | ||
31 | - protected String dataSearch; | ||
32 | - @ApiModelProperty(position = 4, value = "The case insensitive 'contains' filter based on metadata (key and value) for the message.", example = "deviceName") | ||
33 | - protected String metadataSearch; | ||
34 | - @ApiModelProperty(position = 5, value = "String value representing the entity type", allowableValues = "DEVICE") | ||
35 | - protected String entityName; | ||
36 | - @ApiModelProperty(position = 6, value = "String value representing the type of message routing", example = "Success") | ||
37 | - protected String relationType; | ||
38 | - @ApiModelProperty(position = 7, value = "String value representing the entity id in the event body (originator of the message)", example = "de9d54a0-2b7a-11ec-a3cc-23386423d98f") | ||
39 | - protected String entityId; | ||
40 | - @ApiModelProperty(position = 8, value = "String value representing the message type", example = "POST_TELEMETRY_REQUEST") | ||
41 | - protected String msgType; | ||
42 | - @ApiModelProperty(position = 9, value = "Boolean value to filter the errors", allowableValues = "false, true") | ||
43 | - protected boolean isError; | ||
44 | - @ApiModelProperty(position = 10, value = "The case insensitive 'contains' filter based on error message", example = "not present in the DB") | ||
45 | - protected String errorStr; | ||
46 | - @ApiModelProperty(position = 11, value = "String value representing the method name when the error happened", example = "onClusterEventMsg") | ||
47 | - protected String method; | ||
48 | - @ApiModelProperty(position = 12, value = "The minimum number of successfully processed messages", example = "25") | ||
49 | - protected Integer messagesProcessed; | ||
50 | - @ApiModelProperty(position = 13, value = "The minimum number of errors occurred during messages processing", example = "30") | ||
51 | - protected Integer errorsOccurred; | ||
52 | - @ApiModelProperty(position = 14, value = "String value representing the lifecycle event type", example = "STARTED") | ||
53 | - protected String event; | ||
54 | - @ApiModelProperty(position = 15, value = "String value representing status of the lifecycle event", allowableValues = "Success, Failure") | ||
55 | - protected String status; | ||
56 | - | ||
57 | -} |
@@ -16,10 +16,34 @@ | @@ -16,10 +16,34 @@ | ||
16 | package org.thingsboard.server.common.data.event; | 16 | package org.thingsboard.server.common.data.event; |
17 | 17 | ||
18 | import io.swagger.annotations.ApiModel; | 18 | import io.swagger.annotations.ApiModel; |
19 | +import io.swagger.annotations.ApiModelProperty; | ||
20 | +import lombok.Data; | ||
19 | import org.thingsboard.server.common.data.StringUtils; | 21 | import org.thingsboard.server.common.data.StringUtils; |
20 | 22 | ||
23 | +@Data | ||
21 | @ApiModel | 24 | @ApiModel |
22 | -public abstract class DebugEvent extends BaseEventFilter implements EventFilter { | 25 | +public abstract class DebugEvent implements EventFilter { |
26 | + | ||
27 | + @ApiModelProperty(position = 1, value = "String value representing msg direction type (incoming to entity or outcoming from entity)", allowableValues = "IN, OUT") | ||
28 | + protected String msgDirectionType; | ||
29 | + @ApiModelProperty(position = 2, value = "String value representing the server name, identifier or ip address where the platform is running", example = "ip-172-31-24-152") | ||
30 | + protected String server; | ||
31 | + @ApiModelProperty(position = 3, value = "The case insensitive 'contains' filter based on data (key and value) for the message.", example = "humidity") | ||
32 | + protected String dataSearch; | ||
33 | + @ApiModelProperty(position = 4, value = "The case insensitive 'contains' filter based on metadata (key and value) for the message.", example = "deviceName") | ||
34 | + protected String metadataSearch; | ||
35 | + @ApiModelProperty(position = 5, value = "String value representing the entity type", allowableValues = "DEVICE") | ||
36 | + protected String entityName; | ||
37 | + @ApiModelProperty(position = 6, value = "String value representing the type of message routing", example = "Success") | ||
38 | + protected String relationType; | ||
39 | + @ApiModelProperty(position = 7, value = "String value representing the entity id in the event body (originator of the message)", example = "de9d54a0-2b7a-11ec-a3cc-23386423d98f") | ||
40 | + protected String entityId; | ||
41 | + @ApiModelProperty(position = 8, value = "String value representing the message type", example = "POST_TELEMETRY_REQUEST") | ||
42 | + protected String msgType; | ||
43 | + @ApiModelProperty(position = 9, value = "Boolean value to filter the errors", allowableValues = "false, true") | ||
44 | + protected boolean isError; | ||
45 | + @ApiModelProperty(position = 10, value = "The case insensitive 'contains' filter based on error message", example = "not present in the DB") | ||
46 | + protected String errorStr; | ||
23 | 47 | ||
24 | public void setIsError(boolean isError) { | 48 | public void setIsError(boolean isError) { |
25 | this.isError = isError; | 49 | this.isError = isError; |
@@ -16,10 +16,20 @@ | @@ -16,10 +16,20 @@ | ||
16 | package org.thingsboard.server.common.data.event; | 16 | package org.thingsboard.server.common.data.event; |
17 | 17 | ||
18 | import io.swagger.annotations.ApiModel; | 18 | import io.swagger.annotations.ApiModel; |
19 | +import io.swagger.annotations.ApiModelProperty; | ||
20 | +import lombok.Data; | ||
19 | import org.thingsboard.server.common.data.StringUtils; | 21 | import org.thingsboard.server.common.data.StringUtils; |
20 | 22 | ||
23 | +@Data | ||
21 | @ApiModel | 24 | @ApiModel |
22 | -public class ErrorEventFilter extends BaseEventFilter implements EventFilter { | 25 | +public class ErrorEventFilter implements EventFilter { |
26 | + | ||
27 | + @ApiModelProperty(position = 1, value = "String value representing the server name, identifier or ip address where the platform is running", example = "ip-172-31-24-152") | ||
28 | + protected String server; | ||
29 | + @ApiModelProperty(position = 2, value = "String value representing the method name when the error happened", example = "onClusterEventMsg") | ||
30 | + protected String method; | ||
31 | + @ApiModelProperty(position = 3, value = "The case insensitive 'contains' filter based on error message", example = "not present in the DB") | ||
32 | + protected String errorStr; | ||
23 | 33 | ||
24 | @Override | 34 | @Override |
25 | public EventType getEventType() { | 35 | public EventType getEventType() { |
@@ -16,10 +16,22 @@ | @@ -16,10 +16,22 @@ | ||
16 | package org.thingsboard.server.common.data.event; | 16 | package org.thingsboard.server.common.data.event; |
17 | 17 | ||
18 | import io.swagger.annotations.ApiModel; | 18 | import io.swagger.annotations.ApiModel; |
19 | +import io.swagger.annotations.ApiModelProperty; | ||
20 | +import lombok.Data; | ||
19 | import org.thingsboard.server.common.data.StringUtils; | 21 | import org.thingsboard.server.common.data.StringUtils; |
20 | 22 | ||
23 | +@Data | ||
21 | @ApiModel | 24 | @ApiModel |
22 | -public class LifeCycleEventFilter extends BaseEventFilter implements EventFilter { | 25 | +public class LifeCycleEventFilter implements EventFilter { |
26 | + | ||
27 | + @ApiModelProperty(position = 1, value = "String value representing the server name, identifier or ip address where the platform is running", example = "ip-172-31-24-152") | ||
28 | + protected String server; | ||
29 | + @ApiModelProperty(position = 2, value = "String value representing the lifecycle event type", example = "STARTED") | ||
30 | + protected String event; | ||
31 | + @ApiModelProperty(position = 3, value = "String value representing status of the lifecycle event", allowableValues = "Success, Failure") | ||
32 | + protected String status; | ||
33 | + @ApiModelProperty(position = 4, value = "The case insensitive 'contains' filter based on error message", example = "not present in the DB") | ||
34 | + protected String errorStr; | ||
23 | 35 | ||
24 | @Override | 36 | @Override |
25 | public EventType getEventType() { | 37 | public EventType getEventType() { |
@@ -16,10 +16,20 @@ | @@ -16,10 +16,20 @@ | ||
16 | package org.thingsboard.server.common.data.event; | 16 | package org.thingsboard.server.common.data.event; |
17 | 17 | ||
18 | import io.swagger.annotations.ApiModel; | 18 | import io.swagger.annotations.ApiModel; |
19 | +import io.swagger.annotations.ApiModelProperty; | ||
20 | +import lombok.Data; | ||
19 | import org.thingsboard.server.common.data.StringUtils; | 21 | import org.thingsboard.server.common.data.StringUtils; |
20 | 22 | ||
23 | +@Data | ||
21 | @ApiModel | 24 | @ApiModel |
22 | -public class StatisticsEventFilter extends BaseEventFilter implements EventFilter { | 25 | +public class StatisticsEventFilter implements EventFilter { |
26 | + | ||
27 | + @ApiModelProperty(position = 1, value = "String value representing the server name, identifier or ip address where the platform is running", example = "ip-172-31-24-152") | ||
28 | + protected String server; | ||
29 | + @ApiModelProperty(position = 2, value = "The minimum number of successfully processed messages", example = "25") | ||
30 | + protected Integer messagesProcessed; | ||
31 | + @ApiModelProperty(position = 3, value = "The minimum number of errors occurred during messages processing", example = "30") | ||
32 | + protected Integer errorsOccurred; | ||
23 | 33 | ||
24 | @Override | 34 | @Override |
25 | public EventType getEventType() { | 35 | public EventType getEventType() { |