in service/src/main/java/org/apache/fineract/cn/office/rest/controller/OfficeRestController.java [185:201]
ResponseEntity<Void> addBranch(@PathVariable("identifier") final String identifier,
@RequestBody @Valid final Office office) {
if (!this.officeService.officeExists(identifier)) {
throw ServiceException.notFound("Parent office {0} not found.", identifier);
}
if (office == null) {
throw ServiceException.badRequest("An office must be given.");
}
if (this.officeService.officeExists(office.getIdentifier())) {
throw ServiceException.conflict("Office {0} already exists.", office.getIdentifier());
}
this.commandGateway.process(new AddBranchCommand(identifier, office));
return ResponseEntity.accepted().build();
}