public String setContactDetail()

in service/src/main/java/org/apache/fineract/cn/office/internal/command/handler/EmployeeAggregate.java [155:176]


  public String setContactDetail(final SetContactDetailsCommand setContactDetailsCommand)
      throws ServiceException {

    final EmployeeEntity employeeEntity = this.employeeRepository.findByIdentifier(setContactDetailsCommand.identifier());
    if (employeeEntity == null) {
      throw ServiceException.notFound("Employee {0} not found.", setContactDetailsCommand.identifier());
    }

    this.deleteContactDetails(employeeEntity);

    final List<ContactDetail> contactDetails = setContactDetailsCommand.contactDetails();

    if (contactDetails != null && !contactDetails.isEmpty()) {
      this.saveContactDetail(employeeEntity, contactDetails);
    }

    employeeEntity.setLastModifiedBy(UserContextHolder.checkedGetUser());
    employeeEntity.setLastModifiedOn(Utils.utcNow());
    this.employeeRepository.save(employeeEntity);

    return setContactDetailsCommand.identifier();
  }