ResponseEntity updateEmployee()

in service/src/main/java/org/apache/fineract/cn/office/rest/controller/OfficeRestController.java [382:399]


  ResponseEntity<Void> updateEmployee(@PathVariable("useridentifier") final String identifier,
                                      @RequestBody @Valid final Employee employee) {
    if (!this.employeeService.employeeExists(identifier)) {
      throw ServiceException.notFound("Employee {0} not found.", identifier);
    }

    if (employee.getIdentifier() != null && !identifier.equals(employee.getIdentifier())) {
      throw ServiceException.badRequest("Employee code must match resource identifier");
    }

    if (employee.getAssignedOffice() != null && !this.officeService.officeExists(employee.getAssignedOffice())) {
      throw ServiceException.notFound("Office {0} to assign not found.", employee.getAssignedOffice());
    }

    this.commandGateway.process(new UpdateEmployeeCommand(employee));

    return ResponseEntity.accepted().build();
  }