public String process()

in service/src/main/java/org/apache/fineract/cn/teller/service/internal/command/handler/TellerAggregate.java [124:157]


  public String process(final ChangeTellerCommand changeTellerCommand) {
    final String officeIdentifier = changeTellerCommand.officeIdentifier();
    final Teller teller = changeTellerCommand.teller();

    if (this.checkPreconditions(officeIdentifier, teller)) {
      final Optional<TellerEntity> optionalTellerEntity = this.tellerRepository.findByIdentifier(teller.getCode());
      if (optionalTellerEntity.isPresent()) {
        final TellerEntity tellerEntity = optionalTellerEntity.get();

        if (teller.getPassword() != null) {
          this.encryptPassword(teller, tellerEntity);
        }

        tellerEntity.setTellerAccountIdentifier(teller.getTellerAccountIdentifier());
        tellerEntity.setVaultAccountIdentifier(teller.getVaultAccountIdentifier());
        tellerEntity.setChequesReceivableAccount(teller.getChequesReceivableAccount());
        tellerEntity.setCashdrawLimit(teller.getCashdrawLimit());
        tellerEntity.setCashOverShortAccount(teller.getCashOverShortAccount());
        tellerEntity.setDenominationRequired(
            teller.getDenominationRequired() != null ? teller.getDenominationRequired() : Boolean.FALSE
        );
        tellerEntity.setLastModifiedBy(UserContextHolder.checkedGetUser());
        tellerEntity.setLastModifiedOn(LocalDateTime.now(Clock.systemUTC()));

        this.tellerRepository.save(tellerEntity);

        return teller.getCode();
      } else {
        throw new IllegalStateException("Teller " + teller.getCode() + " not found.");
      }
    } else {
      throw new IllegalStateException("Preconditions not met, see log file for further information.");
    }
  }