// ---------------------------------------------------------------------------
 public JobAssignment selectJobAssignment(java.util.List list) {
   ListIterator results = list.listIterator();
   while (results.hasNext()) {
     JobAssignment jobAssignment = (JobAssignment) results.next();
     if (jobAssignment.getBaseJobData().getPosition().equals(m_position)
         && jobAssignment.getBaseJobData().getSuffix().equals(m_suffix)) {
       return jobAssignment;
     }
   }
   return null;
 }
  // ---------------------------------------------------------------------------
  // called from Translator_AJAX
  public String filterJobDetail(String selectedJobPosition, String selectedSuffix)
      throws InstantiationException, org.openeai.config.EnterpriseConfigurationObjectException {
    m_position = selectedJobPosition;
    m_suffix = selectedSuffix;

    String retVal =
        new String("<p>Job Assignment record is not available for retroactive job change.</p>");

    JobAssignment selectedJobAssignment = selectJobAssignment(m_filteredJobAssignments);
    if (selectedJobAssignment == null) {
      return retVal;
    } else {
      Vector allJobDetails = new Vector();
      int howmanyJDs = selectedJobAssignment.getJobDetailLength();
      logger.debug(
          "Translator_RetroJobChange:filterJobDetail, number of job changes for selected job assignment ==> "
              + howmanyJDs);
      // If there is no job detail, give error.
      if (howmanyJDs <= 0) {
        retVal = "<p>No Job Details record found for Historical Job Change.</p>";
      } else {
        // The job details are listed in descending order of personnel change date.
        // We want to allow the user to change any job detail that have not yet been paid on.
        for (int i = 0; i < howmanyJDs; i++) {
          JobDetail jobDetail = selectedJobAssignment.getJobDetail(i);
          try {
            if (datesCompare(
                    jobDetail.getEffectiveDate().toDate(),
                    "after",
                    selectedJobAssignment.getLastPaidDate())
                || datesCompare(
                    jobDetail.getEffectiveDate().toDate(),
                    "equals",
                    selectedJobAssignment.getBaseJobData().getStartDate())) {
              continue;
            }
          } catch (Exception e) {
            continue;
          }
          allJobDetails.add(jobDetail);
        }
        retVal = setTableSorterJD(allJobDetails);
      }
      // If there were no job details selected, give error.
      if (allJobDetails.size() <= 0) {
        retVal = "<p>No Job Details records found for Historical Job Change.</p>";
      }
    }

    return retVal;
  }
  // ---------------------------------------------------------------------------
  private Vector filterJobs(java.util.List allJobs, java.util.Date effDate)
      throws java.lang.Exception {
    Vector filteredList = new Vector();

    java.util.Date jobStartDate = new java.util.Date();
    java.util.Date jobEndDate = new java.util.Date();

    ListIterator results = allJobs.listIterator();
    while (results.hasNext()) {
      JobAssignment jobAssignment = (JobAssignment) results.next();

      logger.debug(
          "direct values in Translator_RetroJobChange:filterJobs, jobStartDate => "
              + jobAssignment.getBaseJobData().getStartDate()
              + " jobEndDate => "
              + jobAssignment.getBaseJobData().getEndDate()
              + " effDate => "
              + effDate);

      // add this job only if it was active on effDate selected from ERV
      if (validateState(formatDate(jobAssignment.getBaseJobData().getStartDate())))
        jobStartDate =
            convertToDate(
                formatDate(
                    jobAssignment
                        .getBaseJobData()
                        .getStartDate())); // Can start date be a null? I don't know!

      if (hasValue(jobAssignment.getBaseJobData().getEndDate())) {
        jobEndDate = convertToDate(formatDate(jobAssignment.getBaseJobData().getEndDate()));
      } else {
        // Use today's date if job assignment's end date is null, which means the job is active as
        // of today
        jobEndDate = new java.util.Date();
      }

      logger.debug(
          "Translator_RetroJobChange:filterJobs, jobStartDate => "
              + jobStartDate
              + " jobEndDate => "
              + jobEndDate
              + " effDate => "
              + effDate);
      if ((effDate.after(jobStartDate) && effDate.before(jobEndDate))
          || effDate.equals(jobStartDate)
          || effDate.equals(jobEndDate)) {
        logger.debug("criteria met, adding this jobAssignment => " + jobAssignment);
        filteredList.add(jobAssignment);
      }
    }

    logger.debug("num of filtered JobAssignment objects => " + filteredList.size());
    return filteredList;
  }