コード例 #1
0
 private void updateAlternateContactNumber(
     FrontLineWorker frontLineWorker, MsisdnImportRequest request) {
   if (!request.isUpdateAlternateContactNumber()) {
     return;
   }
   frontLineWorker.setAlternateContactNumber(request.alternateContactNumberAsLong());
 }
コード例 #2
0
  private FrontLineWorker changeMsisdnAndGetFLWToSync(
      FrontLineWorker frontLineWorker, MsisdnImportRequest request) {
    if (!request.isChangeMsisdn()) {
      return frontLineWorker;
    }
    allFrontLineWorkers.deleteByMsisdn(request.newMsisdnAsLong());

    frontLineWorker.setNewMsisdn(
        new NewMsisdn(request.getNewMsisdn(), frontLineWorker.getFlwId().toString()));
    FrontLineWorker frontLineWorkerToSync = frontLineWorker.clone();
    frontLineWorker.updateToNewMsisdn();
    return frontLineWorkerToSync;
  }
コード例 #3
0
  @Transactional
  public void updateFLWContactDetailsWithoutValidations(
      List<MsisdnImportRequest> msisdnImportRequests) {
    List<FrontLineWorker> frontLineWorkersToUpdate = new ArrayList<>();
    List<FrontLineWorker> frontLineWorkersToSync = new ArrayList<>();
    for (MsisdnImportRequest msisdnImportRequest : msisdnImportRequests) {
      FrontLineWorker frontLineWorker =
          allFrontLineWorkers.getByMsisdn(msisdnImportRequest.msisdnAsLong()).get(0);
      updateAlternateContactNumber(frontLineWorker, msisdnImportRequest);
      FrontLineWorker frontLineWorkerToSync =
          changeMsisdnAndGetFLWToSync(frontLineWorker, msisdnImportRequest);

      frontLineWorkersToUpdate.add(frontLineWorker);
      frontLineWorkersToSync.add(frontLineWorkerToSync);
    }
    allFrontLineWorkers.createOrUpdateAll(frontLineWorkersToUpdate);
    syncService.syncAllFrontLineWorkers(frontLineWorkersToSync);
  }