ResponseEntity processGroupCommand()

in service/src/main/java/org/apache/fineract/cn/group/rest/GroupRestController.java [170:187]


  ResponseEntity<Void> processGroupCommand(@PathVariable("identifier") final String identifier, @RequestBody final GroupCommand groupCommand) {
    this.groupService.findByIdentifier(identifier).orElseThrow(() -> ServiceException.notFound("Group {0} not found.", identifier));
    final GroupCommand.Action action = GroupCommand.Action.valueOf(groupCommand.getAction());
    switch (action) {
      case ACTIVATE:
        this.commandGateway.process(new ActivateGroupCommand(identifier, groupCommand));
        break;
      case CLOSE:
        this.commandGateway.process(new CloseGroupCommand(identifier, groupCommand));
        break;
      case REOPEN:
        this.commandGateway.process(new ReopenGroupCommand(identifier, groupCommand));
        break;
      default:
        throw ServiceException.badRequest("Unsupported command {0}.", action.name());
    }
    return ResponseEntity.accepted().build();
  }