コード例 #1
0
  private GetReceivedFilesResponse getReceivedFilesResponse(Job job) {

    for (Activity activity : job.getActivities()) {
      if (activity.getSubject().equals("receivedfiles") && activity.getPredicate().equals("get")) {
        return (GetReceivedFilesResponse) activity.getResponse();
      }
    }
    return null;
  }
コード例 #2
0
  protected Activity craftUnpackageListingActivity() throws ParseException {
    Activity unpackageActivity = new Activity();
    unpackageActivity.setPredicate("unpackage");
    unpackageActivity.setSubject("listing");
    UnpackageListingResponse response = new UnpackageListingResponse();

    ScannedListingBatchHeader scannedListingBatchHeader = createScannedListingBatchHeader();

    response.setScannedListing(scannedListingBatchHeader);
    unpackageActivity.setResponse(response);
    return unpackageActivity;
  }
コード例 #3
0
  /**
   * Determine if this inbound file for voucher processing has been presented before. 1. Check if a
   * camunda process is in flight 2.
   *
   * @param processBusinessKey
   * @return
   */
  public boolean matchFile(String processBusinessKey) {
    boolean isMatched = true;
    Job job = jobStore.findJob(processBusinessKey);

    GetReceivedFilesResponse getReceivedFilesResponse = getReceivedFilesResponse(job);
    if (getReceivedFilesResponse == null) return false;

    File sourceFile = new File(lockerPath, processBusinessKey);
    log.info("MatchReceivedFilesRoute || sourceFile path - " + sourceFile.getAbsolutePath());

    if (!sourceFile.exists()) {
      log.error("SourceFile Does not  exist --" + sourceFile.getAbsolutePath());
      return false;
    }

    File[] receivedFile =
        sourceFile.listFiles(
            new FilenameFilter() {
              public boolean accept(File dir, String filename) {
                return filename.endsWith(".DAT");
              }
            });

    File receivedFileName = receivedFile[0];
    log.info("MatchReceivedFilesRoute || receivedDatFile name - " + receivedFileName.getName());

    List<String> fileNameInFileList = getFileNamesInFile(receivedFileName);
    log.info("MatchReceivedFilesRoute || fileNameInDATFile - Size - " + fileNameInFileList.size());

    MatchFilesResponse matchFilesResponse =
        matchReceivedFileNames(getReceivedFilesResponse.getReceivedFiles(), fileNameInFileList);

    Activity parameterActivity = new Activity();
    parameterActivity.setPredicate("match");
    parameterActivity.setSubject("receivedfiles");
    parameterActivity.setJobIdentifier(processBusinessKey);
    parameterActivity.setResponse(matchFilesResponse);
    parameterActivity.setRequestDateTime(new Date());
    job.getActivities().add(parameterActivity);

    if ((matchFilesResponse.getUnmatchedFilesFromDats().size() != 0)
        || (matchFilesResponse.getUnmatchedFilesReceiveds().size() != 0)) {
      isMatched = false;
    }

    log.info("MatchReceivedFilesRoute || isMatched - " + isMatched);

    return isMatched;
  }