test_class.file: modules/flowable-rest/src/test/java/org/flowable/rest/service/api/identity/UserInfoResourceTest.java
test_class.identifier: UserInfoResourceTest
test_class.superclass: extends BaseSpringRestTestCase
test_case.body: @Test
      public void testGetUserInfoCollection() throws Exception {
          User savedUser = null;
          try {
              User newUser = identityService.newUser("testuser");
              newUser.setFirstName("Fred");
              newUser.setLastName("McDonald");
              newUser.setEmail("no-reply@flowable.org");
              identityService.saveUser(newUser);
              savedUser = newUser;
  
              identityService.setUserInfo(newUser.getId(), "key1", "Value 1");
              identityService.setUserInfo(newUser.getId(), "key2", "Value 2");
  
              CloseableHttpResponse response = executeRequest(
                      new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_INFO_COLLECTION, newUser.getId())), HttpStatus.SC_OK);
              JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
              closeResponse(response);
              assertThat(responseNode).isNotNull();
              assertThat(responseNode.isArray()).isTrue();
              assertThatJson(responseNode)
                      .isEqualTo("[ {"
                              + "  key: 'key1',"
                              + "  url: '" + SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_INFO, newUser.getId(), "key1") + "'"
                              + "},"
                              + "{"
                              + "  key: 'key2',"
                              + "  url: '" + SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_INFO, newUser.getId(), "key2") + "'"
                              + "}"
                              + "]");
  
          } finally {
  
              // Delete user after test passes or fails
              if (savedUser != null) {
                  identityService.deleteUser(savedUser.getId());
              }
          }
      }
test_case.class_method_signature: UserInfoResourceTest.testGetUserInfoCollection()
test_case.full_signature: @Test public void testGetUserInfoCollection()
test_case.identifier: testGetUserInfoCollection
test_case.invocations: newUser setFirstName setLastName setEmail saveUser setUserInfo getId setUserInfo getId executeRequest createRelativeResourceUrl getId readTree getContent getEntity closeResponse isNotNull assertThat isTrue assertThat isArray isEqualTo assertThatJson createRelativeResourceUrl getId createRelativeResourceUrl getId deleteUser getId
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetUserInfoCollection()
focal_class.declarator: restResponseFactory
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected RestResponseFactory restResponseFactory;
focal_class.type: RestResponseFactory
focal_class.var_name: restResponseFactory
focal_class.declarator: identityService
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected IdentityService identityService;
focal_class.type: IdentityService
focal_class.var_name: identityService
focal_class.file: modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/UserInfoResource.java
focal_class.identifier: UserInfoResource
focal_class.class_method_signature: UserInfoResource.getUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, HttpServletRequest request)
focal_class.full_signature: @ApiOperation(value = "Get a user’s info", tags = { "Users" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the user was found and the user has info for the given key."), @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user does ot have info for the given key. Status description contains additional information about the error.") }) @GetMapping(value = "/identity/users/{userId}/info/{key}", produces = "application/json") public UserInfoResponse getUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, HttpServletRequest request)
focal_class.identifier: getUserInfo
focal_class.modifiers: @ApiOperation(value = "Get a user’s info", tags = { "Users" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the user was found and the user has info for the given key."), @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user does ot have info for the given key. Status description contains additional information about the error.") }) @GetMapping(value = "/identity/users/{userId}/info/{key}", produces = "application/json") public
focal_class.parameters: (@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, HttpServletRequest request)
focal_class.return: UserInfoResponse
focal_class.signature: UserInfoResponse getUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, HttpServletRequest request)
focal_class.class_method_signature: UserInfoResource.setUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, @RequestBody UserInfoRequest userRequest, HttpServletRequest request)
focal_class.full_signature: @ApiOperation(value = "Update a user’s info", tags = { "Users" }, nickname = "updateUserInfo") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the user was found and the info has been updated."), @ApiResponse(code = 400, message = "Indicates the value was missing from the request body."), @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user does not have info for the given key. Status description contains additional information about the error.") }) @PutMapping(value = "/identity/users/{userId}/info/{key}", produces = "application/json") public UserInfoResponse setUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, @RequestBody UserInfoRequest userRequest, HttpServletRequest request)
focal_class.identifier: setUserInfo
focal_class.modifiers: @ApiOperation(value = "Update a user’s info", tags = { "Users" }, nickname = "updateUserInfo") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the user was found and the info has been updated."), @ApiResponse(code = 400, message = "Indicates the value was missing from the request body."), @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user does not have info for the given key. Status description contains additional information about the error.") }) @PutMapping(value = "/identity/users/{userId}/info/{key}", produces = "application/json") public
focal_class.parameters: (@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, @RequestBody UserInfoRequest userRequest, HttpServletRequest request)
focal_class.return: UserInfoResponse
focal_class.signature: UserInfoResponse setUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, @RequestBody UserInfoRequest userRequest, HttpServletRequest request)
focal_class.class_method_signature: UserInfoResource.deleteUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, HttpServletResponse response)
focal_class.full_signature: @ApiOperation(value = "Delete a user’s info", tags = { "Users" }) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the user was found and the info for the given key has been deleted. Response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user does not have info for the given key. Status description contains additional information about the error.") }) @DeleteMapping("/identity/users/{userId}/info/{key}") public void deleteUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, HttpServletResponse response)
focal_class.identifier: deleteUserInfo
focal_class.modifiers: @ApiOperation(value = "Delete a user’s info", tags = { "Users" }) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the user was found and the info for the given key has been deleted. Response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user does not have info for the given key. Status description contains additional information about the error.") }) @DeleteMapping("/identity/users/{userId}/info/{key}") public
focal_class.parameters: (@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, HttpServletResponse response)
focal_class.return: void
focal_class.signature: void deleteUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, HttpServletResponse response)
focal_class.class_method_signature: UserInfoResource.getValidKeyFromRequest(User user, String key)
focal_class.full_signature: protected String getValidKeyFromRequest(User user, String key)
focal_class.identifier: getValidKeyFromRequest
focal_class.modifiers: protected
focal_class.parameters: (User user, String key)
focal_class.return: String
focal_class.signature: String getValidKeyFromRequest(User user, String key)
focal_class.superclass: extends BaseUserResource
focal_method.body: @ApiOperation(value = "Update a user’s info", tags = { "Users" }, nickname = "updateUserInfo")
      @ApiResponses(value = {
              @ApiResponse(code = 200, message = "Indicates the user was found and the info has been updated."),
              @ApiResponse(code = 400, message = "Indicates the value was missing from the request body."),
              @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user does not have info for the given key. Status description contains additional information about the error.")
      })
      @PutMapping(value = "/identity/users/{userId}/info/{key}", produces = "application/json")
      public UserInfoResponse setUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, @RequestBody UserInfoRequest userRequest, HttpServletRequest request) {
  
          User user = getUserFromRequest(userId);
          String validKey = getValidKeyFromRequest(user, key);
  
          if (userRequest.getValue() == null) {
              throw new FlowableIllegalArgumentException("The value cannot be null.");
          }
  
          if (userRequest.getKey() == null || validKey.equals(userRequest.getKey())) {
              identityService.setUserInfo(user.getId(), key, userRequest.getValue());
          } else {
              throw new FlowableIllegalArgumentException("Key provided in request body does not match the key in the resource URL.");
          }
  
          return restResponseFactory.createUserInfoResponse(key, userRequest.getValue(), user.getId());
      }
