in service/src/main/java/org/apache/fineract/cn/office/rest/controller/OfficeRestController.java [232:253]
ResponseEntity<Void> deleteOffice(@PathVariable("identifier") final String identifier)
throws InterruptedException {
if (!this.officeService.officeExists(identifier)) {
throw ServiceException.notFound("Office {0} not found.", identifier);
}
if (this.officeService.branchExists(identifier)) {
throw ServiceException.conflict("Office {0} has children.", identifier);
}
if(this.officeService.hasEmployees(identifier)){
throw ServiceException.conflict("Office {0} has employees.", identifier);
}
if (this.officeService.hasExternalReferences(identifier)) {
throw ServiceException.conflict("Office {0} has external references.", identifier);
}
this.commandGateway.process(new DeleteOfficeCommand(identifier));
return ResponseEntity.accepted().build();
}