// ---------------------------------------------------------------------------
  // 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 String buildResultTable_dojo_JD(java.util.List list)
      throws org.openeai.config.EnterpriseConfigurationObjectException {
    String result = new String();

    // generate XML from results
    Document aDoc = new DocumentImpl();
    Element t = aDoc.createElement("retroJobDetailTable_dojo");

    Element headEle = aDoc.createElement("Header");
    headEle.setAttribute("heffdate", "Effective Date");
    headEle.setAttribute("hjobchgcode", "Job Change Reason");
    headEle.setAttribute("hperschgdate", "Personnel Change Date");
    t.appendChild(headEle);

    ListIterator results = list.listIterator();
    while (results.hasNext()) {
      JobDetail jobDetail = (JobDetail) results.next();

      Element dataEle = aDoc.createElement("Data");
      dataEle.setAttribute(
          "effdate",
          jobDetail.getEffectiveDate() == null ? "" : formatDate(jobDetail.getEffectiveDate()));
      dataEle.setAttribute(
          "jobchgcode",
          jobDetail.getValidJobChangeReason() == null
              ? ""
              : jobDetail.getValidJobChangeReason().getDescription());
      dataEle.setAttribute(
          "perschgdate",
          jobDetail.getPersonnelChangeDate() == null
              ? ""
              : formatDate(jobDetail.getPersonnelChangeDate()));
      t.appendChild(dataEle);
    }

    aDoc.appendChild(t);
    dumpNode(aDoc);

    try {
      // transform XML using XSL file
      result = transform(aDoc, "jobselection.xsl");
      String tmp = new String("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
      result = result.substring(tmp.length());
    } catch (Exception e) {
      e.printStackTrace();
      result = "Error transforming results.";
    }
    logger.debug("The JobDetail table constructed by dojo");
    logger.debug("\t" + result);
    return result;
  }