Showing
11 changed files
with
96 additions
and
18 deletions
@@ -218,9 +218,9 @@ public class AlarmController extends BaseController { | @@ -218,9 +218,9 @@ public class AlarmController extends BaseController { | ||
218 | @ResponseBody | 218 | @ResponseBody |
219 | public PageData<AlarmInfo> getAlarms( | 219 | public PageData<AlarmInfo> getAlarms( |
220 | @ApiParam(value = ENTITY_TYPE_DESCRIPTION) | 220 | @ApiParam(value = ENTITY_TYPE_DESCRIPTION) |
221 | - @PathVariable("entityType") String strEntityType, | ||
222 | - @ApiParam(value = ENTITY_ID_DESCRIPTION) | ||
223 | - @PathVariable("entityId") String strEntityId, | 221 | + @PathVariable(ENTITY_TYPE) String strEntityType, |
222 | + @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) | ||
223 | + @PathVariable(ENTITY_ID) String strEntityId, | ||
224 | @ApiParam(value = ALARM_QUERY_SEARCH_STATUS_DESCRIPTION, allowableValues = ALARM_QUERY_SEARCH_STATUS_ALLOWABLE_VALUES) | 224 | @ApiParam(value = ALARM_QUERY_SEARCH_STATUS_DESCRIPTION, allowableValues = ALARM_QUERY_SEARCH_STATUS_ALLOWABLE_VALUES) |
225 | @RequestParam(required = false) String searchStatus, | 225 | @RequestParam(required = false) String searchStatus, |
226 | @ApiParam(value = ALARM_QUERY_STATUS_DESCRIPTION, allowableValues = ALARM_QUERY_STATUS_ALLOWABLE_VALUES) | 226 | @ApiParam(value = ALARM_QUERY_STATUS_DESCRIPTION, allowableValues = ALARM_QUERY_STATUS_ALLOWABLE_VALUES) |
@@ -319,9 +319,9 @@ public class AlarmController extends BaseController { | @@ -319,9 +319,9 @@ public class AlarmController extends BaseController { | ||
319 | @ResponseBody | 319 | @ResponseBody |
320 | public AlarmSeverity getHighestAlarmSeverity( | 320 | public AlarmSeverity getHighestAlarmSeverity( |
321 | @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) | 321 | @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) |
322 | - @PathVariable("entityType") String strEntityType, | ||
323 | - @ApiParam(value = ENTITY_ID_DESCRIPTION, required = true) | ||
324 | - @PathVariable("entityId") String strEntityId, | 322 | + @PathVariable(ENTITY_TYPE) String strEntityType, |
323 | + @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) | ||
324 | + @PathVariable(ENTITY_ID) String strEntityId, | ||
325 | @ApiParam(value = ALARM_QUERY_SEARCH_STATUS_DESCRIPTION, allowableValues = ALARM_QUERY_SEARCH_STATUS_ALLOWABLE_VALUES) | 325 | @ApiParam(value = ALARM_QUERY_SEARCH_STATUS_DESCRIPTION, allowableValues = ALARM_QUERY_SEARCH_STATUS_ALLOWABLE_VALUES) |
326 | @RequestParam(required = false) String searchStatus, | 326 | @RequestParam(required = false) String searchStatus, |
327 | @ApiParam(value = ALARM_QUERY_STATUS_DESCRIPTION, allowableValues = ALARM_QUERY_STATUS_ALLOWABLE_VALUES) | 327 | @ApiParam(value = ALARM_QUERY_STATUS_DESCRIPTION, allowableValues = ALARM_QUERY_STATUS_ALLOWABLE_VALUES) |
@@ -157,6 +157,8 @@ public abstract class BaseController { | @@ -157,6 +157,8 @@ public abstract class BaseController { | ||
157 | 157 | ||
158 | public static final String CUSTOMER_ID = "customerId"; | 158 | public static final String CUSTOMER_ID = "customerId"; |
159 | public static final String TENANT_ID = "tenantId"; | 159 | public static final String TENANT_ID = "tenantId"; |
160 | + public static final String ENTITY_ID = "entityId"; | ||
161 | + public static final String ENTITY_TYPE = "entityType"; | ||
160 | 162 | ||
161 | public static final String PAGE_DATA_PARAMETERS = "You can specify parameters to filter the results. " + | 163 | public static final String PAGE_DATA_PARAMETERS = "You can specify parameters to filter the results. " + |
162 | "The result is wrapped with PageData object that allows you to iterate over result set using pagination. " + | 164 | "The result is wrapped with PageData object that allows you to iterate over result set using pagination. " + |
@@ -169,6 +171,8 @@ public abstract class BaseController { | @@ -169,6 +171,8 @@ public abstract class BaseController { | ||
169 | public static final String CUSTOMER_ID_PARAM_DESCRIPTION = "A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"; | 171 | public static final String CUSTOMER_ID_PARAM_DESCRIPTION = "A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"; |
170 | public static final String ASSET_ID_PARAM_DESCRIPTION = "A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"; | 172 | public static final String ASSET_ID_PARAM_DESCRIPTION = "A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"; |
171 | public static final String ALARM_ID_PARAM_DESCRIPTION = "A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"; | 173 | public static final String ALARM_ID_PARAM_DESCRIPTION = "A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"; |
174 | + public static final String ENTITY_ID_PARAM_DESCRIPTION = "A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"; | ||
175 | + public static final String ENTITY_TYPE_DESCRIPTION = "A string value representing the entity type. For example, 'DEVICE'"; | ||
172 | 176 | ||
173 | protected final String PAGE_SIZE_DESCRIPTION = "Maximum amount of entities in a one page"; | 177 | protected final String PAGE_SIZE_DESCRIPTION = "Maximum amount of entities in a one page"; |
174 | protected final String PAGE_NUMBER_DESCRIPTION = "Sequence number of page starting from 0"; | 178 | protected final String PAGE_NUMBER_DESCRIPTION = "Sequence number of page starting from 0"; |
@@ -179,12 +183,14 @@ public abstract class BaseController { | @@ -179,12 +183,14 @@ public abstract class BaseController { | ||
179 | protected final String DASHBOARD_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the dashboard title."; | 183 | protected final String DASHBOARD_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the dashboard title."; |
180 | protected final String DEVICE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the device name."; | 184 | protected final String DEVICE_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the device name."; |
181 | protected final String CUSTOMER_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the customer title."; | 185 | protected final String CUSTOMER_TEXT_SEARCH_DESCRIPTION = "The case insensitive 'startsWith' filter based on the customer title."; |
186 | + protected final String EVENT_TEXT_SEARCH_DESCRIPTION = "The value is not used in searching."; | ||
182 | protected final String SORT_PROPERTY_DESCRIPTION = "Property of entity to sort by"; | 187 | protected final String SORT_PROPERTY_DESCRIPTION = "Property of entity to sort by"; |
183 | protected final String DASHBOARD_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, title"; | 188 | protected final String DASHBOARD_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, title"; |
184 | protected final String CUSTOMER_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, title, email, country, city"; | 189 | protected final String CUSTOMER_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, title, email, country, city"; |
185 | protected final String DEVICE_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, deviceProfileName, label, customerTitle"; | 190 | protected final String DEVICE_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, deviceProfileName, label, customerTitle"; |
186 | protected final String ASSET_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, type, label, customerTitle"; | 191 | protected final String ASSET_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, name, type, label, customerTitle"; |
187 | protected final String ALARM_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, startTs, endTs, type, ackTs, clearTs, severity, status"; | 192 | protected final String ALARM_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, startTs, endTs, type, ackTs, clearTs, severity, status"; |
193 | + protected final String EVENT_SORT_PROPERTY_ALLOWABLE_VALUES = "createdTime, id"; | ||
188 | protected final String SORT_ORDER_DESCRIPTION = "Sort order. ASC (ASCENDING) or DESC (DESCENDING)"; | 194 | protected final String SORT_ORDER_DESCRIPTION = "Sort order. ASC (ASCENDING) or DESC (DESCENDING)"; |
189 | protected final String SORT_ORDER_ALLOWABLE_VALUES = "ASC, DESC"; | 195 | protected final String SORT_ORDER_ALLOWABLE_VALUES = "ASC, DESC"; |
190 | protected final String DEVICE_INFO_DESCRIPTION = "Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. "; | 196 | protected final String DEVICE_INFO_DESCRIPTION = "Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. "; |
@@ -195,8 +201,8 @@ public abstract class BaseController { | @@ -195,8 +201,8 @@ public abstract class BaseController { | ||
195 | protected final String DEVICE_NAME_DESCRIPTION = "A string value representing the Device name."; | 201 | protected final String DEVICE_NAME_DESCRIPTION = "A string value representing the Device name."; |
196 | protected final String ASSET_NAME_DESCRIPTION = "A string value representing the Asset name."; | 202 | protected final String ASSET_NAME_DESCRIPTION = "A string value representing the Asset name."; |
197 | 203 | ||
198 | - protected static final String ENTITY_TYPE_DESCRIPTION = "A string value representing the entity type. For example, 'DEVICE'"; | ||
199 | - protected static final String ENTITY_ID_DESCRIPTION = "A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'"; | 204 | + protected final String EVENT_START_TIME_DESCRIPTION = "Timestamp. Events with creation time before it won't be queried."; |
205 | + protected final String EVENT_END_TIME_DESCRIPTION = "Timestamp. Events with creation time after it won't be queried."; | ||
200 | 206 | ||
201 | public static final String INCORRECT_TENANT_ID = "Incorrect tenantId "; | 207 | public static final String INCORRECT_TENANT_ID = "Incorrect tenantId "; |
202 | protected static final String DEFAULT_DASHBOARD = "defaultDashboardId"; | 208 | protected static final String DEFAULT_DASHBOARD = "defaultDashboardId"; |
@@ -15,7 +15,10 @@ | @@ -15,7 +15,10 @@ | ||
15 | */ | 15 | */ |
16 | package org.thingsboard.server.controller; | 16 | package org.thingsboard.server.controller; |
17 | 17 | ||
18 | +import io.swagger.annotations.ApiOperation; | ||
19 | +import io.swagger.annotations.ApiParam; | ||
18 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
21 | +import org.springframework.http.MediaType; | ||
19 | import org.springframework.security.access.prepost.PreAuthorize; | 22 | import org.springframework.security.access.prepost.PreAuthorize; |
20 | import org.springframework.web.bind.annotation.PathVariable; | 23 | import org.springframework.web.bind.annotation.PathVariable; |
21 | import org.springframework.web.bind.annotation.RequestBody; | 24 | import org.springframework.web.bind.annotation.RequestBody; |
@@ -45,20 +48,34 @@ public class EventController extends BaseController { | @@ -45,20 +48,34 @@ public class EventController extends BaseController { | ||
45 | @Autowired | 48 | @Autowired |
46 | private EventService eventService; | 49 | private EventService eventService; |
47 | 50 | ||
51 | + @ApiOperation(value = "Get Events (getEvents)", | ||
52 | + notes = "Returns a page of events for specified entity by specifying event type." + | ||
53 | + PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) | ||
48 | @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") | 54 | @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") |
49 | @RequestMapping(value = "/events/{entityType}/{entityId}/{eventType}", method = RequestMethod.GET) | 55 | @RequestMapping(value = "/events/{entityType}/{entityId}/{eventType}", method = RequestMethod.GET) |
50 | @ResponseBody | 56 | @ResponseBody |
51 | public PageData<Event> getEvents( | 57 | public PageData<Event> getEvents( |
52 | - @PathVariable("entityType") String strEntityType, | ||
53 | - @PathVariable("entityId") String strEntityId, | 58 | + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) |
59 | + @PathVariable(ENTITY_TYPE) String strEntityType, | ||
60 | + @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) | ||
61 | + @PathVariable(ENTITY_ID) String strEntityId, | ||
62 | + @ApiParam(value = "A string value representing event type", example = "STATS", required = true) | ||
54 | @PathVariable("eventType") String eventType, | 63 | @PathVariable("eventType") String eventType, |
55 | - @RequestParam("tenantId") String strTenantId, | 64 | + @ApiParam(value = TENANT_ID_PARAM_DESCRIPTION, required = true) |
65 | + @RequestParam(TENANT_ID) String strTenantId, | ||
66 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | ||
56 | @RequestParam int pageSize, | 67 | @RequestParam int pageSize, |
68 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | ||
57 | @RequestParam int page, | 69 | @RequestParam int page, |
70 | + @ApiParam(value = EVENT_TEXT_SEARCH_DESCRIPTION) | ||
58 | @RequestParam(required = false) String textSearch, | 71 | @RequestParam(required = false) String textSearch, |
72 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = EVENT_SORT_PROPERTY_ALLOWABLE_VALUES) | ||
59 | @RequestParam(required = false) String sortProperty, | 73 | @RequestParam(required = false) String sortProperty, |
74 | + @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) | ||
60 | @RequestParam(required = false) String sortOrder, | 75 | @RequestParam(required = false) String sortOrder, |
76 | + @ApiParam(value = EVENT_START_TIME_DESCRIPTION) | ||
61 | @RequestParam(required = false) Long startTime, | 77 | @RequestParam(required = false) Long startTime, |
78 | + @ApiParam(value = EVENT_END_TIME_DESCRIPTION) | ||
62 | @RequestParam(required = false) Long endTime) throws ThingsboardException { | 79 | @RequestParam(required = false) Long endTime) throws ThingsboardException { |
63 | checkParameter("EntityId", strEntityId); | 80 | checkParameter("EntityId", strEntityId); |
64 | checkParameter("EntityType", strEntityType); | 81 | checkParameter("EntityType", strEntityType); |
@@ -74,19 +91,32 @@ public class EventController extends BaseController { | @@ -74,19 +91,32 @@ public class EventController extends BaseController { | ||
74 | } | 91 | } |
75 | } | 92 | } |
76 | 93 | ||
94 | + @ApiOperation(value = "Get Events (getEvents)", | ||
95 | + notes = "Returns a page of events for specified entity." + | ||
96 | + PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) | ||
77 | @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") | 97 | @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") |
78 | @RequestMapping(value = "/events/{entityType}/{entityId}", method = RequestMethod.GET) | 98 | @RequestMapping(value = "/events/{entityType}/{entityId}", method = RequestMethod.GET) |
79 | @ResponseBody | 99 | @ResponseBody |
80 | public PageData<Event> getEvents( | 100 | public PageData<Event> getEvents( |
81 | - @PathVariable("entityType") String strEntityType, | ||
82 | - @PathVariable("entityId") String strEntityId, | 101 | + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) |
102 | + @PathVariable(ENTITY_TYPE) String strEntityType, | ||
103 | + @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) | ||
104 | + @PathVariable(ENTITY_ID) String strEntityId, | ||
105 | + @ApiParam(value = TENANT_ID_PARAM_DESCRIPTION, required = true) | ||
83 | @RequestParam("tenantId") String strTenantId, | 106 | @RequestParam("tenantId") String strTenantId, |
107 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | ||
84 | @RequestParam int pageSize, | 108 | @RequestParam int pageSize, |
109 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | ||
85 | @RequestParam int page, | 110 | @RequestParam int page, |
111 | + @ApiParam(value = EVENT_TEXT_SEARCH_DESCRIPTION) | ||
86 | @RequestParam(required = false) String textSearch, | 112 | @RequestParam(required = false) String textSearch, |
113 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = EVENT_SORT_PROPERTY_ALLOWABLE_VALUES) | ||
87 | @RequestParam(required = false) String sortProperty, | 114 | @RequestParam(required = false) String sortProperty, |
115 | + @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) | ||
88 | @RequestParam(required = false) String sortOrder, | 116 | @RequestParam(required = false) String sortOrder, |
117 | + @ApiParam(value = EVENT_START_TIME_DESCRIPTION) | ||
89 | @RequestParam(required = false) Long startTime, | 118 | @RequestParam(required = false) Long startTime, |
119 | + @ApiParam(value = EVENT_END_TIME_DESCRIPTION) | ||
90 | @RequestParam(required = false) Long endTime) throws ThingsboardException { | 120 | @RequestParam(required = false) Long endTime) throws ThingsboardException { |
91 | checkParameter("EntityId", strEntityId); | 121 | checkParameter("EntityId", strEntityId); |
92 | checkParameter("EntityType", strEntityType); | 122 | checkParameter("EntityType", strEntityType); |
@@ -104,20 +134,34 @@ public class EventController extends BaseController { | @@ -104,20 +134,34 @@ public class EventController extends BaseController { | ||
104 | } | 134 | } |
105 | } | 135 | } |
106 | 136 | ||
137 | + @ApiOperation(value = "Get Events (getEvents)", | ||
138 | + notes = "Returns a page of events for specified entity by specifying event filter." + | ||
139 | + PAGE_DATA_PARAMETERS, produces = MediaType.APPLICATION_JSON_VALUE) | ||
107 | @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") | 140 | @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") |
108 | @RequestMapping(value = "/events/{entityType}/{entityId}", method = RequestMethod.POST) | 141 | @RequestMapping(value = "/events/{entityType}/{entityId}", method = RequestMethod.POST) |
109 | @ResponseBody | 142 | @ResponseBody |
110 | public PageData<Event> getEvents( | 143 | public PageData<Event> getEvents( |
111 | - @PathVariable("entityType") String strEntityType, | ||
112 | - @PathVariable("entityId") String strEntityId, | ||
113 | - @RequestParam("tenantId") String strTenantId, | 144 | + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) |
145 | + @PathVariable(ENTITY_TYPE) String strEntityType, | ||
146 | + @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) | ||
147 | + @PathVariable(ENTITY_ID) String strEntityId, | ||
148 | + @ApiParam(value = TENANT_ID_PARAM_DESCRIPTION, required = true) | ||
149 | + @RequestParam(TENANT_ID) String strTenantId, | ||
150 | + @ApiParam(value = PAGE_SIZE_DESCRIPTION, required = true) | ||
114 | @RequestParam int pageSize, | 151 | @RequestParam int pageSize, |
152 | + @ApiParam(value = PAGE_NUMBER_DESCRIPTION, required = true) | ||
115 | @RequestParam int page, | 153 | @RequestParam int page, |
154 | + @ApiParam(value = "A JSON value representing the event filter.", required = true) | ||
116 | @RequestBody EventFilter eventFilter, | 155 | @RequestBody EventFilter eventFilter, |
156 | + @ApiParam(value = EVENT_TEXT_SEARCH_DESCRIPTION) | ||
117 | @RequestParam(required = false) String textSearch, | 157 | @RequestParam(required = false) String textSearch, |
158 | + @ApiParam(value = SORT_PROPERTY_DESCRIPTION, allowableValues = EVENT_SORT_PROPERTY_ALLOWABLE_VALUES) | ||
118 | @RequestParam(required = false) String sortProperty, | 159 | @RequestParam(required = false) String sortProperty, |
160 | + @ApiParam(value = SORT_ORDER_DESCRIPTION, allowableValues = SORT_ORDER_ALLOWABLE_VALUES) | ||
119 | @RequestParam(required = false) String sortOrder, | 161 | @RequestParam(required = false) String sortOrder, |
162 | + @ApiParam(value = EVENT_START_TIME_DESCRIPTION) | ||
120 | @RequestParam(required = false) Long startTime, | 163 | @RequestParam(required = false) Long startTime, |
164 | + @ApiParam(value = EVENT_END_TIME_DESCRIPTION) | ||
121 | @RequestParam(required = false) Long endTime) throws ThingsboardException { | 165 | @RequestParam(required = false) Long endTime) throws ThingsboardException { |
122 | checkParameter("EntityId", strEntityId); | 166 | checkParameter("EntityId", strEntityId); |
123 | checkParameter("EntityType", strEntityType); | 167 | checkParameter("EntityType", strEntityType); |
@@ -127,7 +171,7 @@ public class EventController extends BaseController { | @@ -127,7 +171,7 @@ public class EventController extends BaseController { | ||
127 | EntityId entityId = EntityIdFactory.getByTypeAndId(strEntityType, strEntityId); | 171 | EntityId entityId = EntityIdFactory.getByTypeAndId(strEntityType, strEntityId); |
128 | checkEntityId(entityId, Operation.READ); | 172 | checkEntityId(entityId, Operation.READ); |
129 | 173 | ||
130 | - if(sortProperty != null && sortProperty.equals("createdTime") && eventFilter.hasFilterForJsonBody()) { | 174 | + if (sortProperty != null && sortProperty.equals("createdTime") && eventFilter.hasFilterForJsonBody()) { |
131 | sortProperty = ModelConstants.CREATED_TIME_PROPERTY; | 175 | sortProperty = ModelConstants.CREATED_TIME_PROPERTY; |
132 | } | 176 | } |
133 | 177 |
@@ -16,6 +16,8 @@ | @@ -16,6 +16,8 @@ | ||
16 | package org.thingsboard.server.common.data; | 16 | package org.thingsboard.server.common.data; |
17 | 17 | ||
18 | import com.fasterxml.jackson.databind.JsonNode; | 18 | import com.fasterxml.jackson.databind.JsonNode; |
19 | +import io.swagger.annotations.ApiModel; | ||
20 | +import io.swagger.annotations.ApiModelProperty; | ||
19 | import lombok.Data; | 21 | import lombok.Data; |
20 | import org.thingsboard.server.common.data.id.EntityId; | 22 | import org.thingsboard.server.common.data.id.EntityId; |
21 | import org.thingsboard.server.common.data.id.EventId; | 23 | import org.thingsboard.server.common.data.id.EventId; |
@@ -25,12 +27,18 @@ import org.thingsboard.server.common.data.id.TenantId; | @@ -25,12 +27,18 @@ import org.thingsboard.server.common.data.id.TenantId; | ||
25 | * @author Andrew Shvayka | 27 | * @author Andrew Shvayka |
26 | */ | 28 | */ |
27 | @Data | 29 | @Data |
30 | +@ApiModel | ||
28 | public class Event extends BaseData<EventId> { | 31 | public class Event extends BaseData<EventId> { |
29 | 32 | ||
33 | + @ApiModelProperty(position = 1, value = "JSON object with Tenant Id.", readOnly = true) | ||
30 | private TenantId tenantId; | 34 | private TenantId tenantId; |
35 | + @ApiModelProperty(position = 2, value = "Event type", example = "STATS") | ||
31 | private String type; | 36 | private String type; |
37 | + @ApiModelProperty(position = 3, value = "string", example = "784f394c-42b6-435a-983c-b7beff2784f9") | ||
32 | private String uid; | 38 | private String uid; |
39 | + @ApiModelProperty(position = 4, value = "JSON object with Entity Id for which event is created.", readOnly = true) | ||
33 | private EntityId entityId; | 40 | private EntityId entityId; |
41 | + @ApiModelProperty(position = 5, value = "Event body.", dataType = "com.fasterxml.jackson.databind.JsonNode") | ||
34 | private transient JsonNode body; | 42 | private transient JsonNode body; |
35 | 43 | ||
36 | public Event() { | 44 | public Event() { |
@@ -45,4 +53,9 @@ public class Event extends BaseData<EventId> { | @@ -45,4 +53,9 @@ public class Event extends BaseData<EventId> { | ||
45 | super(event); | 53 | super(event); |
46 | } | 54 | } |
47 | 55 | ||
56 | + @ApiModelProperty(position = 6, value = "Timestamp of the event creation, in milliseconds", example = "1609459200000", readOnly = true) | ||
57 | + @Override | ||
58 | + public long getCreatedTime() { | ||
59 | + return super.getCreatedTime(); | ||
60 | + } | ||
48 | } | 61 | } |
@@ -15,10 +15,12 @@ | @@ -15,10 +15,12 @@ | ||
15 | */ | 15 | */ |
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 lombok.Data; | 19 | import lombok.Data; |
19 | import org.thingsboard.server.common.data.StringUtils; | 20 | import org.thingsboard.server.common.data.StringUtils; |
20 | 21 | ||
21 | @Data | 22 | @Data |
23 | +@ApiModel | ||
22 | public abstract class DebugEvent implements EventFilter { | 24 | public abstract class DebugEvent implements EventFilter { |
23 | 25 | ||
24 | private String msgDirectionType; | 26 | private String msgDirectionType; |
@@ -15,6 +15,9 @@ | @@ -15,6 +15,9 @@ | ||
15 | */ | 15 | */ |
16 | package org.thingsboard.server.common.data.event; | 16 | package org.thingsboard.server.common.data.event; |
17 | 17 | ||
18 | +import io.swagger.annotations.ApiModel; | ||
19 | + | ||
20 | +@ApiModel | ||
18 | public class DebugRuleChainEventFilter extends DebugEvent { | 21 | public class DebugRuleChainEventFilter extends DebugEvent { |
19 | @Override | 22 | @Override |
20 | public EventType getEventType() { | 23 | public EventType getEventType() { |
@@ -15,6 +15,9 @@ | @@ -15,6 +15,9 @@ | ||
15 | */ | 15 | */ |
16 | package org.thingsboard.server.common.data.event; | 16 | package org.thingsboard.server.common.data.event; |
17 | 17 | ||
18 | +import io.swagger.annotations.ApiModel; | ||
19 | + | ||
20 | +@ApiModel | ||
18 | public class DebugRuleNodeEventFilter extends DebugEvent { | 21 | public class DebugRuleNodeEventFilter extends DebugEvent { |
19 | @Override | 22 | @Override |
20 | public EventType getEventType() { | 23 | public EventType getEventType() { |
@@ -15,10 +15,12 @@ | @@ -15,10 +15,12 @@ | ||
15 | */ | 15 | */ |
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 lombok.Data; | 19 | import lombok.Data; |
19 | import org.thingsboard.server.common.data.StringUtils; | 20 | import org.thingsboard.server.common.data.StringUtils; |
20 | 21 | ||
21 | @Data | 22 | @Data |
23 | +@ApiModel | ||
22 | public class ErrorEventFilter implements EventFilter { | 24 | public class ErrorEventFilter implements EventFilter { |
23 | private String server; | 25 | private String server; |
24 | private String method; | 26 | private String method; |
@@ -16,10 +16,11 @@ | @@ -16,10 +16,11 @@ | ||
16 | package org.thingsboard.server.common.data.event; | 16 | package org.thingsboard.server.common.data.event; |
17 | 17 | ||
18 | import com.fasterxml.jackson.annotation.JsonIgnore; | 18 | import com.fasterxml.jackson.annotation.JsonIgnore; |
19 | -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
20 | import com.fasterxml.jackson.annotation.JsonSubTypes; | 19 | import com.fasterxml.jackson.annotation.JsonSubTypes; |
21 | import com.fasterxml.jackson.annotation.JsonTypeInfo; | 20 | import com.fasterxml.jackson.annotation.JsonTypeInfo; |
21 | +import io.swagger.annotations.ApiModel; | ||
22 | 22 | ||
23 | +@ApiModel | ||
23 | @JsonTypeInfo( | 24 | @JsonTypeInfo( |
24 | use = JsonTypeInfo.Id.NAME, | 25 | use = JsonTypeInfo.Id.NAME, |
25 | include = JsonTypeInfo.As.PROPERTY, | 26 | include = JsonTypeInfo.As.PROPERTY, |
@@ -15,10 +15,12 @@ | @@ -15,10 +15,12 @@ | ||
15 | */ | 15 | */ |
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 lombok.Data; | 19 | import lombok.Data; |
19 | import org.thingsboard.server.common.data.StringUtils; | 20 | import org.thingsboard.server.common.data.StringUtils; |
20 | 21 | ||
21 | @Data | 22 | @Data |
23 | +@ApiModel | ||
22 | public class LifeCycleEventFilter implements EventFilter { | 24 | public class LifeCycleEventFilter implements EventFilter { |
23 | private String server; | 25 | private String server; |
24 | private String event; | 26 | private String event; |
@@ -15,10 +15,12 @@ | @@ -15,10 +15,12 @@ | ||
15 | */ | 15 | */ |
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 lombok.Data; | 19 | import lombok.Data; |
19 | import org.thingsboard.server.common.data.StringUtils; | 20 | import org.thingsboard.server.common.data.StringUtils; |
20 | 21 | ||
21 | @Data | 22 | @Data |
23 | +@ApiModel | ||
22 | public class StatisticsEventFilter implements EventFilter { | 24 | public class StatisticsEventFilter implements EventFilter { |
23 | private String server; | 25 | private String server; |
24 | private Integer messagesProcessed; | 26 | private Integer messagesProcessed; |