Commit d17ea19bbadb2cae4394814ce71e02354eef139e

Authored by Dima Landiak
1 parent 041582b9

added required fields

... ... @@ -63,7 +63,7 @@ public class EntityRelationController extends BaseController {
63 63 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
64 64 @RequestMapping(value = "/relation", method = RequestMethod.POST)
65 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 67 @RequestBody EntityRelation relation) throws ThingsboardException {
68 68 try {
69 69 checkNotNull(relation);
... ... @@ -97,12 +97,12 @@ public class EntityRelationController extends BaseController {
97 97 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
98 98 @RequestMapping(value = "/relation", method = RequestMethod.DELETE, params = {FROM_ID, FROM_TYPE, RELATION_TYPE, TO_ID, TO_TYPE})
99 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 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 106 checkParameter(FROM_ID, strFromId);
107 107 checkParameter(FROM_TYPE, strFromType);
108 108 checkParameter(RELATION_TYPE, strRelationType);
... ... @@ -142,8 +142,8 @@ public class EntityRelationController extends BaseController {
142 142 @PreAuthorize("hasAnyAuthority('SYS_ADMIN','TENANT_ADMIN', 'CUSTOMER_USER')")
143 143 @RequestMapping(value = "/relations", method = RequestMethod.DELETE, params = {"entityId", "entityType"})
144 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 147 checkParameter("entityId", strId);
148 148 checkParameter("entityType", strType);
149 149 EntityId entityId = EntityIdFactory.getByTypeAndId(strType, strId);
... ... @@ -166,12 +166,12 @@ public class EntityRelationController extends BaseController {
166 166 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
167 167 @RequestMapping(value = "/relation", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE, RELATION_TYPE, TO_ID, TO_TYPE})
168 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 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 175 try {
176 176 checkParameter(FROM_ID, strFromId);
177 177 checkParameter(FROM_TYPE, strFromType);
... ... @@ -198,8 +198,8 @@ public class EntityRelationController extends BaseController {
198 198 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
199 199 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE})
200 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 203 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
204 204 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
205 205 checkParameter(FROM_ID, strFromId);
... ... @@ -223,8 +223,8 @@ public class EntityRelationController extends BaseController {
223 223 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
224 224 @RequestMapping(value = "/relations/info", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE})
225 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 228 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
229 229 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
230 230 checkParameter(FROM_ID, strFromId);
... ... @@ -248,9 +248,9 @@ public class EntityRelationController extends BaseController {
248 248 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
249 249 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {FROM_ID, FROM_TYPE, RELATION_TYPE})
250 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 254 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
255 255 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
256 256 checkParameter(FROM_ID, strFromId);
... ... @@ -275,8 +275,8 @@ public class EntityRelationController extends BaseController {
275 275 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
276 276 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {TO_ID, TO_TYPE})
277 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 280 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
281 281 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
282 282 checkParameter(TO_ID, strToId);
... ... @@ -300,8 +300,8 @@ public class EntityRelationController extends BaseController {
300 300 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
301 301 @RequestMapping(value = "/relations/info", method = RequestMethod.GET, params = {TO_ID, TO_TYPE})
302 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 305 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
306 306 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
307 307 checkParameter(TO_ID, strToId);
... ... @@ -325,9 +325,9 @@ public class EntityRelationController extends BaseController {
325 325 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
326 326 @RequestMapping(value = "/relations", method = RequestMethod.GET, params = {TO_ID, TO_TYPE, RELATION_TYPE})
327 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 331 @ApiParam(value = RELATION_TYPE_GROUP_PARAM_DESCRIPTION)
332 332 @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws ThingsboardException {
333 333 checkParameter(TO_ID, strToId);
... ... @@ -350,7 +350,7 @@ public class EntityRelationController extends BaseController {
350 350 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
351 351 @RequestMapping(value = "/relations", method = RequestMethod.POST)
352 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 354 @RequestBody EntityRelationsQuery query) throws ThingsboardException {
355 355 checkNotNull(query);
356 356 checkNotNull(query.getParameters());
... ... @@ -370,7 +370,7 @@ public class EntityRelationController extends BaseController {
370 370 @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
371 371 @RequestMapping(value = "/relations/info", method = RequestMethod.POST)
372 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 374 @RequestBody EntityRelationsQuery query) throws ThingsboardException {
375 375 checkNotNull(query);
376 376 checkNotNull(query.getParameters());
... ...