test_class.file: modules/flowable-rest/src/test/java/org/flowable/rest/service/api/identity/GroupCollectionResourceTest.java
test_class.identifier: GroupCollectionResourceTest
test_class.superclass: extends BaseSpringRestTestCase
test_case.body: @Test
      public void testCreateGroup() throws Exception {
          try {
              ObjectNode requestNode = objectMapper.createObjectNode();
              requestNode.put("id", "testgroup");
              requestNode.put("name", "Test group");
              requestNode.put("type", "Test type");
  
              HttpPost httpPost = new HttpPost(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_COLLECTION));
              httpPost.setEntity(new StringEntity(requestNode.toString()));
              CloseableHttpResponse response = executeRequest(httpPost, HttpStatus.SC_CREATED);
              JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
              closeResponse(response);
              assertThat(responseNode).isNotNull();
              assertThatJson(responseNode)
                      .when(Option.IGNORING_EXTRA_FIELDS)
                      .isEqualTo("{"
                              + " id: 'testgroup',"
                              + " name: 'Test group',"
                              + " type: 'Test type',"
                              + " url: '" + SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP, "testgroup") + "'"
                              + "}");
  
              assertThat(identityService.createGroupQuery().groupId("testgroup").singleResult()).isNotNull();
          } finally {
              try {
                  identityService.deleteGroup("testgroup");
              } catch (Throwable t) {
                  // Ignore, user might not have been created by test
              }
          }
      }
test_case.class_method_signature: GroupCollectionResourceTest.testCreateGroup()
test_case.full_signature: @Test public void testCreateGroup()
test_case.identifier: testCreateGroup
test_case.invocations: createObjectNode put put put createRelativeResourceUrl setEntity toString executeRequest readTree getContent getEntity closeResponse isNotNull assertThat isEqualTo when assertThatJson createRelativeResourceUrl isNotNull assertThat singleResult groupId createGroupQuery deleteGroup
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCreateGroup()
focal_class.declarator: properties = new HashMap<>()
focal_class.modifier: protected static
focal_class.original_string: protected static HashMap<String, QueryProperty> properties = new HashMap<>();
focal_class.type: HashMap<String, QueryProperty>
focal_class.var_name: properties
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.declarator: restApiInterceptor
focal_class.modifier: @Autowired(required=false)
      protected
focal_class.original_string: @Autowired(required=false)
      protected BpmnRestApiInterceptor restApiInterceptor;