focal_method.class_method_signature: UserInfoResource.setUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, @RequestBody UserInfoRequest userRequest, HttpServletRequest request)
focal_method.full_signature: @ApiOperation(value = "Update a user’s info", tags = { "Users" }, nickname = "updateUserInfo") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the user was found and the info has been updated."), @ApiResponse(code = 400, message = "Indicates the value was missing from the request body."), @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user does not have info for the given key. Status description contains additional information about the error.") }) @PutMapping(value = "/identity/users/{userId}/info/{key}", produces = "application/json") public UserInfoResponse setUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, @RequestBody UserInfoRequest userRequest, HttpServletRequest request)
focal_method.identifier: setUserInfo
focal_method.invocations: getUserFromRequest getValidKeyFromRequest getValue getKey equals getKey setUserInfo getId getValue createUserInfoResponse getValue getId
focal_method.modifiers: @ApiOperation(value = "Update a user’s info", tags = { "Users" }, nickname = "updateUserInfo") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the user was found and the info has been updated."), @ApiResponse(code = 400, message = "Indicates the value was missing from the request body."), @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user does not have info for the given key. Status description contains additional information about the error.") }) @PutMapping(value = "/identity/users/{userId}/info/{key}", produces = "application/json") public
focal_method.parameters: (@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, @RequestBody UserInfoRequest userRequest, HttpServletRequest request)
focal_method.return: UserInfoResponse
focal_method.signature: UserInfoResponse setUserInfo(@ApiParam(name = "userId") @PathVariable("userId") String userId, @ApiParam(name = "key") @PathVariable("key") String key, @RequestBody UserInfoRequest userRequest, HttpServletRequest request)