Commit d17ea19bbadb2cae4394814ce71e02354eef139e

Authored by Dima Landiak
1 parent 041582b9

added required fields

@@ -63,7 +63,7 @@ public class EntityRelationController extends BaseController { @@ -63,7 +63,7 @@ public class EntityRelationController extends BaseController {
63 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 63 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
64 @RequestMapping(value = "/relation", method = RequestMethod.POST) 64 @RequestMapping(value = "/relation", method = RequestMethod.POST)
65 @ResponseStatus(value = HttpStatus.OK) 65 @ResponseStatus(value = HttpStatus.OK)
66 - public void saveRelation(@ApiParam(value = "A JSON value representing the relation.") 66 + public void saveRelation(@ApiParam(value = "A JSON value representing the relation.", required = true)
67 @RequestBody EntityRelation relation) throws ThingsboardException { 67 @RequestBody EntityRelation relation) throws ThingsboardException {
68 try { 68 try {
69 checkNotNull(relation); 69 checkNotNull(relation);
@@ -97,12 +97,12 @@ public class EntityRelationController extends BaseController { @@ -97,12 +97,12 @@ public class EntityRelationController extends BaseController {
97 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 97 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
98 @RequestMapping(value = "/relation", method = RequestMethod.DELETE, params = {FROM_ID, FROM_TYPE, RELATION_TYPE, TO_ID, TO_TYPE}) 98 @RequestMapping(value = "/relation", method = RequestMethod.DELETE, params = {FROM_ID, FROM_TYPE, RELATION_TYPE, TO_ID, TO_TYPE})
99 @ResponseStatus(value = HttpStatus.OK) 99 @ResponseStatus(value = HttpStatus.OK)
100 - public void deleteRelation(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @RequestParam(FROM_ID) String strFromId,  
101 - @ApiParam(value = ENTITY_TYPE_DESCRIPTION) @RequestParam(FROM_TYPE) String strFromType,  
102 - @ApiParam(value = RELATION_TYPE_PARAM_DESCRIPTION) @RequestParam(RELATION_TYPE) String strRelationType, 100 + public void deleteRelation(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @RequestParam(FROM_ID) String strFromId,
  101 + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) @RequestParam(FROM_TYPE) String strFromType,
  102 + @ApiParam(value = RELATION_TYPE_PARAM_DESCRIPTION, required = true) @RequestParam(RELATION_TYPE) String strRelationType,
103 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION) @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup, 103 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION) @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup,
104 - @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @RequestParam(TO_ID) String strToId,  
105 - @ApiParam(value = ENTITY_TYPE_DESCRIPTION) @RequestParam(TO_TYPE) String strToType) throws ThingsboardException { 104 + @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @RequestParam(TO_ID) String strToId,
  105 + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) @RequestParam(TO_TYPE) String strToType) throws ThingsboardException {
106 checkParameter(FROM_ID, strFromId); 106 checkParameter(FROM_ID, strFromId);
107 checkParameter(FROM_TYPE, strFromType); 107 checkParameter(FROM_TYPE, strFromType);
108 checkParameter(RELATION_TYPE, strRelationType); 108 checkParameter(RELATION_TYPE, strRelationType);
@@ -142,8 +142,8 @@ public class EntityRelationController extends BaseController { @@ -142,8 +142,8 @@ public class EntityRelationController extends BaseController {
142 @PreAuthorize("hasAnyAuthority('SYS_ADMIN','TENANT_ADMIN', 'CUSTOMER_USER')") 142 @PreAuthorize("hasAnyAuthority('SYS_ADMIN','TENANT_ADMIN', 'CUSTOMER_USER')")
143 @RequestMapping(value = "/relations", method = RequestMethod.DELETE, params = {"entityId", "entityType"}) 143 @RequestMapping(value = "/relations", method = RequestMethod.DELETE, params = {"entityId", "entityType"})
144 @ResponseStatus(value = HttpStatus.OK) 144 @ResponseStatus(value = HttpStatus.OK)
145 - public void deleteRelations(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @RequestParam("entityId") String strId,  
146 - @ApiParam(value = ENTITY_TYPE_DESCRIPTION) @RequestParam("entityType") String strType) throws ThingsboardException { 145 + public void deleteRelations(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @RequestParam("entityId") String strId,
  146 + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) @RequestParam("entityType") String strType) throws ThingsboardException {
147 checkParameter("entityId", strId); 147 checkParameter("entityId", strId);
148 checkParameter("entityType", strType); 148 checkParameter("entityType", strType);
149 EntityId entityId = EntityIdFactory.getByTypeAndId(strType, strId); 149 EntityId entityId = EntityIdFactory.getByTypeAndId(strType, strId);
@@ -166,12 +166,12 @@ public class EntityRelationController extends BaseController { @@ -166,12 +166,12 @@ public class EntityRelationController extends BaseController {
166 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 166 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
167 @RequestMapping(value = "/relation", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE, RELATION_TYPE, TO_ID, TO_TYPE}) 167 @RequestMapping(value = "/relation", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE, RELATION_TYPE, TO_ID, TO_TYPE})
168 @ResponseBody 168 @ResponseBody
169 - public EntityRelation getRelation(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @RequestParam(FROM_ID) String strFromId,  
170 - @ApiParam(value = ENTITY_TYPE_DESCRIPTION) @RequestParam(FROM_TYPE) String strFromType,  
171 - @ApiParam(value = RELATION_TYPE_PARAM_DESCRIPTION) @RequestParam(RELATION_TYPE) String strRelationType, 169 + public EntityRelation getRelation(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @RequestParam(FROM_ID) String strFromId,
  170 + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) @RequestParam(FROM_TYPE) String strFromType,
  171 + @ApiParam(value = RELATION_TYPE_PARAM_DESCRIPTION, required = true) @RequestParam(RELATION_TYPE) String strRelationType,
172 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION) @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup, 172 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION) @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup,
173 - @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @RequestParam(TO_ID) String strToId,  
174 - @ApiParam(value = ENTITY_TYPE_DESCRIPTION) @RequestParam(TO_TYPE) String strToType) throws ThingsboardException { 173 + @ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @RequestParam(TO_ID) String strToId,
  174 + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) @RequestParam(TO_TYPE) String strToType) throws ThingsboardException {
175 try { 175 try {
176 checkParameter(FROM_ID, strFromId); 176 checkParameter(FROM_ID, strFromId);
177 checkParameter(FROM_TYPE, strFromType); 177 checkParameter(FROM_TYPE, strFromType);
@@ -198,8 +198,8 @@ public class EntityRelationController extends BaseController { @@ -198,8 +198,8 @@ public class EntityRelationController extends BaseController {
198 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 198 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
199 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE}) 199 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE})
200 @ResponseBody 200 @ResponseBody
201 - public List<EntityRelation> findByFrom(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @RequestParam(FROM_ID) String strFromId,  
202 - @ApiParam(value = ENTITY_TYPE_DESCRIPTION) @RequestParam(FROM_TYPE) String strFromType, 201 + public List<EntityRelation> findByFrom(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @RequestParam(FROM_ID) String strFromId,
  202 + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) @RequestParam(FROM_TYPE) String strFromType,
203 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION) 203 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
204 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException { 204 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
205 checkParameter(FROM_ID, strFromId); 205 checkParameter(FROM_ID, strFromId);
@@ -223,8 +223,8 @@ public class EntityRelationController extends BaseController { @@ -223,8 +223,8 @@ public class EntityRelationController extends BaseController {
223 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 223 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
224 @RequestMapping(value = "/relations/info", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE}) 224 @RequestMapping(value = "/relations/info", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE})
225 @ResponseBody 225 @ResponseBody
226 - public List<EntityRelationInfo> findInfoByFrom(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @RequestParam(FROM_ID) String strFromId,  
227 - @ApiParam(value = ENTITY_TYPE_DESCRIPTION) @RequestParam(FROM_TYPE) String strFromType, 226 + public List<EntityRelationInfo> findInfoByFrom(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @RequestParam(FROM_ID) String strFromId,
  227 + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) @RequestParam(FROM_TYPE) String strFromType,
228 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION) 228 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
229 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException { 229 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
230 checkParameter(FROM_ID, strFromId); 230 checkParameter(FROM_ID, strFromId);
@@ -248,9 +248,9 @@ public class EntityRelationController extends BaseController { @@ -248,9 +248,9 @@ public class EntityRelationController extends BaseController {
248 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 248 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
249 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE, RELATION_TYPE}) 249 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE, RELATION_TYPE})
250 @ResponseBody 250 @ResponseBody
251 - public List<EntityRelation> findByFrom(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @RequestParam(FROM_ID) String strFromId,  
252 - @ApiParam(value = ENTITY_TYPE_DESCRIPTION) @RequestParam(FROM_TYPE) String strFromType,  
253 - @ApiParam(value = RELATION_TYPE_PARAM_DESCRIPTION) @RequestParam(RELATION_TYPE) String strRelationType, 251 + public List<EntityRelation> findByFrom(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @RequestParam(FROM_ID) String strFromId,
  252 + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) @RequestParam(FROM_TYPE) String strFromType,
  253 + @ApiParam(value = RELATION_TYPE_PARAM_DESCRIPTION, required = true) @RequestParam(RELATION_TYPE) String strRelationType,
254 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION) 254 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
255 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException { 255 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
256 checkParameter(FROM_ID, strFromId); 256 checkParameter(FROM_ID, strFromId);
@@ -275,8 +275,8 @@ public class EntityRelationController extends BaseController { @@ -275,8 +275,8 @@ public class EntityRelationController extends BaseController {
275 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 275 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
276 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {TO_ID, TO_TYPE}) 276 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {TO_ID, TO_TYPE})
277 @ResponseBody 277 @ResponseBody
278 - public List<EntityRelation> findByTo(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @RequestParam(TO_ID) String strToId,  
279 - @ApiParam(value = ENTITY_TYPE_DESCRIPTION) @RequestParam(TO_TYPE) String strToType, 278 + public List<EntityRelation> findByTo(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @RequestParam(TO_ID) String strToId,
  279 + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) @RequestParam(TO_TYPE) String strToType,
280 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION) 280 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
281 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException { 281 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
282 checkParameter(TO_ID, strToId); 282 checkParameter(TO_ID, strToId);
@@ -300,8 +300,8 @@ public class EntityRelationController extends BaseController { @@ -300,8 +300,8 @@ public class EntityRelationController extends BaseController {
300 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 300 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
301 @RequestMapping(value = "/relations/info", method = RequestMethod.GET, params = {TO_ID, TO_TYPE}) 301 @RequestMapping(value = "/relations/info", method = RequestMethod.GET, params = {TO_ID, TO_TYPE})
302 @ResponseBody 302 @ResponseBody
303 - public List<EntityRelationInfo> findInfoByTo(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @RequestParam(TO_ID) String strToId,  
304 - @ApiParam(value = ENTITY_TYPE_DESCRIPTION) @RequestParam(TO_TYPE) String strToType, 303 + public List<EntityRelationInfo> findInfoByTo(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @RequestParam(TO_ID) String strToId,
  304 + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) @RequestParam(TO_TYPE) String strToType,
305 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION) 305 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
306 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException { 306 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
307 checkParameter(TO_ID, strToId); 307 checkParameter(TO_ID, strToId);
@@ -325,9 +325,9 @@ public class EntityRelationController extends BaseController { @@ -325,9 +325,9 @@ public class EntityRelationController extends BaseController {
325 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 325 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
326 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {TO_ID, TO_TYPE, RELATION_TYPE}) 326 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {TO_ID, TO_TYPE, RELATION_TYPE})
327 @ResponseBody 327 @ResponseBody
328 - public List<EntityRelation> findByTo(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION) @RequestParam(TO_ID) String strToId,  
329 - @ApiParam(value = ENTITY_TYPE_DESCRIPTION) @RequestParam(TO_TYPE) String strToType,  
330 - @ApiParam(value = RELATION_TYPE_PARAM_DESCRIPTION) @RequestParam(RELATION_TYPE) String strRelationType, 328 + public List<EntityRelation> findByTo(@ApiParam(value = ENTITY_ID_PARAM_DESCRIPTION, required = true) @RequestParam(TO_ID) String strToId,
  329 + @ApiParam(value = ENTITY_TYPE_DESCRIPTION, required = true) @RequestParam(TO_TYPE) String strToType,
  330 + @ApiParam(value = RELATION_TYPE_PARAM_DESCRIPTION, required = true) @RequestParam(RELATION_TYPE) String strRelationType,
331 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION) 331 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
332 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException { 332 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
333 checkParameter(TO_ID, strToId); 333 checkParameter(TO_ID, strToId);
@@ -350,7 +350,7 @@ public class EntityRelationController extends BaseController { @@ -350,7 +350,7 @@ public class EntityRelationController extends BaseController {
350 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 350 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
351 @RequestMapping(value = "/relations", method = RequestMethod.POST) 351 @RequestMapping(value = "/relations", method = RequestMethod.POST)
352 @ResponseBody 352 @ResponseBody
353 - public List<EntityRelation> findByQuery(@ApiParam(value = "A JSON value representing the entity relations query object.") 353 + public List<EntityRelation> findByQuery(@ApiParam(value = "A JSON value representing the entity relations query object.", required = true)
354 @RequestBody EntityRelationsQuery query) throws ThingsboardException { 354 @RequestBody EntityRelationsQuery query) throws ThingsboardException {
355 checkNotNull(query); 355 checkNotNull(query);
356 checkNotNull(query.getParameters()); 356 checkNotNull(query.getParameters());
@@ -370,7 +370,7 @@ public class EntityRelationController extends BaseController { @@ -370,7 +370,7 @@ public class EntityRelationController extends BaseController {
370 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") 370 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
371 @RequestMapping(value = "/relations/info", method = RequestMethod.POST) 371 @RequestMapping(value = "/relations/info", method = RequestMethod.POST)
372 @ResponseBody 372 @ResponseBody
373 - public List<EntityRelationInfo> findInfoByQuery(@ApiParam(value = "A JSON value representing the entity relations query object.") 373 + public List<EntityRelationInfo> findInfoByQuery(@ApiParam(value = "A JSON value representing the entity relations query object.", required = true)
374 @RequestBody EntityRelationsQuery query) throws ThingsboardException { 374 @RequestBody EntityRelationsQuery query) throws ThingsboardException {
375 checkNotNull(query); 375 checkNotNull(query);
376 checkNotNull(query.getParameters()); 376 checkNotNull(query.getParameters());