focal_class.type: BpmnRestApiInterceptor
focal_class.var_name: restApiInterceptor
focal_class.file: modules/flowable-rest/src/main/java/org/flowable/rest/service/api/identity/GroupCollectionResource.java
focal_class.identifier: GroupCollectionResource
focal_class.class_method_signature: GroupCollectionResource.getGroups(@ApiParam(hidden = true) @RequestParam Map<String, String> allRequestParams, HttpServletRequest request)
focal_class.full_signature: @ApiOperation(value = "List groups", nickname="listGroups", tags = { "Groups" }, produces = "application/json") @ApiImplicitParams({ @ApiImplicitParam(name = "id", dataType = "string", value = "Only return group with the given id", paramType = "query"), @ApiImplicitParam(name = "name", dataType = "string", value = "Only return groups with the given name", paramType = "query"), @ApiImplicitParam(name = "type", dataType = "string", value = "Only return groups with the given type", paramType = "query"), @ApiImplicitParam(name = "nameLike", dataType = "string", value = "Only return groups with a name like the given value. Use % as wildcard-character.", paramType = "query"), @ApiImplicitParam(name = "member", dataType = "string", value = "Only return groups which have a member with the given username.", paramType = "query"), @ApiImplicitParam(name = "potentialStarter", dataType = "string", value = "Only return groups which members are potential starters for a process-definition with the given id.", paramType = "query"), @ApiImplicitParam(name = "sort", dataType = "string", value = "Property to sort on, to be used together with the order.", allowableValues = "id,name,type", paramType = "query"), }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the requested groups were returned.") }) @GetMapping(value = "/identity/groups", produces = "application/json") public DataResponse<GroupResponse> getGroups(@ApiParam(hidden = true) @RequestParam Map<String, String> allRequestParams, HttpServletRequest request)
focal_class.identifier: getGroups
focal_class.modifiers: @ApiOperation(value = "List groups", nickname="listGroups", tags = { "Groups" }, produces = "application/json") @ApiImplicitParams({ @ApiImplicitParam(name = "id", dataType = "string", value = "Only return group with the given id", paramType = "query"), @ApiImplicitParam(name = "name", dataType = "string", value = "Only return groups with the given name", paramType = "query"), @ApiImplicitParam(name = "type", dataType = "string", value = "Only return groups with the given type", paramType = "query"), @ApiImplicitParam(name = "nameLike", dataType = "string", value = "Only return groups with a name like the given value. Use % as wildcard-character.", paramType = "query"), @ApiImplicitParam(name = "member", dataType = "string", value = "Only return groups which have a member with the given username.", paramType = "query"), @ApiImplicitParam(name = "potentialStarter", dataType = "string", value = "Only return groups which members are potential starters for a process-definition with the given id.", paramType = "query"), @ApiImplicitParam(name = "sort", dataType = "string", value = "Property to sort on, to be used together with the order.", allowableValues = "id,name,type", paramType = "query"), }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the requested groups were returned.") }) @GetMapping(value = "/identity/groups", produces = "application/json") public
focal_class.parameters: (@ApiParam(hidden = true) @RequestParam Map<String, String> allRequestParams, HttpServletRequest request)
focal_class.return: DataResponse<GroupResponse>
focal_class.signature: DataResponse<GroupResponse> getGroups(@ApiParam(hidden = true) @RequestParam Map<String, String> allRequestParams, HttpServletRequest request)
focal_class.class_method_signature: GroupCollectionResource.createGroup(@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response)
focal_class.full_signature: @ApiOperation(value = "Create a group", tags = { "Groups" }) @ApiResponses(value = { @ApiResponse(code = 201, message = "Indicates the group was created."), @ApiResponse(code = 400, message = "Indicates the id of the group was missing.") }) @PostMapping(value = "/identity/groups", produces = "application/json") public GroupResponse createGroup(@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response)
focal_class.identifier: createGroup
focal_class.modifiers: @ApiOperation(value = "Create a group", tags = { "Groups" }) @ApiResponses(value = { @ApiResponse(code = 201, message = "Indicates the group was created."), @ApiResponse(code = 400, message = "Indicates the id of the group was missing.") }) @PostMapping(value = "/identity/groups", produces = "application/json") public
focal_class.parameters: (@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response)
focal_class.return: GroupResponse
focal_class.signature: GroupResponse createGroup(@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response)
focal_method.body: @ApiOperation(value = "Create a group", tags = { "Groups" })
      @ApiResponses(value = {
              @ApiResponse(code = 201, message = "Indicates the group was created."),
              @ApiResponse(code = 400, message = "Indicates the id of the group was missing.")
      })
      @PostMapping(value = "/identity/groups", produces = "application/json")
      public GroupResponse createGroup(@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response) {
          if (groupRequest.getId() == null) {
              throw new FlowableIllegalArgumentException("Id cannot be null.");
          }
          
          if (restApiInterceptor != null) {
              restApiInterceptor.createGroup(groupRequest);
          }
  
          // Check if a user with the given ID already exists so we return a CONFLICT
          if (identityService.createGroupQuery().groupId(groupRequest.getId()).count() > 0) {
              throw new FlowableConflictException("A group with id '" + groupRequest.getId() + "' already exists.");
          }
  
          Group created = identityService.newGroup(groupRequest.getId());
          created.setId(groupRequest.getId());
          created.setName(groupRequest.getName());
          created.setType(groupRequest.getType());
          identityService.saveGroup(created);
  
          response.setStatus(HttpStatus.CREATED.value());
  
          return restResponseFactory.createGroupResponse(created);
      }
focal_method.class_method_signature: GroupCollectionResource.createGroup(@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response)
focal_method.full_signature: @ApiOperation(value = "Create a group", tags = { "Groups" }) @ApiResponses(value = { @ApiResponse(code = 201, message = "Indicates the group was created."), @ApiResponse(code = 400, message = "Indicates the id of the group was missing.") }) @PostMapping(value = "/identity/groups", produces = "application/json") public GroupResponse createGroup(@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response)
focal_method.identifier: createGroup
focal_method.invocations: getId createGroup count groupId createGroupQuery getId getId newGroup getId setId getId setName getName setType getType saveGroup setStatus value createGroupResponse
focal_method.modifiers: @ApiOperation(value = "Create a group", tags = { "Groups" }) @ApiResponses(value = { @ApiResponse(code = 201, message = "Indicates the group was created."), @ApiResponse(code = 400, message = "Indicates the id of the group was missing.") }) @PostMapping(value = "/identity/groups", produces = "application/json") public
focal_method.parameters: (@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response)
focal_method.return: GroupResponse
focal_method.signature: GroupResponse createGroup(@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response)